Skip to main content

Module ml_feature_extractor

Module ml_feature_extractor 

Source
Expand description

ML preprocessing FeatureExtractor — composable feature engineering pipeline.

Provides a production-grade, composable pipeline for feature engineering including scaling, encoding, imputation, and polynomial expansion. Designed to transform a HashMap<String, FeatureValue> input into a flat Vec<f64> suitable for ML models.

§Example

use ipfrs_tensorlogic::ml_feature_extractor::{
    FeatureExtractor, FeatureSpec, FeatureTransform, FeatureValue,
};
use std::collections::HashMap;

let mut extractor = FeatureExtractor::new();
extractor.add_spec(FeatureSpec {
    name: "age".to_string(),
    transforms: vec![
        FeatureTransform::StandardScaler { mean: 30.0, std: 10.0 },
    ],
});

let mut input = HashMap::new();
input.insert("age".to_string(), FeatureValue::Float(40.0));

let result = extractor.extract(&input).expect("example: should succeed in docs");
assert_eq!(result.values.len(), 1);
// (40 - 30) / 10 = 1.0
assert!((result.values[0] - 1.0).abs() < 1e-12);

Structs§

ExtractedFeatures
The fully-expanded output of one extraction call.
FePipelineStats
Cumulative statistics for a FeatureExtractor instance.
FeatureExtractor
Composable feature engineering pipeline.
FeatureSpec
An ordered list of transforms to apply to a single named input feature.

Enums§

FeatureError
Errors produced by the feature extraction pipeline.
FeatureTransform
A single reversible or irreversible transform applied to a FeatureValue.
FeatureValue
A polymorphic feature value that flows through the transform chain.

Functions§

fit_minmax_scaler
Fit a MinMaxScaler from a slice of observed values.
fit_onehot
Fit a OneHotEncode transform from an observed set of category strings.
fit_standard_scaler
Fit a StandardScaler from a slice of observed values.