Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMVA::Experimental::Internal::RBatchGenerator< Args > Class Template Reference

template<typename... Args>
class TMVA::Experimental::Internal::RBatchGenerator< Args >

Definition at line 36 of file RBatchGenerator.hxx.

Public Member Functions

 RBatchGenerator (ROOT::RDF::RNode &rdf, const std::size_t chunkSize, const std::size_t batchSize, const std::vector< std::string > &cols, const std::size_t numColumns, const std::vector< std::size_t > &vecSizes={}, const float vecPadding=0.0, const float validationSplit=0.0, const std::size_t maxChunks=0, bool shuffle=true, bool dropRemainder=true)
 
 ~RBatchGenerator ()
 
void Activate ()
 Activate the loading process by starting the batchloader, and spawning the loading thread.
 
void CreateBatches (std::size_t processedEvents)
 Create batches.
 
std::pair< std::vector< std::size_t >, std::vector< std::size_t > > createIndices (std::size_t events)
 split the events of the current chunk into training and validation events, shuffle if needed
 
void DeActivate ()
 De-activate the loading process by deactivating the batchgenerator and joining the loading thread.
 
const TMVA::Experimental::RTensor< float > & GetTrainBatch ()
 Returns the next batch of training data if available.
 
const TMVA::Experimental::RTensor< float > & GetValidationBatch ()
 Returns the next batch of validation data if available.
 
bool IsActive ()
 
void LoadChunksFilters ()
 
void LoadChunksNoFilters ()
 Load chunks when no filters are applied on rdataframe.
 
std::size_t NumberOfTrainingBatches ()
 
std::size_t NumberOfValidationBatches ()
 Calculate number of validation batches and return it.
 
std::size_t TrainRemainderRows ()
 Return number of training remainder rows.
 
std::size_t ValidationRemainderRows ()
 Return number of validation remainder rows.
 

Private Attributes

ROOT::RDF::RNodef_rdf
 
std::unique_ptr< RBatchLoaderfBatchLoader
 
std::size_t fBatchSize
 
std::variant< std::shared_ptr< RChunkLoader< Args... > >, std::shared_ptr< RChunkLoaderFilters< Args... > > > fChunkLoader
 
std::size_t fChunkSize
 
std::unique_ptr< TMVA::Experimental::RTensor< float > > fChunkTensor
 
bool fDropRemainder
 
std::mt19937 fFixedRng
 
std::random_device::result_type fFixedSeed
 
bool fIsActive {false}
 
std::mutex fIsActiveMutex
 
std::unique_ptr< std::thread > fLoadingThread
 
std::size_t fMaxChunks
 
bool fNotFiltered
 
std::size_t fNumEntries
 
std::mt19937 fRng
 
bool fShuffle
 
bool fUseWholeFile
 
float fValidationSplit
 

#include <TMVA/BatchGenerator/RBatchGenerator.hxx>

Constructor & Destructor Documentation

◆ RBatchGenerator()

template<typename... Args>
TMVA::Experimental::Internal::RBatchGenerator< Args >::RBatchGenerator ( ROOT::RDF::RNode rdf,
const std::size_t  chunkSize,
const std::size_t  batchSize,
const std::vector< std::string > &  cols,
const std::size_t  numColumns,
const std::vector< std::size_t > &  vecSizes = {},
const float  vecPadding = 0.0,
const float  validationSplit = 0.0,
const std::size_t  maxChunks = 0,
bool  shuffle = true,
bool  dropRemainder = true 
)
inline

Definition at line 68 of file RBatchGenerator.hxx.

◆ ~RBatchGenerator()

template<typename... Args>
TMVA::Experimental::Internal::RBatchGenerator< Args >::~RBatchGenerator ( )
inline

Definition at line 111 of file RBatchGenerator.hxx.

Member Function Documentation

◆ Activate()

template<typename... Args>
void TMVA::Experimental::Internal::RBatchGenerator< Args >::Activate ( )
inline

Activate the loading process by starting the batchloader, and spawning the loading thread.

