cleverly.learners.SuperLearnerDiagnostics#

class cleverly.learners.SuperLearnerDiagnostics(names: tuple[str, ...], cv_risk: ndarray[tuple[Any, ...], dtype[float64]], weights: ndarray[tuple[Any, ...], dtype[float64]], best: str, ensemble_cv_risk: float, loss: str, failed: tuple[str, ...] = ())[source]#

What the ensemble learned, for reporting and validation.

Parameters:
namestuple of str

Candidate names, in the order the weights refer to.

cv_riskndarray

Cross-validated risk per candidate (mean squared error for a regression task, negative log-likelihood for a classification task).

weightsndarray

Convex ensemble weights.

beststr

Name of the lowest-risk candidate – what the discrete Super Learner would have selected.

ensemble_cv_riskfloat

Cross-validated risk of the weighted ensemble itself. Comparing it with min(cv_risk) shows whether stacking bought anything.

lossstr

Name of the loss the risks above were scored under.

failedtuple of str

Candidates dropped because fitting raised.

Methods#

SuperLearnerDiagnostics.to_dict() → dict[str, Any][source]#

Return a JSON-compatible representation.

Returns:
dict of str to Any

Candidate names, cross-validated risks, and weights, as JSON-compatible lists.

Attributes#

SuperLearnerDiagnostics.failed: tuple[str, ...] = ()#
SuperLearnerDiagnostics.names: tuple[str, ...]#
SuperLearnerDiagnostics.cv_risk: ndarray[tuple[Any, ...], dtype[float64]]#
SuperLearnerDiagnostics.weights: ndarray[tuple[Any, ...], dtype[float64]]#
SuperLearnerDiagnostics.best: str#
SuperLearnerDiagnostics.ensemble_cv_risk: float#
SuperLearnerDiagnostics.loss: str#