TestUtils
Models.TestUtils
— ModuleModels.TestUtils
Provides test fakes, FakeTemplate
and FakeModel
, that are useful for testing downstream dependencies, and test_interface
for testing the Models API has been correctly implemented.
Interface Tests
Models.TestUtils.test_interface
— Functiontest_interface(template::Template; inputs=rand(5, 5), outputs=rand(5, 5))
Test that subtypes of Template
and Model
implement the expected API. Can be used as an initial test to verify the API has been correctly implemented.
Returns the predictions of the Model
.
Test Fakes
Models.TestUtils.FakeModel
— TypeFakeModel
A fake Model for testing purposes. See FakeTemplate
for details.
Models.TestUtils.FakeTemplate
— TypeFakeTemplate{E <: EstimateTrait, O <: OutputTrait} <: Template
This template is a test double for testing purposes. It should be defined (before fitting) with a predictor
, which can be changed by mutating the field.
Fields
predictor::Function
: predicts the outputs of theFakeModel
. It is(num_variates, inputs) -> outputs
, where thenum_variates
will be memorized duringfit
.
Methods
Models.TestUtils.FakeTemplate
— MethodFakeTemplate{DistributionEstimate, MultiOutput}()
A Template
whose Model
will predict a multivariate normal posterior distribution (with zero-vector mean and identity covariance matrix) for each observation.
Models.TestUtils.FakeTemplate
— MethodFakeTemplate{PointEstimate, MultiOutput}()
A Template
whose Model
will predict a vector of 0s for each observation. The input and output will have the same dimension.
Models.TestUtils.FakeTemplate
— MethodFakeTemplate{DistributionEstimate, SingleOutput}()
A Template
whose Model
will predict a univariate normal posterior distribution (with zero mean and unit standard deviation) for each observation.
Models.TestUtils.FakeTemplate
— MethodFakeTemplate{PointEstimate, SingleOutput}()