pub struct Shuffler<R: Rng> { /* private fields */ }
Expand description

The Shuffler

Provides an implementation of Transformer which shuffles the input rows in place.

Implementations

Construct a new Shuffler with given random number generator.

Examples

use rusty_machine::data::transforms::Transformer;
use rusty_machine::data::transforms::shuffle::Shuffler;
use rand::{StdRng, SeedableRng};

// We can create a seeded rng
let rng = StdRng::from_seed(&[1, 2, 3]);

let shuffler = Shuffler::new(rng);

Trait Implementations

Formats the value using the given formatter. Read more

Create a new shuffler using the rand::thread_rng function to provide a randomly seeded random number generator.

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

The Shuffler will transform the input Matrix by shuffling its rows in place.

Under the hood this uses a Fisher-Yates shuffle.

Transforms the inputs

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.