Skip to main content

models.OnnxPredictor

An OnnxModel behind the model interface: each graph input bound to

Usage

Source

models.OnnxPredictor()

design columns, one output read as each row’s mean, and a family for predictive draws.

Parameters

model: OnnxModel
family: str

The family of the predictive draws (poisson, gamma, …).

inputs: dict of str to list of str

Each graph input’s design columns: a rank-2 input takes its columns in order ([rows, columns]), a rank-1 input one column. An integer input (an embedding’s category codes) must hold whole numbers.

output: int = 0

Which output is the mean.

scale: (mean, link) = "mean"

"mean": the output is the mean. "link": the output is on the link’s scale and added to the design’s offset, mu = g^-1(offset + output) (a CANN’s correction, or a network trained with an exposure offset).

link: str

The link for scale="link"; by default the log link for the gamma, inverse Gaussian and Tweedie, the canonical link otherwise.

dispersion: float = 1

The family’s dispersion for predictive draws.

theta: float

The negative binomial’s theta or the Tweedie power.

power: float
The negative binomial’s theta or the Tweedie power.

Methods

Name Description
predict() Expected response for each row of design.
predict_distribution() Joint predictive distribution across the rows: process draws from

predict()

Expected response for each row of design.

Usage

Source

predict(design)
Raises
ValueError
If a graph input is not bound, a bound column is missing, or an integer input holds a fraction.

predict_distribution()

Joint predictive distribution across the rows: process draws from

Usage

Source

predict_distribution(design, n_sims, seed)

the family and dispersion around the predicted means.

Parameters
design: Design
n_sims: int
seed: int
Returns
PredictiveDistribution