Definition at line 133 of file RBatchGenerator.hxx.

◆ CreateBatches()

template<typename... Args>
void TMVA::Experimental::Internal::RBatchGenerator< Args >::CreateBatches ( std::size_t  processedEvents)
inline

Create batches.

Parameters
processedEvents

Definition at line 292 of file RBatchGenerator.hxx.

◆ createIndices()

template<typename... Args>
std::pair< std::vector< std::size_t >, std::vector< std::size_t > > TMVA::Experimental::Internal::RBatchGenerator< Args >::createIndices ( std::size_t  events)
inline

split the events of the current chunk into training and validation events, shuffle if needed

Parameters
events

Definition at line 302 of file RBatchGenerator.hxx.

◆ DeActivate()

template<typename... Args>
void TMVA::Experimental::Internal::RBatchGenerator< Args >::DeActivate ( )
inline

De-activate the loading process by deactivating the batchgenerator and joining the loading thread.

Definition at line 115 of file RBatchGenerator.hxx.

◆ GetTrainBatch()

template<typename... Args>
const TMVA::Experimental::RTensor< float > & TMVA::Experimental::Internal::RBatchGenerator< Args >::GetTrainBatch ( )
inline

Returns the next batch of training data if available.

Returns empty RTensor otherwise.

Returns

Definition at line 156 of file RBatchGenerator.hxx.

◆ GetValidationBatch()

template<typename... Args>
const TMVA::Experimental::RTensor< float > & TMVA::Experimental::Internal::RBatchGenerator< Args >::GetValidationBatch ( )
inline

Returns the next batch of validation data if available.

Returns empty RTensor otherwise.

Returns

Definition at line 165 of file RBatchGenerator.hxx.

◆ IsActive()

template<typename... Args>
bool TMVA::Experimental::Internal::RBatchGenerator< Args >::IsActive ( )
inline

Definition at line 329 of file RBatchGenerator.hxx.

◆ LoadChunksFilters()

template<typename... Args>
void TMVA::Experimental::Internal::RBatchGenerator< Args >::LoadChunksFilters ( )
inline

Definition at line 256 of file RBatchGenerator.hxx.

◆ LoadChunksNoFilters()

template<typename... Args>
void TMVA::Experimental::Internal::RBatchGenerator< Args >::LoadChunksNoFilters ( )
inline

Load chunks when no filters are applied on rdataframe.

Definition at line 230 of file RBatchGenerator.hxx.

◆ NumberOfTrainingBatches()

template<typename... Args>
std::size_t TMVA::Experimental::Internal::RBatchGenerator< Args >::NumberOfTrainingBatches ( )
inline

Definition at line 171 of file RBatchGenerator.hxx.

◆ NumberOfValidationBatches()

template<typename... Args>
std::size_t TMVA::Experimental::Internal::RBatchGenerator< Args >::NumberOfValidationBatches ( )
inline

Calculate number of validation batches and return it.

Returns

Definition at line 201 of file RBatchGenerator.hxx.

◆ TrainRemainderRows()

template<typename... Args>
std::size_t TMVA::Experimental::Internal::RBatchGenerator< Args >::TrainRemainderRows ( )
inline

Return number of training remainder rows.

Returns

Definition at line 186 of file RBatchGenerator.hxx.

◆ ValidationRemainderRows()

template<typename... Args>
std::size_t TMVA::Experimental::Internal::RBatchGenerator< Args >::ValidationRemainderRows ( )
inline

Return number of validation remainder rows.

Returns

Definition at line 216 of file RBatchGenerator.hxx.

Member Data Documentation

◆ f_rdf

template<typename... Args>
ROOT::RDF::RNode& TMVA::Experimental::Internal::RBatchGenerator< Args >::f_rdf
private

Definition at line 57 of file RBatchGenerator.hxx.

◆ fBatchLoader

template<typename... Args>
std::unique_ptr<RBatchLoader> TMVA::Experimental::Internal::RBatchGenerator< Args >::fBatchLoader
private

