Expand description
The model interface and its life cycle, shared by every engine (GLM,
GAM, neural networks, boosting adapters, Bayesian models). See
docs/design/models.md.
FamilyandLink: exponential dispersion families and link functions, the likelihoods and losses engines share;Terms,CodingandDesign: model terms, factor coding learned on training data, and the design matrix with offset and weights;ModelandFitted: fit, predict, and joint predictive distributions;metrics: deviance, Gini, lift, CRPS, coverage;resample: k-fold, grouped and time-ordered splits, cross-validation and grid search;artifact: the envelope of saved models (format, version, provenance) and its JSON helpers;simulate: predictive distributions from fitted means, for engines that give only a mean per row (the boosting adapters).
This crate has no heavy dependencies; engines live in their own crates.
Re-exports§
pub use design::Coding;pub use design::Column;pub use design::Design;pub use design::Frame;pub use design::Term;pub use design::Terms;pub use family::Family;pub use link::Link;pub use model::Fitted;pub use model::Model;
Modules§
- artifact
- The envelope every model artifact shares (
docs/design/models.md, “Model artifacts”): the format check and version rule, provenance, and the JSON helpers the engines’ readers and writers use. Non-finite numbers are written as the strings"NaN","inf"and"-inf"; with the workspace’sfloat_roundtripevery other number round-trips bit for bit. - compare
- One table of out-of-sample scores across models of any kind.
- design
- Design matrices: turning named columns into the numeric matrix a model fits, the same way on training data and on new data.
- encode
- Out-of-fold target encoding of a high-cardinality factor with credibility (Holmes and Casotto, CAS Monograph 16, chapter 6).
- family
- Exponential dispersion families: what a GLM, a neural network’s loss, a booster’s objective and a Bayesian likelihood all share.
- link
- Link functions:
η = g(μ)between the mean and the linear predictor. - metrics
- Scores for fitted models: deviance-based, ranking (Gini, lift), calibration (actual vs expected), and probabilistic (CRPS, coverage, log score, PIT).
- model
- The interface every model implements, whatever its engine.
- monitor
- Monitoring a stored model on new periods: actual against expected.
- resample
- Resampling: train/test splits, cross-validation, and grid and random search.
- simulate
- Predictive distributions from fitted means, for engines that give a mean per row and nothing else (gradient boosting through its Python or R package, an imported network): the family adds the process noise, and several mean vectors (bootstrap refits) add the parameter uncertainty.
- stack
- Model weights for blending from pointwise out-of-sample log predictive densities: stacking and pseudo-BMA (Yao, Vehtari, Simpson and Gelman, 2018, “Using stacking to average Bayesian predictive distributions”).