SG++
sgpp::datadriven::DataSource Class Reference

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>

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...
 
DatasetgetNextSamples ()
 Request data from the underlying SampleProvider as specified in the provided configuration object upon construction. 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::DataSourceConfig::filePath.

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 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.
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.
Dataset * sgpp::datadriven::DataSource::getNextSamples ( )

Request data from the underlying SampleProvider as specified in the provided configuration object upon construction.

Returns
sgpp::datadriven::Dataset containing requested amount of samples (if available).

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

Referenced by sgpp::datadriven::DataSourceIterator::operator*().


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