Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::Internal::ML::RSampler Class Reference

Implementation of different sampling strategies.

Definition at line 32 of file RSampler.hxx.

Public Member Functions

 RSampler (std::vector< RFlat2DMatrix > &datasets, const std::string &sampleType, float sampleRatio, bool replacement=false, bool shuffle=true, std::size_t setSeed=0)
 
 ~RSampler ()
 
std::size_t GetNumEntries ()
 
void RandomOversampler (RFlat2DMatrix &ShuffledTensor)
 Oversample entries randomly from the minority dataset.
 
void RandomUndersampler (RFlat2DMatrix &ShuffledTensor)
 Undersample entries randomly from the majority dataset.
 
void Sampler (RFlat2DMatrix &SampledTensor)
 Collection of sampling types.
 
void SampleWithoutReplacement (std::size_t n_samples, std::size_t max)
 Add indices without replacement to fSamples.
 
void SampleWithReplacement (std::size_t n_samples, std::size_t max)
 Add indices with replacement to fSamples.
 
void SetupRandomOversampler ()
 Calculate fNumEntries and major/minor variables for the random oversampler.
 
void SetupRandomUndersampler ()
 Calculate fNumEntries and major/minor variables for the random undersampler.
 
void SetupSampler ()
 Calculate fNumEntries and major/minor variables.
 

Private Attributes

std::vector< RFlat2DMatrix > & fDatasets
 
std::size_t fMajor
 
std::size_t fMinor
 
std::size_t fNumEntries
 
std::size_t fNumMajor
 
std::size_t fNumMinor
 
std::size_t fNumResampledMajor
 
std::size_t fNumResampledMinor
 
bool fReplacement
 
float fSampleRatio
 
std::vector< std::size_t > fSamples
 
std::string fSampleType
 
std::size_t fSetSeed
 
bool fShuffle
 
std::unique_ptr< RFlat2DMatrixOperatorsfTensorOperators
 

#include <ROOT/ML/RSampler.hxx>

Constructor & Destructor Documentation

◆ RSampler()

ROOT::Experimental::Internal::ML::RSampler::RSampler ( std::vector< RFlat2DMatrix > & datasets,
const std::string & sampleType,
float sampleRatio,
bool replacement = false,
bool shuffle = true,
std::size_t setSeed = 0 )

Definition at line 14 of file RSampler.cxx.

◆ ~RSampler()

ROOT::Experimental::Internal::ML::RSampler::~RSampler ( )
default

Member Function Documentation

◆ GetNumEntries()

std::size_t ROOT::Experimental::Internal::ML::RSampler::GetNumEntries ( )
inline

Definition at line 75 of file RSampler.hxx.

◆ RandomOversampler()

void ROOT::Experimental::Internal::ML::RSampler::RandomOversampler ( RFlat2DMatrix & ShuffledTensor)

Oversample entries randomly from the minority dataset.

Parameters
[in]SampledTensorTensor with all the sampled entries

Definition at line 128 of file RSampler.cxx.

◆ RandomUndersampler()

void ROOT::Experimental::Internal::ML::RSampler::RandomUndersampler ( RFlat2DMatrix & ShuffledTensor)

Undersample entries randomly from the majority dataset.

Parameters
[in]SampledTensorTensor with all the sampled entries

Definition at line 99 of file RSampler.cxx.

◆ Sampler()

void ROOT::Experimental::Internal::ML::RSampler::Sampler ( RFlat2DMatrix & SampledTensor)

Collection of sampling types.

Parameters
[in]SampledTensorTensor with all the sampled entries

Definition at line 43 of file RSampler.cxx.

◆ SampleWithoutReplacement()

void ROOT::Experimental::Internal::ML::RSampler::SampleWithoutReplacement ( std::size_t n_samples,
std::size_t max )

Add indices without replacement to fSamples.

Parameters
[in]n_samplesNumber of indices to sample
[in]maxMax index of the sample distribution

Definition at line 183 of file RSampler.cxx.

◆ SampleWithReplacement()

void ROOT::Experimental::Internal::ML::RSampler::SampleWithReplacement ( std::size_t n_samples,
std::size_t max )

Add indices with replacement to fSamples.

Parameters
[in]n_samplesNumber of indices to sample
[in]maxMax index of the sample distribution

Definition at line 152 of file RSampler.cxx.

◆ SetupRandomOversampler()

void ROOT::Experimental::Internal::ML::RSampler::SetupRandomOversampler ( )

Calculate fNumEntries and major/minor variables for the random oversampler.

Definition at line 80 of file RSampler.cxx.

◆ SetupRandomUndersampler()

void ROOT::Experimental::Internal::ML::RSampler::SetupRandomUndersampler ( )

Calculate fNumEntries and major/minor variables for the random undersampler.

Definition at line 54 of file RSampler.cxx.

◆ SetupSampler()

void ROOT::Experimental::Internal::ML::RSampler::SetupSampler ( )

Calculate fNumEntries and major/minor variables.

Definition at line 31 of file RSampler.cxx.

Member Data Documentation

◆ fDatasets

std::vector<RFlat2DMatrix>& ROOT::Experimental::Internal::ML::RSampler::fDatasets
private

Definition at line 34 of file RSampler.hxx.

◆ fMajor

std::size_t ROOT::Experimental::Internal::ML::RSampler::fMajor
private

Definition at line 42 of file RSampler.hxx.

◆ fMinor

std::size_t ROOT::Experimental::Internal::ML::RSampler::fMinor
private

Definition at line 43 of file RSampler.hxx.

◆ fNumEntries

std::size_t ROOT::Experimental::Internal::ML::RSampler::fNumEntries
private

Definition at line 40 of file RSampler.hxx.

◆ fNumMajor

std::size_t ROOT::Experimental::Internal::ML::RSampler::fNumMajor
private

Definition at line 44 of file RSampler.hxx.

◆ fNumMinor

std::size_t ROOT::Experimental::Internal::ML::RSampler::fNumMinor
private

Definition at line 45 of file RSampler.hxx.

◆ fNumResampledMajor

std::size_t ROOT::Experimental::Internal::ML::RSampler::fNumResampledMajor
private

Definition at line 46 of file RSampler.hxx.

◆ fNumResampledMinor

std::size_t ROOT::Experimental::Internal::ML::RSampler::fNumResampledMinor
private

Definition at line 47 of file RSampler.hxx.

◆ fReplacement

bool ROOT::Experimental::Internal::ML::RSampler::fReplacement
private

Definition at line 37 of file RSampler.hxx.

◆ fSampleRatio

float ROOT::Experimental::Internal::ML::RSampler::fSampleRatio
private

Definition at line 36 of file RSampler.hxx.

◆ fSamples

std::vector<std::size_t> ROOT::Experimental::Internal::ML::RSampler::fSamples
private

Definition at line 49 of file RSampler.hxx.

◆ fSampleType

std::string ROOT::Experimental::Internal::ML::RSampler::fSampleType
private

Definition at line 35 of file RSampler.hxx.

◆ fSetSeed

std::size_t ROOT::Experimental::Internal::ML::RSampler::fSetSeed
private

Definition at line 39 of file RSampler.hxx.

◆ fShuffle

bool ROOT::Experimental::Internal::ML::RSampler::fShuffle
private

Definition at line 38 of file RSampler.hxx.

◆ fTensorOperators

std::unique_ptr<RFlat2DMatrixOperators> ROOT::Experimental::Internal::ML::RSampler::fTensorOperators
private

Definition at line 51 of file RSampler.hxx.

Libraries for ROOT::Experimental::Internal::ML::RSampler:

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