Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMVA::Experimental::Internal::RBatchLoader Class Reference

Definition at line 21 of file RBatchLoader.hxx.

Public Member Functions

 RBatchLoader (const std::size_t batchSize, const std::size_t numColumns, const std::size_t maxBatches)
 
 ~RBatchLoader ()
 
void Activate ()
 Activate the batchloader so it will accept chunks to batch.
 
std::unique_ptr< TMVA::Experimental::RTensor< float > > CreateBatch (const TMVA::Experimental::RTensor< float > &chunkTensor, const std::vector< std::size_t > idx)
 Create a batch filled with the events on the given idx.
 
void CreateTrainingBatches (const TMVA::Experimental::RTensor< float > &chunkTensor, std::vector< std::size_t > eventIndices, const bool shuffle=true)
 Create training batches from the given chunk of data based on the given event indices Batches are added to the training queue of batches The eventIndices can be shuffled to ensure random order for each epoch.
 
void CreateValidationBatches (const TMVA::Experimental::RTensor< float > &chunkTensor, const std::vector< std::size_t > eventIndices)
 Create validation batches from the given chunk based on the given event indices Batches are added to the vector of validation batches.
 
void DeActivate ()
 DeActivate the batchloader.
 
const TMVA::Experimental::RTensor< float > & GetTrainBatch ()
 Return a batch of data as a unique pointer.
 
const TMVA::Experimental::RTensor< float > & GetValidationBatch ()
 Returns a batch of data for validation The owner of this batch has to be with the RBatchLoader.
 
bool HasTrainData ()
 Checks if there are more training batches available.
 
bool HasValidationData ()
 Checks if there are more training batches available.
 
void StartValidation ()
 Reset the validation process.
 

Private Attributes

std::condition_variable fBatchCondition
 
std::mutex fBatchLock
 
std::size_t fBatchSize
 
std::unique_ptr< TMVA::Experimental::RTensor< float > > fCurrentBatch
 
TMVA::Experimental::RTensor< float > fEmptyTensor = TMVA::Experimental::RTensor<float>({0})
 
bool fIsActive = false
 
std::size_t fMaxBatches
 
std::size_t fNumColumns
 
TMVA::RandomGenerator< TRandom3fRng = TMVA::RandomGenerator<TRandom3>(0)
 
std::queue< std::unique_ptr< TMVA::Experimental::RTensor< float > > > fTrainingBatchQueue
 
std::vector< std::unique_ptr< TMVA::Experimental::RTensor< float > > > fValidationBatches
 
std::size_t fValidationIdx = 0
 

#include <TMVA/RBatchLoader.hxx>

Constructor & Destructor Documentation

◆ RBatchLoader()

TMVA::Experimental::Internal::RBatchLoader::RBatchLoader ( const std::size_t  batchSize,
const std::size_t  numColumns,
const std::size_t  maxBatches 
)
inline

Definition at line 42 of file RBatchLoader.hxx.

◆ ~RBatchLoader()

TMVA::Experimental::Internal::RBatchLoader::~RBatchLoader ( )
inline

Definition at line 47 of file RBatchLoader.hxx.

Member Function Documentation

◆ Activate()

void TMVA::Experimental::Internal::RBatchLoader::Activate ( )
inline

Activate the batchloader so it will accept chunks to batch.

Definition at line 106 of file RBatchLoader.hxx.

◆ CreateBatch()

std::unique_ptr< TMVA::Experimental::RTensor< float > > TMVA::Experimental::Internal::RBatchLoader::CreateBatch ( const TMVA::Experimental::RTensor< float > &  chunkTensor,
const std::vector< std::size_t >  idx 
)
inline

Create a batch filled with the events on the given idx.

Parameters
chunkTensor
idx
Returns

Definition at line 131 of file RBatchLoader.hxx.

◆ CreateTrainingBatches()

void TMVA::Experimental::Internal::RBatchLoader::CreateTrainingBatches ( const TMVA::Experimental::RTensor< float > &  chunkTensor,
std::vector< std::size_t >  eventIndices,
const bool  shuffle = true 
)
inline

Create training batches from the given chunk of data based on the given event indices Batches are added to the training queue of batches The eventIndices can be shuffled to ensure random order for each epoch.

Parameters
chunkTensor
eventIndices
shuffle

Definition at line 150 of file RBatchLoader.hxx.

◆ CreateValidationBatches()

void TMVA::Experimental::Internal::RBatchLoader::CreateValidationBatches ( const TMVA::Experimental::RTensor< float > &  chunkTensor,
const std::vector< std::size_t >  eventIndices 
)
inline

