ImpactModel#

ImpactModel(kernel, rng_key, inference, *[, ...])

Impact modeling interface: fit, sample, predict, and estimate effects.

Attributes#

ImpactModel.inference

The underlying NumPyro inference object.

ImpactModel.kernel

A probabilistic model with NumPyro primitives.

ImpactModel.kernel_spec

The cached KernelSpec or None if not yet built.

ImpactModel.param_input

Parameter name in kernel for the input data.

ImpactModel.param_output

Parameter name in kernel for the output data.

ImpactModel.posterior

Posterior samples by variable name, or None if not set.

ImpactModel.rng_key

Pseudo-random number generator key.

ImpactModel.temp_dir

Temporary directory path, or None if not set.

ImpactModel.vi_result

Variational inference result, or None if not set.

Inference#

ImpactModel.train_on_batch(X, y[, rng_key])

Run a single VI step on the given batch of data.

ImpactModel.fit_on_batch(X, y, *[, ...])

Fit the impact model to the provided batch of data.

ImpactModel.fit(X[, y, num_samples, ...])

Fit the impact model to the provided data using epoch-based training.

ImpactModel.set_posterior_sample(...)

Set posterior samples for the model.

ImpactModel.is_fitted()

Check fitted status.

ImpactModel.predict_on_batch(X, *[, ...])

Predict the output based on the fitted model.

ImpactModel.predict(X, *[, intervention, ...])

Predict the output based on the fitted model.

ImpactModel.log_likelihood(X[, y, ...])

Compute the log-likelihood of the data under the given model.

Explicit Sampling#

ImpactModel.sample_prior_predictive_on_batch(X, *)

Draw samples from the prior predictive distribution.

ImpactModel.sample_prior_predictive(X, *[, ...])

Draw samples from the prior predictive distribution.

ImpactModel.sample(*[, num_samples, ...])

Draw posterior samples from a fitted model.

ImpactModel.sample_posterior_predictive_on_batch(X, *)

Draw samples from the posterior predictive distribution.

ImpactModel.sample_posterior_predictive(X, *)

Draw samples from the posterior predictive distribution.

Miscellaneous#

ImpactModel.estimate_effect([...])

Estimate the effect of an intervention.

ImpactModel.cleanup()

Clean up the temporary directory created for storing outputs.

ImpactModel.cleanup_models()

Clean up temporary directories for all ImpactModel instances.