5b83fcf8d524cab79fbb3195653ae824fafc737c,test/examples/test_sgpr_regression.py,TestSGPRRegression,test_sgpr_mean_abs_error_cuda,#TestSGPRRegression#,136

Before Change


        self.assertLess(torch.max((fast_var_cache - slow_var).abs()), 1e-3)

    def test_sgpr_mean_abs_error_cuda(self):
        if torch.cuda.is_available():
            train_x, train_y, test_x, test_y = make_data(cuda=True)
            likelihood = GaussianLikelihood().cuda()
            gp_model = GPRegressionModel(train_x, train_y, likelihood).cuda()
            mll = gpytorch.mlls.ExactMarginalLogLikelihood(likelihood, gp_model)

            // Optimize the model
            gp_model.train()
            likelihood.train()

            optimizer = optim.Adam(list(gp_model.parameters()) + list(likelihood.parameters()), lr=0.1)
            optimizer.n_iter = 0
            for _ in range(25):
                optimizer.zero_grad()
                output = gp_model(train_x)
                loss = -mll(output, train_y)
                loss.backward()
                optimizer.n_iter += 1
                optimizer.step()

            for param in gp_model.parameters():
                self.assertTrue(param.grad is not None)
                self.assertGreater(param.grad.norm().item(), 0)
            for param in likelihood.parameters():
                self.assertTrue(param.grad is not None)
                self.assertGreater(param.grad.norm().item(), 0)

            // Test the model
            gp_model.eval()
            likelihood.eval()
            test_preds = likelihood(gp_model(test_x)).mean
            mean_abs_error = torch.mean(torch.abs(test_y - test_preds))

            self.assertLess(mean_abs_error.squeeze().item(), 0.02)


if __name__ == "__main__":
    unittest.main()

After Change


        self.assertLess(torch.max((fast_var_cache - slow_var).abs()), 1e-3)

    def test_sgpr_mean_abs_error_cuda(self):
        if not torch.cuda.is_available():
            return
        with least_used_cuda_device():
            train_x, train_y, test_x, test_y = make_data(cuda=True)
            likelihood = GaussianLikelihood().cuda()
            gp_model = GPRegressionModel(train_x, train_y, likelihood).cuda()
            mll = gpytorch.mlls.ExactMarginalLogLikelihood(likelihood, gp_model)

            // Optimize the model
            gp_model.train()
            likelihood.train()

            optimizer = optim.Adam(list(gp_model.parameters()) + list(likelihood.parameters()), lr=0.1)
            optimizer.n_iter = 0
            for _ in range(25):
                optimizer.zero_grad()
                output = gp_model(train_x)
                loss = -mll(output, train_y)
                loss.backward()
                optimizer.n_iter += 1
                optimizer.step()

            for param in gp_model.parameters():
                self.assertTrue(param.grad is not None)
                self.assertGreater(param.grad.norm().item(), 0)
            for param in likelihood.parameters():
                self.assertTrue(param.grad is not None)
                self.assertGreater(param.grad.norm().item(), 0)

            // Test the model
            gp_model.eval()
            likelihood.eval()
            test_preds = likelihood(gp_model(test_x)).mean
            mean_abs_error = torch.mean(torch.abs(test_y - test_preds))

            self.assertLess(mean_abs_error.squeeze().item(), 0.02)


if __name__ == "__main__":
    unittest.main()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 8

Non-data size: 8

Instances


Project Name: cornellius-gp/gpytorch
Commit Name: 5b83fcf8d524cab79fbb3195653ae824fafc737c
Time: 2019-02-12
Author: balandat@fb.com
File Name: test/examples/test_sgpr_regression.py
Class Name: TestSGPRRegression
Method Name: test_sgpr_mean_abs_error_cuda


Project Name: cornellius-gp/gpytorch
Commit Name: 5b83fcf8d524cab79fbb3195653ae824fafc737c
Time: 2019-02-12
Author: balandat@fb.com
File Name: test/examples/test_kissgp_gp_regression.py
Class Name: TestKISSGPRegression
Method Name: test_kissgp_gp_mean_abs_error_cuda


Project Name: cornellius-gp/gpytorch
Commit Name: 5b83fcf8d524cab79fbb3195653ae824fafc737c
Time: 2019-02-12
Author: balandat@fb.com
File Name: test/examples/test_simple_gp_regression.py
Class Name: TestSimpleGPRegression
Method Name: test_gp_posterior_mean_skip_variances_fast_cuda


Project Name: cornellius-gp/gpytorch
Commit Name: 5b83fcf8d524cab79fbb3195653ae824fafc737c
Time: 2019-02-12
Author: balandat@fb.com
File Name: test/examples/test_simple_gp_regression.py
Class Name: TestSimpleGPRegression
Method Name: test_gp_posterior_mean_skip_variances_slow_cuda


Project Name: cornellius-gp/gpytorch
Commit Name: 5b83fcf8d524cab79fbb3195653ae824fafc737c
Time: 2019-02-12
Author: balandat@fb.com
File Name: test/examples/test_batch_svgp_gp_regression.py
Class Name: TestSVGPRegression
Method Name: test_regression_error_cuda


Project Name: cornellius-gp/gpytorch
Commit Name: 5b83fcf8d524cab79fbb3195653ae824fafc737c
Time: 2019-02-12
Author: balandat@fb.com
File Name: test/examples/test_simple_gp_classification.py
Class Name: TestSimpleGPClassification
Method Name: test_classification_error_cuda


Project Name: cornellius-gp/gpytorch
Commit Name: 5b83fcf8d524cab79fbb3195653ae824fafc737c
Time: 2019-02-12
Author: balandat@fb.com
File Name: test/examples/test_kissgp_white_noise_regression.py
Class Name: TestKISSGPWhiteNoiseRegression
Method Name: test_kissgp_gp_mean_abs_error_cuda


Project Name: cornellius-gp/gpytorch
Commit Name: 2407ae4edb731604944e4d07993a094530ab9563
Time: 2019-02-09
Author: balandat@fb.com
File Name: test/examples/test_svgp_gp_regression.py
Class Name: TestSVGPRegression
Method Name: test_regression_error_cuda