Classifier

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 Classifier(*args, **kwargs)[source]

Bases: Protocol

Outcome model over feature tables.

Named Classifier (not Model) so it can never be confused with HabitatModel, the habitat-definition artefact. The feature column set is captured at fit time; predict validates it, catching silent schema drift between training and prediction tables.

property spec: Spec

Return the algorithm specification.

fit(table: FeatureTable) → Classifier[source]

Train on a table with an outcome column.

Parameters:

table – Training table with feature columns and a binary or categorical outcome column.

Returns:

self, fitted.

predict(table: FeatureTable) → Series[source]

Predict class labels for a table’s rows.

Parameters:

table – Table carrying the feature columns seen at fit time.

Returns:

Predicted labels indexed by the table’s identifier columns.

predict_proba(table: FeatureTable) → DataFrame[source]

Predict class probabilities for a table’s rows.

Parameters:

table – Table carrying the feature columns seen at fit time.

Returns:

Probability frame indexed by the identifier columns, one column per class.

__init__(*args, **kwargs)