magli.wood.GAMCore

class magli.wood.GAMCore(formula: str, method: str = 'REML', gamma: float = 1.0, fit_intercept: bool = True, spline_order: int = 3)[source]

Multi-term Generalized Additive Model with formula interface (Wood backend).

formula: str = ''
fit_intercept: bool = True
coef_: ndarray | None = None
statistics_: Dict[str, Any] | None = None
fit(x: ArrayLike, y: ArrayLike, weights: ArrayLike | None = None) → GAMCore[source]

Fit multi-term GAM model using REML or GCV criteria.

gridsearch(x: ArrayLike, y: ArrayLike, n_splines_grids: Any | None = None, gamma: float = 1.0, n_splines: Any | None = None, search_terms: Any | None = None, weights: ArrayLike | None = None, **kwargs: Any) → GAMCore[source]

Search over candidate basis dimensions k for smooth terms via GCV.

summary() → str[source]

Formatted summary table for the fitted Wood GAM.

plot_decomposition(x: ArrayLike, y: ArrayLike, n_grid: int = 200, figsize: Tuple[int, int] | None = None, feature_names: List[str] | None = None) → Tuple[source]

Plot partial dependence for all terms in the GAM.

aic() → float

Akaike Information Criterion (AIC).

bic() → float

Bayesian Information Criterion (BIC).

confidence_intervals(x: ArrayLike, width: float = 0.95) → ndarray

Compute confidence intervals for the linear predictor.

deviance_explained() → float

Fraction of null deviance explained (pseudo R-squared).

property is_fitted: bool
loglikelihood() → float

Gaussian log-likelihood of the fitted model.

property n_terms: int
partial_dependence(term_idx: int, x: ArrayLike) → ndarray

Evaluate the partial contribution of term term_idx.

plot_diagnostics(x: ArrayLike, y: ArrayLike, figsize: Tuple[int, int] | None = None) → Tuple[Any, ndarray]

Diagnostic plots for model validation.

predict(x: ArrayLike) → ndarray

Predict target values for feature data x.

prediction_intervals(x: ArrayLike, width: float = 0.95) → ndarray

Compute prediction intervals for new observations.