Definition at line 51 of file RBatchGenerator.hxx.

◆ fBatchSize

template<typename... Args>
std::size_t TMVA::Experimental::Internal::RBatchGenerator< Args >::fBatchSize
private

Definition at line 44 of file RBatchGenerator.hxx.

◆ fChunkLoader

template<typename... Args>
std::variant<std::shared_ptr<RChunkLoader<Args...> >, std::shared_ptr<RChunkLoaderFilters<Args...> > > TMVA::Experimental::Internal::RBatchGenerator< Args >::fChunkLoader
private

Definition at line 49 of file RBatchGenerator.hxx.

◆ fChunkSize

template<typename... Args>
std::size_t TMVA::Experimental::Internal::RBatchGenerator< Args >::fChunkSize
private

Definition at line 42 of file RBatchGenerator.hxx.

◆ fChunkTensor

template<typename... Args>
std::unique_ptr<TMVA::Experimental::RTensor<float> > TMVA::Experimental::Internal::RBatchGenerator< Args >::fChunkTensor
private

Definition at line 55 of file RBatchGenerator.hxx.

◆ fDropRemainder

template<typename... Args>
bool TMVA::Experimental::Internal::RBatchGenerator< Args >::fDropRemainder
private

Definition at line 61 of file RBatchGenerator.hxx.

◆ fFixedRng

template<typename... Args>
std::mt19937 TMVA::Experimental::Internal::RBatchGenerator< Args >::fFixedRng
private

Definition at line 39 of file RBatchGenerator.hxx.

◆ fFixedSeed

template<typename... Args>
std::random_device::result_type TMVA::Experimental::Internal::RBatchGenerator< Args >::fFixedSeed
private

Definition at line 40 of file RBatchGenerator.hxx.

◆ fIsActive

template<typename... Args>
bool TMVA::Experimental::Internal::RBatchGenerator< Args >::fIsActive {false}
private

Definition at line 63 of file RBatchGenerator.hxx.

◆ fIsActiveMutex

template<typename... Args>
std::mutex TMVA::Experimental::Internal::RBatchGenerator< Args >::fIsActiveMutex
private

Definition at line 59 of file RBatchGenerator.hxx.

◆ fLoadingThread

template<typename... Args>
std::unique_ptr<std::thread> TMVA::Experimental::Internal::RBatchGenerator< Args >::fLoadingThread
private

Definition at line 53 of file RBatchGenerator.hxx.

◆ fMaxChunks

template<typename... Args>
std::size_t TMVA::Experimental::Internal::RBatchGenerator< Args >::fMaxChunks
private

Definition at line 43 of file RBatchGenerator.hxx.

◆ fNotFiltered

template<typename... Args>
bool TMVA::Experimental::Internal::RBatchGenerator< Args >::fNotFiltered
private

Definition at line 64 of file RBatchGenerator.hxx.

◆ fNumEntries

template<typename... Args>
std::size_t TMVA::Experimental::Internal::RBatchGenerator< Args >::fNumEntries
private

Definition at line 45 of file RBatchGenerator.hxx.

◆ fRng

template<typename... Args>
std::mt19937 TMVA::Experimental::Internal::RBatchGenerator< Args >::fRng
private

Definition at line 38 of file RBatchGenerator.hxx.

◆ fShuffle

template<typename... Args>
bool TMVA::Experimental::Internal::RBatchGenerator< Args >::fShuffle
private

Definition at line 62 of file RBatchGenerator.hxx.

◆ fUseWholeFile

template<typename... Args>
bool TMVA::Experimental::Internal::RBatchGenerator< Args >::fUseWholeFile
private

Definition at line 65 of file RBatchGenerator.hxx.

◆ fValidationSplit

template<typename... Args>
float TMVA::Experimental::Internal::RBatchGenerator< Args >::fValidationSplit
private

Definition at line 47 of file RBatchGenerator.hxx.

  • tmva/tmva/inc/TMVA/BatchGenerator/RBatchGenerator.hxx