Create validation batches from the given chunk based on the given event indices Batches are added to the vector of validation batches.

Parameters
chunkTensor
eventIndices

Definition at line 194 of file RBatchLoader.hxx.

◆ DeActivate()

void TMVA::Experimental::Internal::RBatchLoader::DeActivate ( )
inline

DeActivate the batchloader.

This means that no more batches are created. Batches can still be returned if they are already loaded

Definition at line 117 of file RBatchLoader.hxx.

◆ GetTrainBatch()

const TMVA::Experimental::RTensor< float > & TMVA::Experimental::Internal::RBatchLoader::GetTrainBatch ( )
inline

Return a batch of data as a unique pointer.

After the batch has been processed, it should be distroyed.

Returns
Training batch

Definition at line 53 of file RBatchLoader.hxx.

◆ GetValidationBatch()

const TMVA::Experimental::RTensor< float > & TMVA::Experimental::Internal::RBatchLoader::GetValidationBatch ( )
inline

Returns a batch of data for validation The owner of this batch has to be with the RBatchLoader.

This is because the same validation batches should be used in all epochs.

Returns
Validation batch

Definition at line 75 of file RBatchLoader.hxx.

◆ HasTrainData()

bool TMVA::Experimental::Internal::RBatchLoader::HasTrainData ( )
inline

Checks if there are more training batches available.

Returns

Definition at line 86 of file RBatchLoader.hxx.

◆ HasValidationData()

bool TMVA::Experimental::Internal::RBatchLoader::HasValidationData ( )
inline

Checks if there are more training batches available.

Returns

Definition at line 99 of file RBatchLoader.hxx.

◆ StartValidation()

void TMVA::Experimental::Internal::RBatchLoader::StartValidation ( )
inline

Reset the validation process.

Definition at line 214 of file RBatchLoader.hxx.

Member Data Documentation

◆ fBatchCondition

std::condition_variable TMVA::Experimental::Internal::RBatchLoader::fBatchCondition
private

Definition at line 31 of file RBatchLoader.hxx.

◆ fBatchLock

std::mutex TMVA::Experimental::Internal::RBatchLoader::fBatchLock
private

Definition at line 30 of file RBatchLoader.hxx.

◆ fBatchSize

std::size_t TMVA::Experimental::Internal::RBatchLoader::fBatchSize
private

Definition at line 23 of file RBatchLoader.hxx.

◆ fCurrentBatch

std::unique_ptr<TMVA::Experimental::RTensor<float> > TMVA::Experimental::Internal::RBatchLoader::fCurrentBatch
private

Definition at line 35 of file RBatchLoader.hxx.

◆ fEmptyTensor

TMVA::Experimental::RTensor<float> TMVA::Experimental::Internal::RBatchLoader::fEmptyTensor = TMVA::Experimental::RTensor<float>({0})
private

Definition at line 39 of file RBatchLoader.hxx.

◆ fIsActive

bool TMVA::Experimental::Internal::RBatchLoader::fIsActive = false
private

Definition at line 27 of file RBatchLoader.hxx.

◆ fMaxBatches

std::size_t TMVA::Experimental::Internal::RBatchLoader::fMaxBatches
private

Definition at line 25 of file RBatchLoader.hxx.

◆ fNumColumns

std::size_t TMVA::Experimental::Internal::RBatchLoader::fNumColumns
private

Definition at line 24 of file RBatchLoader.hxx.

◆ fRng

TMVA::RandomGenerator<TRandom3> TMVA::Experimental::Internal::RBatchLoader::fRng = TMVA::RandomGenerator<TRandom3>(0)
private

Definition at line 28 of file RBatchLoader.hxx.

◆ fTrainingBatchQueue

std::queue<std::unique_ptr<TMVA::Experimental::RTensor<float> > > TMVA::Experimental::Internal::RBatchLoader::fTrainingBatchQueue
private

Definition at line 33 of file RBatchLoader.hxx.

◆ fValidationBatches

std::vector<std::unique_ptr<TMVA::Experimental::RTensor<float> > > TMVA::Experimental::Internal::RBatchLoader::fValidationBatches
private

Definition at line 34 of file RBatchLoader.hxx.

◆ fValidationIdx

std::size_t TMVA::Experimental::Internal::RBatchLoader::fValidationIdx = 0
private

Definition at line 37 of file RBatchLoader.hxx.

Libraries for TMVA::Experimental::Internal::RBatchLoader:

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