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

Load the whole dataset into memory.

In this class the whole dataset is loaded into memory. The dataset is further shuffled and spit into training and validation sets with the user-defined validation split fraction.

Definition at line 37 of file RDatasetLoader.hxx.

Public Member Functions

 RDatasetLoader (const std::vector< ROOT::RDF::RNode > &rdfs, const float validationSplit, const std::vector< std::string > &cols, const std::vector< std::size_t > &vecSizes={}, const float vecPadding=0.0, bool shuffle=true, const std::size_t setSeed=0)
 
std::vector< std::size_t > CountEntries (std::vector< ROOT::RDF::RNode > &rdfs)
 Number of entries to reserve for each dataframe.
 
std::size_t GetNumTrainingEntries ()
 
std::size_t GetNumValidationEntries ()
 
void LoadDataframe (ROOT::RDF::RNode &rdf, std::size_t NumEntries)
 Load all the entries of an individual dataframe at the end of the dataset.
 
RFlat2DMatrix ReleaseDataset ()
 
std::vector< std::vector< std::size_t > > ReleaseTrainingRows ()
 
std::vector< std::vector< std::size_t > > ReleaseValidationRows ()
 
void SplitDatasets (bool concatenate)
 Load the dataframes into a single dataset and split it in training and validation rows.
 
void SplitRows (std::size_t firstRow, std::vector< std::size_t > &TrainingRows, std::vector< std::size_t > &ValidationRows)
 Split the rows of the dataset from firstRow on into training and validation rows.
 

Private Attributes

std::vector< ROOT::RDF::RNode > f_rdfs
 
std::vector< std::string > fCols
 
RFlat2DMatrix fDataset
 
std::size_t fNumCols
 
std::size_t fNumDatasetCols
 
std::size_t fNumTrainingEntries
 
std::size_t fNumValidationEntries
 
std::size_t fSetSeed
 
bool fShuffle
 
std::size_t fSumVecSizes
 
std::unique_ptr< RFlat2DMatrixOperators > fTensorOperators
 
std::vector< std::vector< std::size_t > > fTrainingRows
 
std::vector< std::vector< std::size_t > > fValidationRows
 
float fValidationSplit
 
float fVecPadding
 
std::vector< std::size_t > fVecSizes
 

#include </github/home/ROOT-CI/src/tree/ml/src/RDatasetLoader.hxx>

Constructor & Destructor Documentation

◆ RDatasetLoader()

ROOT::Experimental::Internal::ML::RDatasetLoader::RDatasetLoader ( const std::vector< ROOT::RDF::RNode > & rdfs,
const float validationSplit,
const std::vector< std::string > & cols,
const std::vector< std::size_t > & vecSizes = {},
const float vecPadding = 0.0,
bool shuffle = true,
const std::size_t setSeed = 0 )

Definition at line 7 of file RDatasetLoader.cxx.

Member Function Documentation

◆ CountEntries()

std::vector< std::size_t > ROOT::Experimental::Internal::ML::RDatasetLoader::CountEntries ( std::vector< ROOT::RDF::RNode > & rdfs)

Number of entries to reserve for each dataframe.

Parameters
[in]rdfsDataframes to load
Returns
Number of entries of each dataframe, an upper bound for a filtered dataframe

Definition at line 29 of file RDatasetLoader.cxx.

◆ GetNumTrainingEntries()

std::size_t ROOT::Experimental::Internal::ML::RDatasetLoader::GetNumTrainingEntries ( )
inline

Definition at line 82 of file RDatasetLoader.hxx.

◆ GetNumValidationEntries()

std::size_t ROOT::Experimental::Internal::ML::RDatasetLoader::GetNumValidationEntries ( )
inline

Definition at line 83 of file RDatasetLoader.hxx.

◆ LoadDataframe()

void ROOT::Experimental::Internal::ML::RDatasetLoader::LoadDataframe ( ROOT::RDF::RNode & rdf,
std::size_t NumEntries )

Load all the entries of an individual dataframe at the end of the dataset.

Parameters
[in]rdfDataframe to load
[in]NumEntriesNumber of entries of the dataframe, an upper bound for a filtered dataframe

Definition at line 67 of file RDatasetLoader.cxx.

◆ ReleaseDataset()

RFlat2DMatrix ROOT::Experimental::Internal::ML::RDatasetLoader::ReleaseDataset ( )
inline

Definition at line 77 of file RDatasetLoader.hxx.

