pub struct FeatureExtractor { /* private fields */ }Expand description
Composable feature engineering pipeline.
Holds an ordered list of FeatureSpecs. Each spec names one input
feature and chains transforms that convert it to one or more f64 outputs.
§Thread-safety
FeatureExtractor is not Send/Sync by default because of its internal
AtomicU64 counter — if you need concurrent access, wrap it in a Mutex.
Implementations§
Source§impl FeatureExtractor
impl FeatureExtractor
Sourcepub fn add_spec(&mut self, spec: FeatureSpec) -> &mut Self
pub fn add_spec(&mut self, spec: FeatureSpec) -> &mut Self
Append a spec to the pipeline (builder-style).
Sourcepub fn output_dim(&self) -> usize
pub fn output_dim(&self) -> usize
Compute the total output dimension from spec metadata alone.
For OneHotEncode { categories } the contribution is
categories.len(). For PolynomialFeatures { degree } it is
degree as usize. All other specs contribute 1.
Sourcepub fn feature_names(&self) -> Vec<String>
pub fn feature_names(&self) -> Vec<String>
List all output feature names (expanded for OneHot and Polynomial).
Sourcepub fn extract(
&self,
input: &HashMap<String, FeatureValue>,
) -> Result<ExtractedFeatures, FeatureError>
pub fn extract( &self, input: &HashMap<String, FeatureValue>, ) -> Result<ExtractedFeatures, FeatureError>
Extract features from a single input map.
Returns an error if a required feature is missing (no imputer configured) or a type mismatch prevents a transform from running.
Sourcepub fn extract_batch(
&self,
inputs: &[HashMap<String, FeatureValue>],
) -> Result<Vec<ExtractedFeatures>, FeatureError>
pub fn extract_batch( &self, inputs: &[HashMap<String, FeatureValue>], ) -> Result<Vec<ExtractedFeatures>, FeatureError>
Extract features from a batch of input maps.
Returns Err(FeatureError::EmptyInput) when inputs is empty.
Sourcepub fn stats(&self) -> FePipelineStats
pub fn stats(&self) -> FePipelineStats
Return a snapshot of accumulated statistics.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for FeatureExtractor
impl RefUnwindSafe for FeatureExtractor
impl Send for FeatureExtractor
impl Sync for FeatureExtractor
impl Unpin for FeatureExtractor
impl UnsafeUnpin for FeatureExtractor
impl UnwindSafe for FeatureExtractor
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more