test_svgp_trainer
TestSparseGPTrainer
Bases: unittest.TestCase
Unit test suite for the SparseGPTrainer class.
This class contains a series of methods to test the functionalities of SparseGPTrainer, including training and making predictions with uncertainty.
Attributes:
Name | Type | Description |
---|---|---|
X |
np.array
|
An array of feature vectors for the training data. |
y |
np.array
|
An array of target values for the training data. |
trainer |
SparseGPTrainer
|
The SparseGPTrainer instance to test. |
Source code in uncertaintyplayground/tests/test_svgp_trainer.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
setUp()
Setup function that runs before each test method.
This method generates random data for the tests and initializes an instance of SparseGPTrainer.
Source code in uncertaintyplayground/tests/test_svgp_trainer.py
17 18 19 20 21 22 23 24 25 |
|
test_predict_with_uncertainty()
Tests the predict_with_uncertainty method of the SparseGPTrainer class.
This test trains the model and then makes a prediction with uncertainty. It checks that the predictions and uncertainties have the correct shape.
Source code in uncertaintyplayground/tests/test_svgp_trainer.py
36 37 38 39 40 41 42 43 44 45 |
|
test_train()
Tests the train method of the SparseGPTrainer class.
This test trains the model and checks that it has non-zero parameters afterward, verifying that training has indeed happened.
Source code in uncertaintyplayground/tests/test_svgp_trainer.py
27 28 29 30 31 32 33 34 |
|