Skip to main content

Crate gamlss_formula

Crate gamlss_formula 

Source
Expand description

Experimental optional typed formula/builder layer for compiling user model specifications into typed gamlss-core models.

gamlss-formula is a boundary layer: it reads user data through DataView, fits term metadata once, materializes predictor designs, and returns a BuiltModel artifact. Optimizers, fitting loops, diagnostics, dataframe ownership, and string formula parsing are intentionally outside this crate.

This crate is not the primary API of the project. The current primary path is the lower-level typed API in gamlss-core, gamlss-family, gamlss-spline, and gamlss-transform. gamlss-formula is an experimental convenience layer for curated high-level workflows and is not expected to cover every distribution, link, or parameterization available in the lower-level crates.

§Example

use gamlss_core::Objective;
use gamlss_formula::prelude::*;

let data = TestData {
    y: vec![0.0, 1.0, 2.0],
    x: vec![0.0, 1.0, 2.0],
};

let y = col::<f64>("y");
let x = col::<f64>("x");
let mut built = normal()
    .response(y)
    .mu(intercept() + linear(x))
    .sigma(intercept())
    .build(&data)?;

let theta = vec![0.0, 0.5, -0.2];
assert!(built.model_mut().value(&theta)?.is_finite());

Modules§

prelude
Common imports for the typed formula layer.

Structs§

BetaSpec
Typed beta model specification.
BuiltModel
Compiled formula artifact.
Category
Marker type for categorical columns.
Col
Typed reference to a named input column.
CyclicPSplineTerm
Cyclic P-spline term options.
FormulaPenalty
Formula-local segment penalty representation.
FormulaPredictorBlock
Formula predictor composed from a dense linear design, optional row offsets, and nonlinear monotone spline segments.
FourierTerm
Fourier term options.
GammaSpec
Typed gamma model specification.
InverseGaussianSpec
Typed inverse Gaussian model specification.
LogNormalSpec
Typed log-normal model specification.
ModelSchema
Schema for a built formula model.
ModelSpec
Entry point namespace for typed model specifications.
MonotoneTerm
Hard-monotone I-spline term options.
NormalSpec
Typed normal model specification.
PSplineTerm
Open-uniform P-spline term options.
ParameterTerms
Metadata for all terms belonging to one distribution parameter.
PredictionDesign
Reusable prediction design compiled from fitted term metadata.
ResponseSchema
Response metadata.
TensorPSplineTerm
Tensor-product P-spline term options.
TermExpr
Pre-data term expression for one parameter predictor.
WeibullSpec
Typed Weibull model specification.

Enums§

BoolCol
Boolean column storage returned by DataView.
CatCol
Categorical column storage returned by DataView.
FittedTerm
Fitted term metadata reusable for prediction.
FormulaError
Errors returned by the typed formula/builder layer.
NumericCol
Numeric column storage returned by DataView.
NumericResponse
Response storage used by compiled formula models.
TermSpec
Pre-data term specification.

Traits§

DataView
Read-only data access contract for the formula layer.

Functions§

beta
Creates a beta model spec.
col
Creates a typed column reference.
cyclic_pspline
Creates a cyclic P-spline term expression with default options.
factor
Creates a categorical factor term expression.
fourier
Creates a Fourier term expression with default options.
gamma
Creates a gamma model spec.
indicator
Creates a boolean indicator term expression.
interaction
Creates a numeric product interaction term expression.
intercept
Creates an intercept term expression.
inverse_gaussian
Creates an inverse Gaussian model spec.
linear
Creates a linear term expression.
log_normal
Creates a log-normal model spec.
monotone
Creates a hard-monotone I-spline term expression with default options.
no_intercept
Creates an explicit empty term expression without an intercept.
normal
Creates a normal model spec.
offset
Creates a numeric offset term expression.
pspline
Creates an open-uniform P-spline term expression with default options.
tensor_pspline
Creates a tensor-product P-spline term expression with default options.
weibull
Creates a Weibull model spec.

Type Aliases§

BetaBlocks
Blocks for a beta formula model.
BuiltBeta
Built beta formula model.
BuiltGamma
Built gamma formula model.
BuiltInverseGaussian
Built inverse Gaussian formula model.
BuiltLogNormal
Built log-normal formula model.
BuiltNormal
Built normal formula model.
BuiltWeibull
Built Weibull formula model.
CompiledBeta
Compiled beta formula model.
CompiledGamma
Compiled gamma formula model.
CompiledInverseGaussian
Compiled inverse Gaussian formula model.
CompiledLogNormal
Compiled log-normal formula model.
CompiledNormal
Compiled normal formula model.
CompiledWeibull
Compiled Weibull formula model.
FormulaBlock
Formula block type used by supported family specs.
GammaBlocks
Blocks for a gamma formula model.
InverseGaussianBlocks
Blocks for an inverse Gaussian formula model.
LogNormalBlocks
Blocks for a log-normal formula model.
NormalBlocks
Blocks for a normal formula model.
WeibullBlocks
Blocks for a Weibull formula model.