pub struct ParallelFeatureUnion<E> { /* private fields */ }Expand description
Parallel feature union for combining multiple extractors
Extracts features using multiple extractors in parallel and concatenates the results horizontally into a single feature matrix.
§Examples
use sklears_feature_extraction::pipelines::ParallelFeatureUnion;
use sklears_feature_extraction::text::{EmotionDetector, SentimentAnalyzer};
use sklears_feature_extraction::feature_traits::FeatureUnion;
let union = ParallelFeatureUnion::new()
.add_extractor(EmotionDetector::new(), "emotion".to_string())
.add_extractor(SentimentAnalyzer::new(), "sentiment".to_string());
let documents = vec![
"I am happy!".to_string(),
"This is sad.".to_string(),
];
let combined_features = union.extract_union(&documents).expect("valid documents produce union features");
assert_eq!(combined_features.nrows(), 2);Implementations§
Source§impl<E> ParallelFeatureUnion<E>
impl<E> ParallelFeatureUnion<E>
Sourcepub fn add_extractor(self, extractor: E, name: String) -> Self
pub fn add_extractor(self, extractor: E, name: String) -> Self
Add an extractor to the union
Sourcepub fn extractor_names(&self) -> &[String]
pub fn extractor_names(&self) -> &[String]
Get extractor names
Trait Implementations§
Source§impl<E: Clone> Clone for ParallelFeatureUnion<E>
impl<E: Clone> Clone for ParallelFeatureUnion<E>
Source§impl<E: Debug> Debug for ParallelFeatureUnion<E>
impl<E: Debug> Debug for ParallelFeatureUnion<E>
Source§impl<E> Default for ParallelFeatureUnion<E>
impl<E> Default for ParallelFeatureUnion<E>
Source§impl<E> FeatureUnion for ParallelFeatureUnion<E>
impl<E> FeatureUnion for ParallelFeatureUnion<E>
Source§fn extract_union(&self, input: &[Self::Input]) -> SklResult<Self::Output>
fn extract_union(&self, input: &[Self::Input]) -> SklResult<Self::Output>
Extract and combine features from all extractors Read more
Source§fn n_extractors(&self) -> usize
fn n_extractors(&self) -> usize
Get number of extractors in the union
Source§fn feature_splits(&self) -> Vec<usize>
fn feature_splits(&self) -> Vec<usize>
Get feature split points (cumulative feature counts)
Auto Trait Implementations§
impl<E> Freeze for ParallelFeatureUnion<E>
impl<E> RefUnwindSafe for ParallelFeatureUnion<E>where
Vec<E>: RefUnwindSafe,
impl<E> Send for ParallelFeatureUnion<E>
impl<E> Sync for ParallelFeatureUnion<E>
impl<E> Unpin for ParallelFeatureUnion<E>
impl<E> UnsafeUnpin for ParallelFeatureUnion<E>where
Vec<E>: UnsafeUnpin,
impl<E> UnwindSafe for ParallelFeatureUnion<E>where
Vec<E>: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Converts
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> ⓘ
Converts
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