CrossValidationResult#

class superglm.CrossValidationResult(
fold_scores: DataFrame,
mean_scores: dict[str, float],
pooled_scores: dict[str, float],
std_scores: dict[str, float],
fold_indices: list[tuple[NDArray, NDArray]] | None = None,
curve_similarity: dict[str, Any] | None = None,
oof_predictions: NDArray | None = None,
estimators: list | None = None,
)#

Bases: object

Structured result from superglm.cross_validate().

Attributes:
fold_scoresDataFrame

One row per fold with columns: fold, n_train, n_test, fit_time_s, score_time_s, converged, n_iter, effective_df, plus one column per requested metric.

mean_scoresdict

Equal-weight mean of each per-fold metric across folds. Built-in deviance and negative log-likelihood are normalized within each fold by the likelihood size the model’s declared weight_semantics implies: sum(sample_weight) under "frequency", the count of positive-weight validation rows under "prior".

pooled_scoresdict

Supported overall pooled metrics, computed as ratio-of-sums rather than mean-of-fold-ratios, with the same denominator.

std_scoresdict

Standard deviation of each metric across folds.

fold_indiceslist[tuple[ndarray, ndarray]] or None

Per-fold (train_idx, test_idx) pairs from the CV splitter.

curve_similaritydict or None

Fold-by-fold term similarity diagnostics for comparable main effects.

oof_predictionsndarray or None

Out-of-fold predictions (response scale), same length as y. None unless return_oof=True.

estimatorslist or None

Fitted model per fold. None unless return_estimators=True.

plot_terms_by_fold(
X: object,
*,
sample_weight: NDArray | None = None,
terms: str | list[str] | None = None,
engine: str = 'plotly',
**kwargs,
)#

Plot fold-specific main effects using the shared comparison engine.