Expand description
§Model Estimation via Penalized Likelihood and REML
This module orchestrates the core model fitting procedure for Generalized Additive Models (GAMs). It determines optimal smoothing parameters directly from the data, moving beyond simple hyperparameter-driven models. This is achieved through a nested optimization scheme, a standard approach for this class of models:
-
Outer Loop (planner-selected optimizer): Optimizes the log-smoothing parameters (
rho) by maximizing a marginal likelihood criterion. For non-Gaussian models (e.g., Logit), this is the Laplace Approximate Marginal Likelihood (LAML). The concrete solver is chosen centrally byouter_strategyfrom the derivative capability of the model path: ARC with analytic Hessian when available, BFGS for gradient-only problems, and EFS / hybrid EFS when the hyperparameter geometry admits those fixed-point updates. -
Inner Loop (P-IRLS): For each set of trial smoothing parameters from the outer loop, this routine finds the corresponding model coefficients (
beta) by running a Penalized Iteratively Reweighted Least Squares (P-IRLS) algorithm to convergence.
This two-tiered structure allows the model to learn the appropriate complexity for each smooth term directly from the data.
Re-exports§
pub use crate::inference::predict::CoefficientUncertaintyResult;pub use crate::inference::predict::InferenceCovarianceMode;pub use crate::inference::predict::MeanIntervalMethod;pub use crate::inference::predict::PredictInput;pub use crate::inference::predict::PredictPosteriorMeanResult;pub use crate::inference::predict::PredictResult;pub use crate::inference::predict::PredictUncertaintyOptions;pub use crate::inference::predict::PredictUncertaintyResult;pub use crate::inference::predict::PredictableModel;pub use crate::inference::predict::coefficient_uncertainty;pub use crate::inference::predict::coefficient_uncertaintywith_mode;pub use crate::inference::predict::enrich_posterior_mean_bounds;pub use crate::inference::predict::predict_gam;pub use crate::inference::predict::predict_gam_posterior_mean;pub use crate::inference::predict::predict_gam_posterior_meanwith_backend;pub use crate::inference::predict::predict_gam_posterior_meanwith_fit;pub use crate::inference::predict::predict_gamwith_uncertainty;
Structs§
- Adaptive
Regularization Options - Continuous
Smoothness Order - External
Optim Options - External
Optim Result - FitArtifacts
- Post-fit artifacts needed by downstream diagnostics/inference without re-running PIRLS.
- FitGeometry
- Working-set geometry at convergence needed by ALO and other post-fit diagnostics. Only populated when the inner solver provides the data.
- FitInference
- FitOptions
- Fitted
Block - Inference quantities for one coefficient block.
- Model
Summary - Parametric
Term Summary - Smooth
Term Summary - Unified
FitResult - Unified fit result for all model types (standard GAM, GAMLSS, survival).
- Unified
FitResult Parts
Enums§
- Block
Role - Role of a coefficient block within a multi-parameter model.
- Continuous
Smoothness Order Status - Estimation
Error - A comprehensive error type for the model estimation process.
- Fitted
Link State - Penalty
Spec - A penalty specification for the public estimate API.
Functions§
- compute_
continuous_ smoothness_ order - ensure_
finite_ scalar - Public wrapper returning
Stringerrors for use outside the estimation module. - evaluate_
externalcost_ andridge - Evaluate the external cost and report the stabilization ridge used. This is a diagnostic helper for tests that need to detect ridge jitter.
- evaluate_
externalgradient - Evaluate the analytic gradient of the external REML objective.
- fit_gam
- External-design GAM entrypoint for GLM-style families supported by
optimize_external_design. Survival families such asRoystonParmaruse survival-specific training APIs. - fit_
gamwith_ heuristic_ lambdas - Canonical engine entrypoint for external designs on supported GLM-style
families.
Likelihood dispatch is determined by
familytogether with external-link options inopts; survival families use survival-specific training APIs. - optimize_
external_ design - Optimize smoothing parameters for an external design using the same REML/LAML machinery.
Contract: likelihood dispatch is determined by
opts.family. - optimize_
external_ designwith_ heuristic_ lambdas - Same as
optimize_external_design, but allows heuristic λ warm-start seeds for the outer smoothing search. - saved_
latent_ cloglog_ state_ from_ fit - saved_
mixture_ state_ from_ fit - saved_
sas_ state_ from_ fit - validate_
all_ finite - Public wrapper returning
Stringerrors for use outside the estimation module. - validate_
dense_ hessian_ export - Validate the structural integrity of an exported penalized Hessian.
- validate_
explicit_ dense_ hessian_ for_ whitening - Validate that a saved penalized Hessian is an explicit dense precision matrix suitable for HMC/NUTS whitening.