fit_reml#
- SuperLSS.fit_reml(
- X: object | EagerFrame,
- y: NDArray,
- sample_weight: NDArray | None = None,
- *,
- method: str = 'efs',
- max_reml_iter: int = 100,
- reml_tol: float = 1e-06,
- max_log_step: float = 5.0,
- max_lambda: float | None = None,
- initial_lambda: float | None = None,
- max_inner_iter: int = 100,
- inner_tol: float = 1e-07,
- lambdas: Mapping[str, float] | None = None,
- retain_rows: bool = True,
- acceleration: Literal['none', 'multisecant'] = 'none',
- acceleration_history: int = 5,
- acceleration_max_amplification: float = 8.0,
- practical_reml: bool = True,
- retain_history_rows: bool = False,
- practical_reml_parameter_tol: float = 0.001,
- reml_plateau_tol: float = 1e-07,
- outer: Literal['efs', 'efs+finish', 'efs+newton'] | None = None,
- phase_recorder: FitPhaseRecorder | None = None,
- truncation: tuple[object, object] | None = None,
- censored: ArrayLike | None = None,
Fit coefficients and estimate smoothing parameters jointly.
Xsupplies the declared columns andysupplies the response in the same row order.sample_weightfollows the model’sweight_semantics. Declare fixed link-scale additions withoffset=on the family predictor helpers.truncationandcensoredare as infit(). This method updates the model and returns it.outerselects the smoothing optimiser."efs"runs generalised Fellner-Schall updates alone."efs+finish"runs them to a practical plateau, then finishes with Newton steps on the LAML gradient and Hessian in log lambda, aiming for a stationary point of the LAML over the smoothing-parameter box (Wood, Pya and Saefken 2016, section 3.1)."efs+newton"hands to those Newton steps after a shorter warm-up, on any Fellner-Schall stop.smoothing_convergence_reason_andsmoothing_certified_report how a fit stopped. The defaultNoneruns"efs+finish", except where a family’s curvature jumps (TwoPieceNormalLSSandTwoPieceLogNormalLSS): Newton’s smoothness assumption fails there, so they run"efs"and the endgame is not advised.max_reml_iterbounds the smoothing iterations, Fellner-Schall and Newton together. A default finish that stalls on an exact face is not counted, so such a fit can do up to 16 further iterations of work.practical_remlstops the Fellner–Schall loop after sustained negligible objective and fitted-parameter movement. Set it toFalsewhen strict Fellner–Schall stationarity is required.Historical coefficient fits retain compact evidence by default, with row arrays kept only for the terminal fit and recent plateau checks. Set
retain_history_rows=Trueto keep every fit’setaandthetafor debugging.retain_rowsseparately controls final row diagnostics and keeps its existing default.By default, choose a data-scaled starting penalty for each term.
initial_lambda=Noneadjusts the starting strength of smoothing to the term’s units and the information in the data. Terms with several penalties get a separate start for each. These starts are clipped to the smoothing bounds. Families without expected information, fits with truncated or censored rows, and terms with unresolved numerical rank use 0.1, also clipped to those bounds.A numeric
initial_lambdasupplies a common start. Entries inlambdasoverride it, and fixed penalty policies take precedence over both. The smoothing result retains the numeric starts for replay. Stops can depend on the starting values, so vary them when comparing fits.With
max_lambda=Nonethe search keeps each smoothing parameter between1e-6and1e10times its term’s information unit (the mean expected information per row of the term’s parameter at the start, rounded to a power of two), with the upper limit never below1e10. Rescaling the response or the weights moves the optimum and the relative limits together. Families without expected information keep a unit of one. A number caps every smoothing parameter at that value, with the floor at1e-6, whatever the data’s scale. A fit whose search still pointed past a limit warns, naming the term.