TestUtils

Interface Tests

Models.TestUtils.test_interfaceFunction
test_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.

source

Test Fakes

Models.TestUtils.FakeTemplateType
FakeTemplate{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 the FakeModel. It is (num_variates, inputs) -> outputs, where the num_variates will be memorized during fit.

Methods

  • fit does not learn anything, it just creates an instance of the corresponding Model.
  • predict applies the predictor to the inputs.
source
Models.TestUtils.FakeTemplateMethod
FakeTemplate{DistributionEstimate, MultiOutput}()

A Template whose Model will predict a multivariate normal posterior distribution (with zero-vector mean and identity covariance matrix) for each observation.

source
Models.TestUtils.FakeTemplateMethod
FakeTemplate{DistributionEstimate, SingleOutput}()

A Template whose Model will predict a univariate normal posterior distribution (with zero mean and unit standard deviation) for each observation.

source