Struct rusty_machine::data::transforms::shuffle::Shuffler
source · [−]pub struct Shuffler<R: Rng> { /* private fields */ }
Expand description
The Shuffler
Provides an implementation of Transformer
which shuffles
the input rows in place.
Implementations
sourceimpl<R: Rng> Shuffler<R>
impl<R: Rng> Shuffler<R>
sourcepub fn new(rng: R) -> Self
pub fn new(rng: R) -> Self
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
sourceimpl Default for Shuffler<ThreadRng>
impl Default for Shuffler<ThreadRng>
Create a new shuffler using the rand::thread_rng
function
to provide a randomly seeded random number generator.
sourceimpl<R: Rng, T> Transformer<Matrix<T>> for Shuffler<R>
impl<R: Rng, T> Transformer<Matrix<T>> for Shuffler<R>
The Shuffler
will transform the input Matrix
by shuffling
its rows in place.
Under the hood this uses a Fisher-Yates shuffle.
sourcefn transform(&mut self, inputs: Matrix<T>) -> LearningResult<Matrix<T>>
fn transform(&mut self, inputs: Matrix<T>) -> LearningResult<Matrix<T>>
Transforms the inputs
Auto Trait Implementations
impl<R> RefUnwindSafe for Shuffler<R>where
R: RefUnwindSafe,
impl<R> Send for Shuffler<R>where
R: Send,
impl<R> Sync for Shuffler<R>where
R: Sync,
impl<R> Unpin for Shuffler<R>where
R: Unpin,
impl<R> UnwindSafe for Shuffler<R>where
R: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more