a9a2a58840f209c4282f8595bdd7cfcc5540ab2e,testing/test_conditionals.py,DiagsTest,test_whiten,#DiagsTest#,35

Before Change


            Fstar_mean_1, Fstar_var_1 = GPflow.conditionals.gaussian_gp_predict_whitened(self.Xs, self.X, self.k, self.mu, self.sqrt)
            Fstar_mean_2, Fstar_var_2 = GPflow.conditionals.gaussian_gp_predict_whitened(self.Xs, self.X, self.k, self.mu, self.chol)
            
        mean_diff = theano.function([self.X, self.Xs, self.mu, self.sqrt, self.free_x],
                                Fstar_mean_1 - Fstar_mean_2, on_unused_input="ignore")(
                                        self.X_data, self.Xs_data, self.mu_data, self.sqrt_data, self.free_x_data)

        var_diff = theano.function([self.X, self.Xs, self.mu, self.sqrt, self.free_x],
                                Fstar_var_1 - Fstar_var_2, on_unused_input="ignore")(
                                        self.X_data, self.Xs_data, self.mu_data, self.sqrt_data, self.free_x_data)

        self.failUnless(np.allclose(mean_diff, 0))
        self.failUnless(np.allclose(var_diff, 0))

After Change


        //the chols are diagonal matrices, with the same entries as the diag representation.
        self.chol = theano.scan(lambda x : tf.diag(x), self.sqrt.T)[0].swapaxes(0,2)

    def test_whiten(self):
        with self.k.tf_mode():
            Fstar_mean_1, Fstar_var_1 = GPflow.conditionals.gaussian_gp_predict_whitened(self.Xs, self.X, self.k, self.mu, self.sqrt)
            Fstar_mean_2, Fstar_var_2 = GPflow.conditionals.gaussian_gp_predict_whitened(self.Xs, self.X, self.k, self.mu, self.chol)
            
        mean_diff = tf.Session().run(Fstar_mean_1 - Fstar_mean_2, feed_dict=self.feed_dict)
        var_diff = tf.Session().run(Fstar_var_1 - Fstar_var_2, feed_dict=self.feed_dict)

        self.failUnless(np.allclose(mean_diff, 0))
        self.failUnless(np.allclose(var_diff, 0))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 23

Instances


Project Name: GPflow/GPflow
Commit Name: a9a2a58840f209c4282f8595bdd7cfcc5540ab2e
Time: 2016-01-18
Author: james.hensman@gmail.com
File Name: testing/test_conditionals.py
Class Name: DiagsTest
Method Name: test_whiten


Project Name: GPflow/GPflow
Commit Name: a9a2a58840f209c4282f8595bdd7cfcc5540ab2e
Time: 2016-01-18
Author: james.hensman@gmail.com
File Name: testing/test_conditionals.py
Class Name: WhitenTest
Method Name: test_whiten


Project Name: GPflow/GPflow
Commit Name: a9a2a58840f209c4282f8595bdd7cfcc5540ab2e
Time: 2016-01-18
Author: james.hensman@gmail.com
File Name: testing/test_conditionals.py
Class Name: WhitenTestGaussian
Method Name: test_whiten


Project Name: GPflow/GPflow
Commit Name: a9a2a58840f209c4282f8595bdd7cfcc5540ab2e
Time: 2016-01-18
Author: james.hensman@gmail.com
File Name: testing/test_conditionals.py
Class Name: DiagsTest
Method Name: test_nonwhiten


Project Name: GPflow/GPflow
Commit Name: a9a2a58840f209c4282f8595bdd7cfcc5540ab2e
Time: 2016-01-18
Author: james.hensman@gmail.com
File Name: testing/test_conditionals.py
Class Name: DiagsTest
Method Name: test_whiten