PipelineClassifier
Module: strata.base • Kind: struct • Traits: Classifier, Copyable, Movable
Source: strata/base/pipeline.mojo
struct PipelineClassifier[T: Transformer, C: Classifier, target_dtype: DType = DType.int32](Classifier, Copyable, Movable)from strata.base import PipelineClassifierSequentially applies a transformer pipeline before fitting a classifier.
Parameters (Compile-Time)
Section titled “Parameters (Compile-Time)”| Parameter | Description |
|---|---|
T |
Type of the feature transformer step. |
C |
Type of the classifier step. |
target_dtype |
Data type of target labels. Default DType.int32. |
Attributes
Section titled “Attributes”| Attribute | Description |
|---|---|
transformer |
Transformer step instance. |
classifier |
Classifier step instance. |
Methods Overview
Section titled “Methods Overview”| Method | Description |
|---|---|
PipelineClassifier.fit() |
Fits the transformer on X, then fits the classifier on transformed features. |
PipelineClassifier.predict() |
Transforms input features and predicts discrete class labels. |
PipelineClassifier.predict_proba() |
Transforms input features and predicts class probability distributions. |
Method Details
Section titled “Method Details”PipelineClassifier.fit()
Section titled “PipelineClassifier.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 classifier on transformed features.
| Parameter | Type | Description |
|---|---|---|
X |
Matrix[feat_dtype] |
Feature matrix of shape . |
y |
List[Scalar[in_target_dtype]] |
Target class labels of length . |
dataset |
Dataset[feat_dtype, target_dtype] |
Dataset container holding feature matrix and targets. (Can be provided alternatively in place of (X, y)) |
PipelineClassifier.predict()
Section titled “PipelineClassifier.predict()”def predict[feat_dtype: DType](self, X: Matrix[feat_dtype]) -> List[Int]
def predict[feat_dtype: DType, target_dtype: DType]( self, dataset: Dataset[feat_dtype, target_dtype],) -> List[Int]Overload Note: This method accepts either standard
(X, y)inputs or a unifieddataset: Datasetcontainer.
Transforms input features and predicts discrete class labels.
| 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[Int] — List[Int]: Predicted discrete class labels.
PipelineClassifier.predict_proba()
Section titled “PipelineClassifier.predict_proba()”def predict_proba[feat_dtype: DType]( self, X: Matrix[feat_dtype],) -> Matrix[feat_dtype]
def predict_proba[feat_dtype: DType, target_dtype: DType]( self, dataset: Dataset[feat_dtype, target_dtype],) -> Matrix[feat_dtype]Overload Note: This method accepts either standard
(X, y)inputs or a unifieddataset: Datasetcontainer.
Transforms input features and predicts class probability distributions.
| 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: Matrix[feat_dtype] — Matrix[feat_dtype]: Probability distribution matrix of shape .