bb099e4c5b48329b842dbf9884f086f7b514bc0a,gpflow/models/model.py,GPModel,predict_f_samples,#GPModel#Any#Any#Any#Any#,112

Before Change


        Produce samples from the posterior latent function(s) at the input points.
        
        mu, var = self.predict_f(Xnew, full_cov=full_cov)  // [N, P], [P, N, N]
        num_latent_gps = var.shape[0]
        num_elems = tf.shape(var)[1]
        var_jitter = ops.add_to_diagonal(var, default_jitter())
        L = tf.linalg.cholesky(var_jitter)  // [P, N, N]
        V = tf.random.normal([num_latent_gps, num_elems, num_samples], dtype=mu.dtype)  // [P, N, S]
        LV = L @ V  // [P, N, S]
        mu_t = tf.linalg.adjoint(mu)  // [P, N]
        return tf.transpose(mu_t[..., np.newaxis] + LV)  // [S, N, P]

    def predict_y(
        self, Xnew: DataPoint, full_cov: bool = False, full_output_cov: bool = False

After Change



        Currently, the method does not support `full_output_cov=True` and `full_cov=True`.
        
        if full_cov and full_output_cov:
            raise NotImplementedError(
                "The combination of both `full_cov` and `full_output_cov` is not supported."
            )

        // check below for shape info
        mean, cov = self.predict_f(Xnew, full_cov=full_cov, full_output_cov=full_output_cov)
        if full_cov:
            // mean: [..., N, P]
            // cov: [..., P, N, N]
            mean_for_sample = tf.linalg.adjoint(mean)  // [..., P, N]
            samples = sample_mvn(
                mean_for_sample, cov, "full", num_samples=num_samples
            )  // [..., (S), P, N]
            samples = tf.linalg.adjoint(samples)  // [..., (S), N, P]
        else:
            // mean: [..., N, P]
            // cov: [..., N, P] or [..., N, P, P]
            cov_structure = "full" if full_output_cov else "diag"
            samples = sample_mvn(
                mean, cov, cov_structure, num_samples=num_samples
            )  // [..., (S), N, P]
        return samples  // [..., (S), N, P]

    def predict_y(
        self, Xnew: DataPoint, full_cov: bool = False, full_output_cov: bool = False
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: GPflow/GPflow
Commit Name: bb099e4c5b48329b842dbf9884f086f7b514bc0a
Time: 2020-03-16
Author: dutordoirv@gmail.com
File Name: gpflow/models/model.py
Class Name: GPModel
Method Name: predict_f_samples


Project Name: GPflow/GPflow
Commit Name: bd1e9c04b48dd5ccca9619d5eaa2595a358bdb08
Time: 2020-01-31
Author: st--@users.noreply.github.com
File Name: gpflow/kernels/misc.py
Class Name: Coregion
Method Name: K


Project Name: keras-team/keras
Commit Name: ee8ff00a2a8a307c952fb8e7bef241188c7fb12b
Time: 2016-07-03
Author: francois.chollet@gmail.com
File Name: keras/backend/tensorflow_backend.py
Class Name:
Method Name: pool2d