spectrochempy.CrossValidationResultο
- class CrossValidationResult[source]ο
Structured result returned by
cross_validate.This frozen record owns isolated copies of its dataset inputs, fold positions, configuration snapshots, and tracking containers. Its
NDDatasetmembers remain mutable, so the result is not deeply immutable. It is not persistent and does not provide replay or automatic provenance. Instances are created only bycross_validate; direct construction is not supported.- estimator[source]ο
Non-executable estimator configuration snapshot. It exposes
class_name,parameters, and, for a Pipeline, orderedsteps.- Type:
- x_sample_axis, y_sample_axis
Original observation-axis positions in X and y.
- Type:
- observation_coordinate[source]ο
Isolated observation coordinate when one is available.
- Type:
Coord or None
- observed, oof_predictions, residuals
Isolated target datasets in the original y geometry and units.
- Type:
- global_metrics[source]ο
Requested global metrics in caller order. Prefer
metricfor lookup by name.- Type:
tuple of CrossValidationMetric
- folds[source]ο
Fold records in splitter order. Each record exposes
fold_index, read-onlytrain_positionsandvalidation_positions,n_valid, andCrossValidationFoldResult.metric.- Type:
tuple of CrossValidationFoldResult
- undefined_metrics[source]ο
Explicit records exposing metric scope, target, reason, and optional fold index whenever a requested metric is undefined.
- Type:
- fold_estimators[source]ο
Independent fitted fold estimators only when requested. Retaining them can substantially increase memory use because each estimator is copied.
- Type:
tuple or None
- operation[source]ο
Minimal non-executable operation description. It is not provenance or a replay specification.
- Type:
See also
cross_validateEvaluate a fixed supervised regression configuration.
Examples
>>> values = np.arange(24.0).reshape(8, 3) >>> X = scp.NDDataset(values, dims=["y", "x"]) >>> y = scp.NDDataset((1.0 + values[:, 0])[:, None], dims=["y", "t"]) >>> model = scp.PLSRegression(n_components=1, scale=False) >>> result = scp.cross_validate(model, X, y, cv=4) >>> isinstance(result, scp.CrossValidationResult) True
Methods Summary
metric(name)Return a requested global metric by its public name.
Methods Documentation
- metric(name)[source]ο
Return a requested global metric by its public name.
- Parameters:
name ({βrmsecvβ, βr2β, βbiasβ, βmaeβ}) β Metric selected in the original
cross_validatecall.- Returns:
CrossValidationMetric β Frozen record containing
name, anNDDatasetin target geometry undervalues, per-target booleandefinedflags, and matching reason codes underreasons. RMSECV, bias, and MAE carry target units; RΒ² is unitless.- Raises:
KeyError β If name was not requested.
Examples using spectrochempy.CrossValidationResult