predict#
- SuperGLM.predict( ) NDArray#
Predict the response mean for new data.
- Parameters:
- Xpandas or eager Polars DataFrame
Eager input features with the same columns used during fitting.
- offsetNDArray or None
Optional offset added to the linear predictor before applying the inverse link.
- random_effects{“conditional”, “population”}
Whether to include fitted random-effect and factor-smooth deviations. Population prediction sets all such contributions to zero, except that a
basis="sz"FactorSmooth with levels its data identify only in part, or levels whose line separates the response, contributes its population curve’s offset (see “SZ levels the data cannot identify” in the interactions guide).
- Returns:
- NDArray
Predicted mean on the response scale (inverse-link of eta).
- Warns:
- UserWarning
When a row has no mean, it predicts NaN and every other row is unaffected: the warning counts those rows and names the first. Under the
"inverse"or"inverse_squared"link or aPowerLinkof negative power, a row has a mean only at0 < eta < inf: not ateta <= 0, nor where the predictor overflows (covariate values or offsets too large for float64). A custom link declares such a domain aseta_domain(links.declared_eta_domain). Those links are fitted on their positive branch, so this holds for a Gaussian too, whose negative reciprocal the fit never reaches. Every other link is unchanged. The fit keeps every row it uses inside on its own design (the binned one, fordiscrete=True), but a new combination of covariate values or offsets can cross, and so can the exact design on the training rows of a coarsely binned fit.- NonEstimablePredictionWarning
When a row combines covariate values neither the training data nor the penalty determine: its design row leans on a direction of the training design’s null space that no penalty curves, past R’s
predict.lmtolerance (1e-6of the row’s size;model.estimability_ops). The prediction is returned unchanged; the warning’srowsnames those rows. A fit with no such direction never gives it. As inpredict.lm, a row the fit’s rank decision treats as determined only up to its cut (a near alias) can warn, a training row included. Only a dense, unbinned fit is tested: a binned fit, one with aFactorSmoothterm, a structured fit, a saved model without both of the fit’s rank records, and a fit whose columns sit too far from zero for float64 to resolve the test are silent.