Skip to main content

Transformer

Trait Transformer 

Source
pub trait Transformer {
    // Required methods
    fn input_dim(&self) -> usize;
    fn output_dim(&self) -> usize;
    fn transform(&self, features: &[f64]) -> Result<Vec<f64>, RillError>;
    fn update(&mut self, features: &[f64]) -> Result<(), RillError>;
    fn samples_seen(&self) -> u64;
    fn reset(&mut self);
}
Expand description

A stateful feature transformer.

The contract is:

  • transform is read-only and must not update state.
  • update uses the raw features to refresh internal statistics. It must not read the target label.

Required Methods§

Source

fn input_dim(&self) -> usize

Expected number of input features.

Source

fn output_dim(&self) -> usize

Number of features produced by transform.

Source

fn transform(&self, features: &[f64]) -> Result<Vec<f64>, RillError>

Transform features using the current internal state.

Source

fn update(&mut self, features: &[f64]) -> Result<(), RillError>

Update internal statistics using raw features.

Source

fn samples_seen(&self) -> u64

How many samples the transformer has seen.

Source

fn reset(&mut self)

Reset the transformer to its initial state.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§