◆ ReleaseTrainingRows()

std::vector< std::vector< std::size_t > > ROOT::Experimental::Internal::ML::RDatasetLoader::ReleaseTrainingRows ( )
inline

Definition at line 79 of file RDatasetLoader.hxx.

◆ ReleaseValidationRows()

std::vector< std::vector< std::size_t > > ROOT::Experimental::Internal::ML::RDatasetLoader::ReleaseValidationRows ( )
inline

Definition at line 80 of file RDatasetLoader.hxx.

◆ SplitDatasets()

void ROOT::Experimental::Internal::ML::RDatasetLoader::SplitDatasets ( bool concatenate)

Load the dataframes into a single dataset and split it in training and validation rows.

Parameters
[in]concatenateWhether to concatenate the rows of all the dataframes into a single set

Definition at line 106 of file RDatasetLoader.cxx.

◆ SplitRows()

void ROOT::Experimental::Internal::ML::RDatasetLoader::SplitRows ( std::size_t firstRow,
std::vector< std::size_t > & TrainingRows,
std::vector< std::size_t > & ValidationRows )

Split the rows of the dataset from firstRow on into training and validation rows.

Parameters
[in]firstRowFirst row of the dataframe in the dataset
[in]TrainingRowsRows of the training set, appended to
[in]ValidationRowsRows of the validation set, appended to

Definition at line 85 of file RDatasetLoader.cxx.

Member Data Documentation

◆ f_rdfs

std::vector<ROOT::RDF::RNode> ROOT::Experimental::Internal::ML::RDatasetLoader::f_rdfs
private

Definition at line 56 of file RDatasetLoader.hxx.

◆ fCols

std::vector<std::string> ROOT::Experimental::Internal::ML::RDatasetLoader::fCols
private

Definition at line 57 of file RDatasetLoader.hxx.

◆ fDataset

RFlat2DMatrix ROOT::Experimental::Internal::ML::RDatasetLoader::fDataset
private

Definition at line 46 of file RDatasetLoader.hxx.

◆ fNumCols

std::size_t ROOT::Experimental::Internal::ML::RDatasetLoader::fNumCols
private

Definition at line 58 of file RDatasetLoader.hxx.

◆ fNumDatasetCols

std::size_t ROOT::Experimental::Internal::ML::RDatasetLoader::fNumDatasetCols
private

Definition at line 44 of file RDatasetLoader.hxx.

◆ fNumTrainingEntries

std::size_t ROOT::Experimental::Internal::ML::RDatasetLoader::fNumTrainingEntries
private

Definition at line 52 of file RDatasetLoader.hxx.

◆ fNumValidationEntries

std::size_t ROOT::Experimental::Internal::ML::RDatasetLoader::fNumValidationEntries
private

Definition at line 53 of file RDatasetLoader.hxx.

◆ fSetSeed

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

Definition at line 59 of file RDatasetLoader.hxx.

◆ fShuffle

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

Definition at line 61 of file RDatasetLoader.hxx.

◆ fSumVecSizes

std::size_t ROOT::Experimental::Internal::ML::RDatasetLoader::fSumVecSizes
private

Definition at line 42 of file RDatasetLoader.hxx.

◆ fTensorOperators

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

Definition at line 54 of file RDatasetLoader.hxx.

◆ fTrainingRows

std::vector<std::vector<std::size_t> > ROOT::Experimental::Internal::ML::RDatasetLoader::fTrainingRows
private

Definition at line 49 of file RDatasetLoader.hxx.

◆ fValidationRows

std::vector<std::vector<std::size_t> > ROOT::Experimental::Internal::ML::RDatasetLoader::fValidationRows
private

Definition at line 50 of file RDatasetLoader.hxx.

◆ fValidationSplit

float ROOT::Experimental::Internal::ML::RDatasetLoader::fValidationSplit
private

Definition at line 39 of file RDatasetLoader.hxx.

◆ fVecPadding

float ROOT::Experimental::Internal::ML::RDatasetLoader::fVecPadding
private

Definition at line 43 of file RDatasetLoader.hxx.

◆ fVecSizes

std::vector<std::size_t> ROOT::Experimental::Internal::ML::RDatasetLoader::fVecSizes
private

Definition at line 41 of file RDatasetLoader.hxx.

  • tree/ml/src/RDatasetLoader.hxx
  • tree/ml/src/RDatasetLoader.cxx