PipelineRegressor
Module: strata.base • Kind: struct • Traits: Copyable, Movable, Regressor
Source: strata/base/pipeline.mojo
struct PipelineRegressor[T: Transformer, R: Regressor, target_dtype: DType = DType.float64](Copyable, Movable, Regressor)from strata.base import PipelineRegressorSequentially applies a transformer pipeline before fitting a regressor.
Parameters (Compile-Time)
Section titled “Parameters (Compile-Time)”| Parameter | Description |
|---|---|
T |
Type of the feature transformer step. |
R |
Type of the regressor step. |
target_dtype |
Data type of target values. Default DType.float64. |
Attributes
Section titled “Attributes”| Attribute | Description |
|---|---|
transformer |
Transformer step instance. |
regressor |
Regressor step instance. |
Methods Overview
Section titled “Methods Overview”| Method | Description |
|---|---|
PipelineRegressor.fit() |
Fits the transformer on X, then fits the regressor on transformed features. |
PipelineRegressor.predict() |
Transforms input features and computes regression predictions. |
Method Details
Section titled “Method Details”PipelineRegressor.fit()
Section titled “PipelineRegressor.fit()”def fit[feat_dtype: DType, in_target_dtype: DType]( mut self, X: Matrix[feat_dtype], y: List[Scalar[in_target_dtype]],)
def fit[feat_dtype: DType, target_dtype: DType]( mut self, dataset: Dataset[feat_dtype, target_dtype],)Overload Note: This method accepts either standard
(X, y)inputs or a unifieddataset: Datasetcontainer.
Fits the transformer on X, then fits the regressor on transformed features.
| Parameter | Type | Description |
|---|---|---|
X |
Matrix[feat_dtype] |
Feature matrix of shape . |
y |
List[Scalar[in_target_dtype]] |
Target values of length . |
dataset |
Dataset[feat_dtype, target_dtype] |
Dataset container holding feature matrix and targets. (Can be provided alternatively in place of (X, y)) |
PipelineRegressor.predict()
Section titled “PipelineRegressor.predict()”def predict[feat_dtype: DType]( self, X: Matrix[feat_dtype],) -> List[Scalar[feat_dtype]]
def predict[feat_dtype: DType, target_dtype: DType]( self, dataset: Dataset[feat_dtype, target_dtype],) -> List[Scalar[feat_dtype]]Overload Note: This method accepts either standard
(X, y)inputs or a unifieddataset: Datasetcontainer.
Transforms input features and computes regression predictions.
| Parameter | Type | Description |
|---|---|---|
X |
Matrix[feat_dtype] |
Feature matrix of shape . |
dataset |
Dataset[feat_dtype, target_dtype] |
Dataset container holding feature matrix and targets. (Can be provided alternatively in place of (X, y)) |
Returns: List[Scalar[feat_dtype]] — List[Scalar[feat_dtype]]: Predicted target values.