SG++
sgpp::datadriven::RandomShufflingFunctor Class Reference

Generate a randomized permutation for a set of indices based on a pseudo random generator. More...

#include <RandomShufflingFunctor.hpp>

Inheritance diagram for sgpp::datadriven::RandomShufflingFunctor:
sgpp::datadriven::ShufflingFunctor

Public Member Functions

ShufflingFunctorclone () const override
 Polymorphic clone pattern. More...
 
void shuffle (const Dataset &dataset, std::vector< size_t > &indices) override
 Rearange indices of data samples in a dataset based on a random seed. More...
 
- Public Member Functions inherited from sgpp::datadriven::ShufflingFunctor
int64_t getSeed () const
 Get random seed for randomized operations. More...
 
ShufflingFunctoroperator= (const ShufflingFunctor &rhs)=default
 
ShufflingFunctoroperator= (ShufflingFunctor &&rhs)=default
 
void setSeed (int64_t seed)
 Set random seed for randomized operations. More...
 
 ShufflingFunctor ()
 
 ShufflingFunctor (const ShufflingFunctor &rhs)=default
 
 ShufflingFunctor (ShufflingFunctor &&rhs)=default
 
virtual ~ShufflingFunctor ()=default
 

Additional Inherited Members

- Protected Attributes inherited from sgpp::datadriven::ShufflingFunctor
std::mt19937 generator
 Pseudo random number generator required for shuffling. More...
 
int64_t seed
 Random seed for a pseudo random number generator. More...
 

Detailed Description

Generate a randomized permutation for a set of indices based on a pseudo random generator.

This way sorted samples can be ordered randomly to allow splitting the dataset into testing and training set.

Usage example

vector index 0123456
index of the sample 0123456

is permuted to e.g.

vector index 0123456
index of the sample 5146320

indicates where each sample of dataset is moved to in the permuted dataset.

Member Function Documentation

ShufflingFunctor * sgpp::datadriven::RandomShufflingFunctor::clone ( ) const
overridevirtual

Polymorphic clone pattern.

Returns
deep copy of this object. New object is owned by caller.

Implements sgpp::datadriven::ShufflingFunctor.

void sgpp::datadriven::RandomShufflingFunctor::shuffle ( const Dataset dataset,
std::vector< size_t > &  indices 
)
overridevirtual

Rearange indices of data samples in a dataset based on a random seed.

Parameters
datasetDataset to be permuted.
indicesvector containing the indices of the data points to be distributed. Vector is modified in place.

Implements sgpp::datadriven::ShufflingFunctor.

References sgpp::datadriven::ShufflingFunctor::generator.


The documentation for this class was generated from the following files: