Skip to main content

Module splines

Module splines 

Source
Expand description

Regression splines & polynomial regression (ISL ch 7) — flexible non-linear fits expressed as a linear model in a fixed basis, then solved by OLS (learning::regression::linear, no new solver).

A degree-d spline with interior knots k₁…k_K uses the truncated power basis [1, x, …, xᵈ, (x−k₁)ᵈ₊, …, (x−k_K)ᵈ₊]; polynomial regression is the special case with no knots. The basis columns form the design matrix; the fit is ordinary least squares over them (kernel-class DenseLinear).

Re-exports§

pub use gam::Gam;
pub use smoothing::SmoothingSpline;

Modules§

gam
Generalized Additive Model (ISL ch 7.7) — y = β₀ + Σⱼ fⱼ(xⱼ), each fⱼ a regression spline, fit by backfitting: cycle through the features, fitting each smooth term to the partial residual of all the others. Reuses super::RegressionSpline (no duplicated basis/OLS). Kernel-class DenseLinear.
smoothing
Penalized smoothing spline (ISL ch 7.5) — least squares with a roughness penalty that shrinks the wiggly (knot) part of the fit.

Structs§

RegressionSpline
A fitted regression spline (or polynomial, when knots is empty).

Functions§

polynomial_regression
Convenience: degree-degree polynomial regression (a spline with no knots).