[][src]Trait onehot::OneHot

pub trait OneHot {
    type Labels: Iterator<Item = &'static str>;
    type Encoder: Iterator<Item = bool>;

    const ONEHOT_LEN: usize;

    fn labels() -> Self::Labels;
fn onehot(&self) -> Self::Encoder; }

The trait for one-hot encoding of structs and enums.

Associated Types

type Labels: Iterator<Item = &'static str>

An iterator to the labels of each encoded field. This iterator has the same size as ONEHOT_LEN

type Encoder: Iterator<Item = bool>

An iterator to the encoded values. This iterator has the same size as ONEHOT_LEN

Loading content...

Associated Constants

const ONEHOT_LEN: usize

How many booleans in the resulting encoding.

Loading content...

Required methods

fn labels() -> Self::Labels

Get the iterator to the labels.

fn onehot(&self) -> Self::Encoder

One-hot encode.

Loading content...

Implementations on Foreign Types

impl<T: OneHot, '_> OneHot for &'_ T[src]

type Labels = T::Labels

type Encoder = T::Encoder

impl<T: OneHot, '_> OneHot for &'_ mut T[src]

type Labels = T::Labels

type Encoder = T::Encoder

impl OneHot for bool[src]

Booleans are trivially one-hot encoded.

type Labels = Once<&'static str>

type Encoder = Once<bool>

Loading content...

Implementors

Loading content...