SG++
sgpp::datadriven::ShufflingFunctor Class Referenceabstract

A shuffling functor generates a permutation for a set of indices. More...

#include <ShufflingFunctor.hpp>

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

Public Member Functions

virtual ShufflingFunctorclone () const =0
 Polymorphic clone pattern. More...
 
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...
 
virtual void shuffle (const Dataset &data, std::vector< size_t > &indices)=0
 Create a permutation of a Dataset from a vector of indices. More...
 
 ShufflingFunctor ()
 
 ShufflingFunctor (const ShufflingFunctor &rhs)=default
 
 ShufflingFunctor (ShufflingFunctor &&rhs)=default
 
virtual ~ShufflingFunctor ()=default
 

Protected Attributes

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

A shuffling functor generates a permutation for a set of indices.

Can be used to generate a random or particular ordering of samples from a potentially ordered dataset as training and testing data should be evenly distributed when performing training with testing or cross-validation.

Constructor & Destructor Documentation

sgpp::datadriven::ShufflingFunctor::ShufflingFunctor ( )

References generator, and seed.

sgpp::datadriven::ShufflingFunctor::ShufflingFunctor ( const ShufflingFunctor rhs)
default
sgpp::datadriven::ShufflingFunctor::ShufflingFunctor ( ShufflingFunctor &&  rhs)
default
virtual sgpp::datadriven::ShufflingFunctor::~ShufflingFunctor ( )
virtualdefault

Member Function Documentation

virtual ShufflingFunctor* sgpp::datadriven::ShufflingFunctor::clone ( ) const
pure virtual

Polymorphic clone pattern.

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

Implemented in sgpp::datadriven::RandomShufflingFunctor, and sgpp::datadriven::SequentialShufflingFunctor.

int64_t sgpp::datadriven::ShufflingFunctor::getSeed ( ) const

Get random seed for randomized operations.

Returns
random seed.

References seed.

ShufflingFunctor& sgpp::datadriven::ShufflingFunctor::operator= ( const ShufflingFunctor rhs)
default
ShufflingFunctor& sgpp::datadriven::ShufflingFunctor::operator= ( ShufflingFunctor &&  rhs)
default
void sgpp::datadriven::ShufflingFunctor::setSeed ( int64_t  seed)

Set random seed for randomized operations.

Parameters
seedthe new random seed.

References generator, and seed.

virtual void sgpp::datadriven::ShufflingFunctor::shuffle ( const Dataset data,
std::vector< size_t > &  indices 
)
pure virtual

Create a permutation of a Dataset from a vector of indices.

The indices can then be mapped back to the samples.

Parameters
dataDataset to be permuted.
indicesvector containing indices. Will permute indices in place.

Implemented in sgpp::datadriven::RandomShufflingFunctor, and sgpp::datadriven::SequentialShufflingFunctor.

Member Data Documentation

std::mt19937 sgpp::datadriven::ShufflingFunctor::generator
protected

Pseudo random number generator required for shuffling.

Referenced by setSeed(), sgpp::datadriven::RandomShufflingFunctor::shuffle(), and ShufflingFunctor().

int64_t sgpp::datadriven::ShufflingFunctor::seed
protected

Random seed for a pseudo random number generator.

Same seeds should produce identical random numbers. Required as an initialization for the random number generator.

Referenced by getSeed(), setSeed(), and ShufflingFunctor().


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