SG++-Doxygen-Documentation
sgpp::datadriven::DataSource Class Referenceabstract

DataSource is a high level, easy to use interface for accessing data provided by a all kinds of sgpp::datadriven::SampleProvider. More...

#include <DataSource.hpp>

Inheritance diagram for sgpp::datadriven::DataSource:
sgpp::datadriven::DataSourceCrossValidation sgpp::datadriven::DataSourceSplitting

Public Member Functions

DataSourceIterator begin ()
 Return an iterator object pointing to the first batch of this DataSource. More...
 
 DataSource (DataSourceConfig config, SampleProvider *sampleProvider)
 Constructor. More...
 
DataSourceIterator end ()
 Return an iterator object pointing to the last possible batch of this DataSource. More...
 
const DataSourceConfiggetConfig () const
 Read only access to the configuration used by DataSource and underlying SampleProvider. More...
 
size_t getCurrentIteration () const
 Return how many batches have already been requested from this DataSource. More...
 
virtual DatasetgetNextSamples ()
 Request data from the underlying SampleProvider as specified in the provided configuration object upon construction. More...
 
virtual DatasetgetValidationData ()=0
 Returns the data that is used for validation. More...
 
virtual ~DataSource ()=default
 

Protected Attributes

DataSourceConfig config
 Configuration file that determines all relevant properties of the object. More...
 
size_t currentIteration
 counter variable if data is requested in batches. More...
 
DataTransformationdataTransformation
 pointer to DataTransformation to perform transformations on init. More...
 
std::unique_ptr< SampleProvidersampleProvider
 pointer to sample provider that actually handles data aquisition. More...
 

Detailed Description

DataSource is a high level, easy to use interface for accessing data provided by a all kinds of sgpp::datadriven::SampleProvider.

Should be used by end users.

Constructor & Destructor Documentation

sgpp::datadriven::DataSource::DataSource ( DataSourceConfig  config,
SampleProvider sampleProvider 
)

Constructor.

Parameters
configconfiguration object used for the data source
sampleProviderthe sample provider to operate on.

References sgpp::datadriven::DataTransformationBuilder::buildTransformation(), config, dataTransformation, sgpp::datadriven::DataSourceConfig::dataTransformationConfig, sgpp::datadriven::DataSourceConfig::filePath, and sampleProvider.

virtual sgpp::datadriven::DataSource::~DataSource ( )
virtualdefault

Member Function Documentation

DataSourceIterator sgpp::datadriven::DataSource::begin ( )

Return an iterator object pointing to the first batch of this DataSource.

Can be used to obtain new batches in batch learning scenarios as often as specified inside the configuration. Allows convenient range based for loops for batch learning.

Returns
iterator object pointing to the first batch.
DataSourceIterator sgpp::datadriven::DataSource::end ( )

Return an iterator object pointing to the last possible batch of this DataSource.

Required for range based for loops.

Returns
iterator object pointing to the last possible batch.

References config, and sgpp::datadriven::DataSourceConfig::numBatches.

const DataSourceConfig & sgpp::datadriven::DataSource::getConfig ( ) const

Read only access to the configuration used by DataSource and underlying SampleProvider.

Returns
Current configuration object.

References config.

size_t sgpp::datadriven::DataSource::getCurrentIteration ( ) const

Return how many batches have already been requested from this DataSource.

Required for range based for loops using the DataSourceIterator.

Returns
the amount of batches that have already been requested.

References currentIteration.

virtual Dataset* sgpp::datadriven::DataSource::getValidationData ( )
pure virtual

Returns the data that is used for validation.

Returns
pointer to the validation dataset

Implemented in sgpp::datadriven::DataSourceCrossValidation, and sgpp::datadriven::DataSourceSplitting.

Member Data Documentation

DataSourceConfig sgpp::datadriven::DataSource::config
protected

Configuration file that determines all relevant properties of the object.

Referenced by DataSource(), sgpp::datadriven::DataSourceSplitting::DataSourceSplitting(), end(), getConfig(), getNextSamples(), and sgpp::datadriven::DataSourceSplitting::reset().

size_t sgpp::datadriven::DataSource::currentIteration
protected

counter variable if data is requested in batches.

Referenced by getCurrentIteration(), and getNextSamples().

DataTransformation* sgpp::datadriven::DataSource::dataTransformation
protected

pointer to DataTransformation to perform transformations on init.

Referenced by DataSource(), and getNextSamples().

std::unique_ptr<SampleProvider> sgpp::datadriven::DataSource::sampleProvider
protected

pointer to sample provider that actually handles data aquisition.

Referenced by DataSource(), and getNextSamples().


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