TablePreprocessor

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

Bases: Protocol

Learn and apply a feature-table transformation.

sklearn transformer semantics: fit learns any statistics the transformation needs (means, min/max, kept columns, …) and returns self; transform applies them. Components are cohort-level at fit time (statistics cross subject boundaries) and row-parallel at transform time, which is exactly what a train/predict split needs.

property spec: Spec

Return the algorithm specification.

fit(table: FeatureTable) → TablePreprocessor[source]

Learn the transformation state from a table.

Parameters:

table – Table whose feature columns provide the fit statistics.

Returns:

self, fitted.

transform(table: FeatureTable) → FeatureTable[source]

Apply the fitted transformation.

Parameters:

table – Table to transform; must carry the feature columns seen at fit time.

Returns:

A new table with transformed feature columns and unchanged identifier/outcome columns.

__init__(*args, **kwargs)