ModelResult

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

class ModelResult(pipeline: TablePipeline, train_metrics: Mapping[str, float], manifest: RunManifest, test_metrics: Mapping[str, float] | None = None, train_row_ids: Tuple[str, ...] = (), test_row_ids: Tuple[str, ...] = ())[source]

Bases: object

Outcome of train_model(), entirely in memory.

pipeline

The fitted pipeline – the publishable artefact, persisted with TablePipeline.save() when the caller wants a file. Under a hold-out split it is fitted on the TRAINING rows only, mirroring the v0.1 *_final_pipeline.pkl semantics.

Type:

habit.pipeline.TablePipeline

train_metrics

Metric panel scored on the training rows. Named train_ so nobody mistakes an in-sample number for a generalisation estimate.

Type:

Mapping[str, float]

manifest

Record of what ran: the effective spec payload, the provenance chain, and every row’s outcome.

Type:

habit.contracts.manifest.RunManifest

test_metrics

Metric panel scored on the held-out rows, or None when the recipe ran without a hold-out split.

Type:

Mapping[str, float] | None

train_row_ids

Row ids of the training side of the hold-out split, in split order; empty when no split ran. Recording the ids makes the split itself reproducible from the result object alone.

Type:

Tuple[str, …]

test_row_ids

Row ids of the held-out side; empty when no split ran.

Type:

Tuple[str, …]

__init__(pipeline: TablePipeline, train_metrics: Mapping[str, float], manifest: RunManifest, test_metrics: Mapping[str, float] | None = None, train_row_ids: Tuple[str, ...] = (), test_row_ids: Tuple[str, ...] = ()) → None