prophys.engine#
Compiled models, fitting, operational surrogates and diagnostics.
CompiledModel (from ProbabilityModel.compile() or
compile_model()) is the evaluation interface of a model: log densities,
samples, expectations, probabilities, quantiles and tail risk of any
attribute. Around it:
fitting:
calibrate(),finetune(),fit_distribution(),negative_log_likelihood(), and design optimization withoptimize()fit checks:
finite_difference_check(),check_identifiability()operational surrogates:
amortize()andbreak_even()Monte Carlo error:
assess(), the*_errorhelpers,required_samples()andconfidence_interval()parameter uncertainty:
parameter_uncertainty(),laplace_covariance(),propagate(),profile_likelihood(),sample_parameters()sensitivity:
local_sensitivity(),sobol_sensitivity()model scoring:
information_criteria(),waic(),loo(),pointwise_log_likelihood(),compare(),calibration(),crps(),posterior_predictive_check(),report_card()
The diagnostic result classes are frozen dataclasses deriving from
Report, with a readable str() and a JSON ready to_dict().
Classes
A probability model compiled into an evaluation interface that works with jax.jit and jax.grad. |
|
Result of |
|
Result of a design optimization with |
|
A trained surrogate of a whole model's predictive distribution, with guarded fallback. |
|
Answers to a batch of queries from |
|
Gate values per row of a batch of queries, from |
|
Training and acceptance record of an |
|
Whether amortizing a model pays off, from measured or estimated costs. |
|
Base class of every diagnostic result in |
|
A Monte Carlo estimate of a mean, probability or quantile with its sampling error. |
|
Value at Risk and Conditional Value at Risk estimates with the CVaR's standard error. |
|
Standard errors, covariance and correlations of fitted parameters (Laplace approximation). |
|
Delta method standard errors of a quantity derived from the fitted parameters. |
|
Profile log likelihood of one parameter with its likelihood ratio interval. |
|
Derivatives and elasticities of one model statistic with respect to the parameters. |
|
First order and total order Sobol indices of an attribute over its uncertain inputs. |
|
Information criteria (AIC, AICc and BIC) of a fitted model, from |
|
Expected log predictive density estimated by WAIC or PSIS LOO, from |
|
Ranking of models by a predictive score, with each model's difference from the best. |
|
Probability integral transform (PIT) calibration of a predictive distribution. |
|
Continuous ranked probability score (CRPS) of a predictive distribution, from |
|
Posterior predictive check of one summary statistic, from |
Functions
Compile a probability model. |
|
Fit the parameters of a compiled model to observations of one attribute. |
|
Jointly fit a compiled model against observations of several attributes. |
|
Fit the Param leaves of a standalone distribution to data by maximum likelihood. |
|
Minimize a scalar objective over design parameters, with inequality constraints. |
|
|
Train an operational surrogate of one attribute's predictive distribution over an envelope. |
|
Estimate whether amortizing an attribute pays off, before training anything. |
Compare the automatic gradient of fn against central finite differences. |
|
Check whether a loss history is still improving at the end of a fit. |
|
Confidence interval |
|
Estimate a statistic of a model attribute together with its Monte Carlo error. |
|
Sample mean of draws with its batch means standard error. |
|
Sample q quantile of draws with its Maritz and Jarrett standard error. |
|
Upper tail CVaR of draws at level alpha, with its influence function error. |
|
Number of draws needed to reach a target relative error, extrapolated from an estimate. |
|
Build the negative log likelihood that |
|
Laplace (observed information) covariance of parameters at the minimum of a loss. |
|
Compute standard errors and correlations of a fit's parameters (Laplace approximation). |
|
Propagate parameter uncertainty into a derived quantity by the delta method. |
|
Profile the log likelihood in one parameter and read off its likelihood ratio interval. |
|
Compute derivatives and elasticities of a model statistic with respect to its parameters. |
|
Compute variance based (Sobol) sensitivity indices of an attribute to its uncertain inputs. |
|
Draw parameter vectors from the Laplace (Gaussian) approximation of the fit. |
|
Log likelihood of every observation under every parameter draw. |
|
Compute AIC, AICc and BIC for a fit of a compiled model to observations. |
|
Score predictive accuracy with the Widely Applicable Information Criterion (WAIC). |
|
Estimate leave one out predictive accuracy by Pareto smoothed importance sampling (PSIS LOO). |
|
Rank models by predictive score, with the standard error of each difference. |
|
Test whether the predictive distribution is calibrated against observations (PIT). |
|
Score the predictive distribution with the continuous ranked probability score (CRPS). |
|
Compare a summary statistic of the data against replicate datasets simulated from the model. |
|
Run every applicable goodness of fit diagnostic for one fitted attribute. |
Constants and objects
Built-in immutable sequence. |