Trait syntaxdot_encoders::categorical::Number[][src]

pub trait Number<V> where
    V: Clone + Eq + Hash
{ fn new(numberer: Numberer<V>) -> Self;
fn len(&self) -> usize;
fn number(&self, value: V) -> Option<usize>;
fn value(&self, number: usize) -> Option<V>; }

Number a categorical variable.

Required methods

fn new(numberer: Numberer<V>) -> Self[src]

Construct a numberer for categorical variables.

fn len(&self) -> usize[src]

Get the number of possible values in the categorical variable.

This includes reserved numerical representations that do not correspond to values in the categorial variable.

fn number(&self, value: V) -> Option<usize>[src]

Get the number of a value from a categorical variable.

Mutable implementations of this trait must add the value if it is unknown and always return Option::Some.

fn value(&self, number: usize) -> Option<V>[src]

Get the value corresponding of a number.

Returns Option::None if the number is unknown or a reserved number.

Loading content...

Implementors

impl<V> Number<V> for ImmutableNumberer<V> where
    V: Clone + Eq + Hash
[src]

impl<V> Number<V> for MutableNumberer<V> where
    V: Clone + Eq + Hash
[src]

Loading content...