8c65ef658930afecb7001ce671f15772a0a4b23b,gpflow/base.py,Parameter,__init__,#,88

Before Change


        self.prior = prior
        self.prior_on = prior_on  // type: ignore  // see https://github.com/python/mypy/issues/3004

        if isinstance(value, tf.Variable):
            self._unconstrained = value
        else:
            unconstrained_value = self.validate_unconstrained_value(value, dtype)
            self._unconstrained = tf.Variable(
                unconstrained_value, dtype=dtype, name=name, trainable=trainable
            )

    def log_prior_density(self) -> tf.Tensor:
         Log of the prior probability density of the constrained variable. 

        if self.prior is None:

After Change


        therefore we need a positive constraint and it is natural to use constrained values.
        A prior can be imposed either on the constrained version (default) or on the unconstrained version of the parameter.
        
        if transform is None:
            transform = tfp.bijectors.Identity()

        value = _cast_to_dtype(value, dtype)
        _validate_unconstrained_value(value, transform, dtype)
        super().__init__(value, transform, dtype=value.dtype, trainable=trainable, name=name)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: GPflow/GPflow
Commit Name: 8c65ef658930afecb7001ce671f15772a0a4b23b
Time: 2020-08-17
Author: art.art.v@gmail.com
File Name: gpflow/base.py
Class Name: Parameter
Method Name: __init__


Project Name: maciejkula/spotlight
Commit Name: 7a82079d10379287ba4e6e42e21b5b3ce8f541bc
Time: 2017-07-13
Author: maciej.kula@gmail.com
File Name: spotlight/sequence/implicit.py
Class Name: ImplicitSequenceModel
Method Name: fit


Project Name: dpressel/mead-baseline
Commit Name: c2684e5cf3719d15ca5a13c1919642f96b55f177
Time: 2018-06-10
Author: dpressel@gmail.com
File Name: python/baseline/pytorch/classify/model.py
Class Name: WordClassifierBase
Method Name: make_input


Project Name: GPflow/GPflow
Commit Name: f3c511060ce62072a34a50319237d28b82d10448
Time: 2020-08-27
Author: dutordoirv@gmail.com
File Name: gpflow/base.py
Class Name: Parameter
Method Name: __init__