Implementation of different sampling strategies.
Definition at line 32 of file RSampler.hxx.
|
| | RSampler (const RFlat2DMatrix &dataset, std::vector< std::vector< std::size_t > > &rows, const std::string &sampleType, float sampleRatio, bool replacement=false, bool shuffle=true, std::size_t setSeed=0) |
| |
| | ~RSampler () |
| |
| void | GatherSamples (RFlat2DMatrix &ShuffledTensor, const std::vector< std::size_t > &ResampledRows, std::size_t numResampled, const std::vector< std::size_t > &OtherRows) |
| | Fill the sampled entries: the resampled entries followed by all the other ones, in shuffled order.
|
| |
| 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.
|
| |
#include </github/home/ROOT-CI/src/tree/ml/src/RSampler.hxx>
◆ RSampler()
| ROOT::Experimental::Internal::ML::RSampler::RSampler |
( |
const RFlat2DMatrix & | dataset, |
|
|
std::vector< std::vector< std::size_t > > & | rows, |
|
|
const std::string & | sampleType, |
|
|
float | sampleRatio, |
|
|
bool | replacement = false, |
|
|
bool | shuffle = true, |
|
|
std::size_t | setSeed = 0 ) |
◆ ~RSampler()
| ROOT::Experimental::Internal::ML::RSampler::~RSampler |
( |
| ) |
|
|
default |
◆ GatherSamples()
| void ROOT::Experimental::Internal::ML::RSampler::GatherSamples |
( |
RFlat2DMatrix & | ShuffledTensor, |
|
|
const std::vector< std::size_t > & | ResampledRows, |
|
|
std::size_t | numResampled, |
|
|
const std::vector< std::size_t > & | OtherRows ) |
Fill the sampled entries: the resampled entries followed by all the other ones, in shuffled order.
- Parameters
-
| [in] | ShuffledTensor | Tensor with all the sampled entries |
| [in] | ResampledRows | Rows of the class the entries in fSamples are taken from |
| [in] | numResampled | Number of resampled entries |
| [in] | OtherRows | Rows of the class whose entries are all taken |
Definition at line 131 of file RSampler.cxx.
◆ GetNumEntries()
| std::size_t ROOT::Experimental::Internal::ML::RSampler::GetNumEntries |
( |
| ) |
|
|
inline |
◆ RandomOversampler()
| void ROOT::Experimental::Internal::ML::RSampler::RandomOversampler |
( |
RFlat2DMatrix & | ShuffledTensor | ) |
|
Oversample entries randomly from the minority dataset.
- Parameters
-
| [in] | SampledTensor | Tensor with all the sampled entries |
Definition at line 118 of file RSampler.cxx.
◆ RandomUndersampler()
| void ROOT::Experimental::Internal::ML::RSampler::RandomUndersampler |
( |
RFlat2DMatrix & | ShuffledTensor | ) |
|
Undersample entries randomly from the majority dataset.
- Parameters
-
| [in] | SampledTensor | Tensor with all the sampled entries |
Definition at line 102 of file RSampler.cxx.
◆ Sampler()
| void ROOT::Experimental::Internal::ML::RSampler::Sampler |
( |
RFlat2DMatrix & | SampledTensor | ) |
|
Collection of sampling types.
- Parameters
-
| [in] | SampledTensor | Tensor with all the sampled entries |
Definition at line 46 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_samples | Number of indices to sample |
| [in] | max | Max index of the sample distribution |
Definition at line 184 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_samples | Number of indices to sample |
| [in] | max | Max index of the sample distribution |
Definition at line 151 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 83 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 57 of file RSampler.cxx.
◆ SetupSampler()
| void ROOT::Experimental::Internal::ML::RSampler::SetupSampler |
( |
| ) |
|
Calculate fNumEntries and major/minor variables.
Definition at line 34 of file RSampler.cxx.
◆ fDataset
| const RFlat2DMatrix& ROOT::Experimental::Internal::ML::RSampler::fDataset |
|
private |
◆ fMajor
| std::size_t ROOT::Experimental::Internal::ML::RSampler::fMajor |
|
private |
◆ fMinor
| std::size_t ROOT::Experimental::Internal::ML::RSampler::fMinor |
|
private |
◆ fNumEntries
| std::size_t ROOT::Experimental::Internal::ML::RSampler::fNumEntries |
|
private |
◆ fNumMajor
| std::size_t ROOT::Experimental::Internal::ML::RSampler::fNumMajor |
|
private |
◆ fNumMinor
| std::size_t ROOT::Experimental::Internal::ML::RSampler::fNumMinor |
|
private |
◆ fNumResampledMajor
| std::size_t ROOT::Experimental::Internal::ML::RSampler::fNumResampledMajor |
|
private |
◆ fNumResampledMinor
| std::size_t ROOT::Experimental::Internal::ML::RSampler::fNumResampledMinor |
|
private |
◆ fReplacement
| bool ROOT::Experimental::Internal::ML::RSampler::fReplacement |
|
private |
◆ fRows
| std::vector<std::vector<std::size_t> >& ROOT::Experimental::Internal::ML::RSampler::fRows |
|
private |
◆ fSampleRatio
| float ROOT::Experimental::Internal::ML::RSampler::fSampleRatio |
|
private |
◆ fSamples
| std::vector<std::size_t> ROOT::Experimental::Internal::ML::RSampler::fSamples |
|
private |
◆ fSampleType
| std::string ROOT::Experimental::Internal::ML::RSampler::fSampleType |
|
private |
◆ fSetSeed
| std::size_t ROOT::Experimental::Internal::ML::RSampler::fSetSeed |
|
private |
◆ fShuffle
| bool ROOT::Experimental::Internal::ML::RSampler::fShuffle |
|
private |
◆ fTensorOperators
tree/ml/src/RSampler.hxx
tree/ml/src/RSampler.cxx