SG++
sgpp::datadriven::DataSourceBuilder Class Reference

Generate an instance of sgpp::datadriven::DataSource using the Builder Pattern. More...

#include <DataSourceBuilder.hpp>

Public Member Functions

DataSourceassemble () const
 Based on the currently specified configuration, build and configure an instance of a data source object. More...
 
 DataSourceBuilder ()=default
 Default constructor. More...
 
DataSourcefromConfig (const DataSourceConfig &config)
 Factory method used to build an instance of a sgpp::datadriven::DataSource object based on the passed configuration. More...
 
DataSourceBuilderinBatches (size_t howMany)
 Optionally Specify the amount of batches if batch learning is used. More...
 
DataSourceBuilderwithBatchSize (size_t batchSize)
 Optionally Specify the batch size if batch learning is used. More...
 
DataSourceBuilderwithCompression (bool isCompressed)
 Optionally Specify if the file used is gz compressed. More...
 
DataSourceBuilderwithFileType (DataSourceFileType fileType)
 Optionally Specify the file type if files are used. More...
 
DataSourceBuilderwithPath (const std::string &filePath)
 Optionally specify a valid path to a file that should be read if files are used. More...
 

Detailed Description

Generate an instance of sgpp::datadriven::DataSource using the Builder Pattern.

Constructor & Destructor Documentation

sgpp::datadriven::DataSourceBuilder::DataSourceBuilder ( )
default

Default constructor.

Member Function Documentation

DataSource * sgpp::datadriven::DataSourceBuilder::assemble ( ) const

Based on the currently specified configuration, build and configure an instance of a data source object.

Returns
Fully configured instance of sgpp::datadriven::DataSource object.

References sgpp::datadriven::ARFF, sgpp::datadriven::CSV, sgpp::datadriven::DataSourceConfig::fileType, and sgpp::datadriven::DataSourceConfig::isCompressed.

Referenced by fromConfig().

DataSourceBuilder & sgpp::datadriven::DataSourceBuilder::inBatches ( size_t  howMany)

Optionally Specify the amount of batches if batch learning is used.

If no batch learning is used, all data is returned as a single batch (same as howMany=1).

Parameters
howManyamount of batches used in batch learning scenario.
Returns
Reference to this object, used for chaining.

References sgpp::datadriven::DataSourceConfig::numBatches.

DataSourceBuilder & sgpp::datadriven::DataSourceBuilder::withBatchSize ( size_t  batchSize)

Optionally Specify the batch size if batch learning is used.

If no batch learning is used this value defaults to 0 (all samples).

Parameters
batchSizesize of batches used in batch learning scenario.
Returns
Reference to this object, used for chaining.

References sgpp::datadriven::DataSourceConfig::batchSize.

DataSourceBuilder & sgpp::datadriven::DataSourceBuilder::withCompression ( bool  isCompressed)

Optionally Specify if the file used is gz compressed.

If data source does not use any files, this is set to false by default.

Parameters
isCompressedtrue if the file is compressed, false otherwise.
Returns
Reference to this object, used for chaining.

References sgpp::datadriven::DataSourceConfig::isCompressed.

Referenced by fromConfig().

DataSourceBuilder & sgpp::datadriven::DataSourceBuilder::withFileType ( DataSourceFileType  fileType)

Optionally Specify the file type if files are used.

If data source does not use any files, this is set to none by default.

Parameters
fileTypevalue of
Returns
Reference to this object, used for chaining.

References sgpp::datadriven::DataSourceConfig::fileType.

Referenced by fromConfig().

DataSourceBuilder & sgpp::datadriven::DataSourceBuilder::withPath ( const std::string &  filePath)

Optionally specify a valid path to a file that should be read if files are used.

Parameters
filePathvalid path to a file that should be read by the data source.
Returns
Reference to this object, used for chaining.

References sgpp::datadriven::DataSourceConfig::filePath, sgpp::datadriven::DataSourceConfig::fileType, and sgpp::datadriven::NONE.


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