Skip to main content

testing.check_predictive

testing.check_predictive(predictive, posterior, inputs)

Check a predictive against the core contracts.

  • requires is a Requirements.
  • It takes a generator keyword, as lk.predict calls it.
  • It returns a Distribution whose batch shape starts with the number of examples in inputs: the leading dimension of the first input leaf, as Batch.size counts it. Trailing batch dimensions (outputs, sequence positions) are allowed.

Errors that the predictive raises propagate.

Parameters

Name Type Description Default
predictive Predictive[B] The predictive. required
posterior B The posterior to predict with. required
inputs Inputs The inputs to predict at. required

Raises

Name Type Description
AssertionError A law above fails. The message names the law and predictive.
ValueError inputs has no tensor leaves, or its first leaf is 0-dim.