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§
- Extracted
Features - The fully-expanded output of one extraction call.
- FePipeline
Stats - Cumulative statistics for a
FeatureExtractorinstance. - Feature
Extractor - Composable feature engineering pipeline.
- Feature
Spec - An ordered list of transforms to apply to a single named input feature.
Enums§
- Feature
Error - Errors produced by the feature extraction pipeline.
- Feature
Transform - A single reversible or irreversible transform applied to a
FeatureValue. - Feature
Value - A polymorphic feature value that flows through the transform chain.
Functions§
- fit_
minmax_ scaler - Fit a
MinMaxScalerfrom a slice of observed values. - fit_
onehot - Fit a
OneHotEncodetransform from an observed set of category strings. - fit_
standard_ scaler - Fit a
StandardScalerfrom a slice of observed values.