PipelineData¶
h2ml.core.feature_store.PipelineData
dataclass
¶
Container that pairs a numpy array with its feature names.
Attributes:
| Name | Type | Description |
|---|---|---|
X |
ndarray
|
Feature matrix as numpy array (n_samples, n_features). |
feature_names |
list[str]
|
Ordered list of feature names matching X columns. |
y |
ndarray
|
Target array (n_samples,). |
y_true |
Optional[ndarray]
|
Original-scale y when a y-transform was applied (optional). |
y_transform |
Optional[str]
|
Name of the y-transform applied, e.g. "log" or "sqrt" (optional). |
coords |
Optional[ndarray]
|
Spatial coordinates (n_samples, 2) — lat/lon or projected x/y (optional). |
times |
Optional[ndarray]
|
Sample dates as YYYY-MM-DD strings or numpy datetime64[D] (n_samples,). Used to build temporally-aware conformal calibration in LocalConformalCalibration. Optional — pipeline runs without it. |
Example
store = PipelineData(X=X_arr, feature_names=df.columns.tolist(), y=y_arr) store.to_frame() # recover DataFrame locally when needed store.n_features # 10
n_features
property
¶
Number of feature columns in X.
n_samples
property
¶
Number of rows (observations) in X.
from_frame(df, y, y_true=None, y_transform=None, coords=None, times=None)
classmethod
¶
Build a PipelineData directly from a DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Feature DataFrame; columns become feature_names. |
required |
y
|
ndarray
|
Target array (n_samples,). |
required |
y_true
|
Optional[ndarray]
|
Original-scale y before any transform (optional). |
None
|
y_transform
|
Optional[str]
|
Name of the y-transform applied (optional). |
None
|
coords
|
Optional[ndarray]
|
Spatial coordinates (n_samples, 2) — lat/lon or x/y (optional). |
None
|
times
|
Optional[ndarray]
|
Sample dates as YYYY-MM-DD strings or datetime64[D] (optional). |
None
|
select(features)
¶
Return a new PipelineData with only the selected features.
Order follows the input list. coords and times are propagated unchanged.
to_frame()
¶
Recover a DataFrame with correct column names.