Skip to main content

ParallelFeatureUnion

Struct ParallelFeatureUnion 

Source
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>

Source

pub fn new() -> Self

Create a new parallel feature union

Source

pub fn add_extractor(self, extractor: E, name: String) -> Self

Add an extractor to the union

Source

pub fn len(&self) -> usize

Get the number of extractors

Source

pub fn is_empty(&self) -> bool

Check if union is empty

Source

pub fn extractor_names(&self) -> &[String]

Get extractor names

Trait Implementations§

Source§

impl<E: Clone> Clone for ParallelFeatureUnion<E>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Debug> Debug for ParallelFeatureUnion<E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E> Default for ParallelFeatureUnion<E>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<E> FeatureUnion for ParallelFeatureUnion<E>
where E: FeatureExtractor<Input = String, Output = Array2<Float>>,

Source§

type Input = String

Input data type
Source§

type Output = ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>

Output feature type
Source§

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

Get number of extractors in the union
Source§

fn feature_splits(&self) -> Vec<usize>

Get feature split points (cumulative feature counts)

Auto Trait Implementations§

§

impl<E> Freeze for ParallelFeatureUnion<E>
where Vec<E>: Freeze,

§

impl<E> RefUnwindSafe for ParallelFeatureUnion<E>
where Vec<E>: RefUnwindSafe,

§

impl<E> Send for ParallelFeatureUnion<E>
where Vec<E>: Send,

§

impl<E> Sync for ParallelFeatureUnion<E>
where Vec<E>: Sync,

§

impl<E> Unpin for ParallelFeatureUnion<E>
where Vec<E>: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V