Enum linfa_preprocessing::tf_idf_vectorization::TfIdfMethod[][src]

pub enum TfIdfMethod {
    Smooth,
    NonSmooth,
    Textbook,
}

Methods for computing the inverse document frequency of a vocabulary entry

Variants

Smooth

Computes the idf as log(1+n/1+document_frequency) + 1. The “plus ones” inside the log add an artificial document containing every vocabulary entry, preventing divisions by zero. The “plus one” after the log allows vocabulary entries that appear in every document to still be considered with a weight of one instead of being completely discarded.

NonSmooth

Computes the idf as log(n/document_frequency) +1. The “plus one” after the log allows vocabulary entries that appear in every document to still be considered with a weight of one instead of being completely discarded. If a vocabulary entry has zero document frequency this will produce a division by zero.

Textbook

Textbook definition of idf, computed as log(n/ 1 + document_frequency) which prevents divisions by zero and discards entries that appear in every document.

Implementations

impl TfIdfMethod[src]

pub fn compute_idf(&self, n: usize, df: usize) -> f64[src]

Trait Implementations

impl Clone for TfIdfMethod[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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