SG++-Doxygen-Documentation
sgpp::datadriven::DataSourceBuilder Class Reference

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

#include <DataSourceBuilder.hpp>

Public Member Functions

DataSourceCrossValidationcrossValidationAssemble () const
 Based on the currently specified configuration, build and configure an instance of a data source object that is able to perform cross validation. More...
 
DataSourceCrossValidationcrossValidationFromConfig (const DataSourceConfig &config, const CrossvalidationConfiguration &crossValidationConfig)
 Factory method used to build an instance of a sgpp::datadriven::DataSourceCrossValidation object based on the passed configuration. More...
 
 DataSourceBuilder ()=default
 Default constructor. More...
 
DataSourceBuilderinBatches (size_t howMany)
 Optionally Specify the amount of batches if batch learning is used. More...
 
DataSourceSplittingsplittingAssemble () const
 Based on the currently specified configuration, build and configure an instance of a data source object. More...
 
DataSourceSplittingsplittingFromConfig (const DataSourceConfig &config)
 Factory method used to build an instance of a sgpp::datadriven::DataSourceSplitting object based on the passed configuration. 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

◆ DataSourceBuilder()

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

Default constructor.

Member Function Documentation

◆ crossValidationAssemble()

DataSourceCrossValidation * sgpp::datadriven::DataSourceBuilder::crossValidationAssemble ( ) const

Based on the currently specified configuration, build and configure an instance of a data source object that is able to perform cross validation.

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

References sgpp::datadriven::ARFF, sgpp::datadriven::DataShufflingFunctorFactory::buildDataShufflingFunctor(), sgpp::datadriven::CSV, sgpp::datadriven::DataSourceConfig::fileType, and sgpp::datadriven::DataSourceConfig::isCompressed.

Referenced by crossValidationFromConfig(), and main().

◆ crossValidationFromConfig()

DataSourceCrossValidation * sgpp::datadriven::DataSourceBuilder::crossValidationFromConfig ( const DataSourceConfig config,
const CrossvalidationConfiguration crossValidationConfig 
)

Factory method used to build an instance of a sgpp::datadriven::DataSourceCrossValidation object based on the passed configuration.

Parameters
configconfiguration for the data source instance
crossValidationConfigconfiguration for the cross validation
Returns
Fully configured instance of sgpp::datadriven::DataSourceCrossValidation object.

References crossValidationAssemble(), sgpp::datadriven::DataSourceConfig::filePath, sgpp::datadriven::DataSourceConfig::fileType, sgpp::datadriven::NONE, sgpp::datadriven::DataSourceFileTypeParser::parse(), sgpp::datadriven::StringTokenizer::tokenize(), create_dataset::type, withCompression(), and withFileType().

Referenced by sgpp::datadriven::MinerFactory::createDataSourceCrossValidation().

◆ inBatches()

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.

◆ splittingAssemble()

DataSourceSplitting * sgpp::datadriven::DataSourceBuilder::splittingAssemble ( ) const

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

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

References sgpp::datadriven::ARFF, sgpp::datadriven::DataShufflingFunctorFactory::buildDataShufflingFunctor(), sgpp::datadriven::CSV, sgpp::datadriven::DataSourceConfig::fileType, and sgpp::datadriven::DataSourceConfig::isCompressed.

Referenced by splittingFromConfig().

◆ splittingFromConfig()

DataSourceSplitting * sgpp::datadriven::DataSourceBuilder::splittingFromConfig ( const DataSourceConfig config)

Factory method used to build an instance of a sgpp::datadriven::DataSourceSplitting object based on the passed configuration.

Parameters
configconfiguration for the data source instance
Returns
Fully configured instance of sgpp::datadriven::DataSourceSplitting object.

References sgpp::datadriven::DataSourceConfig::fileType, sgpp::datadriven::NONE, and splittingAssemble().

Referenced by sgpp::datadriven::MinerFactory::createDataSourceSplitting().

◆ withBatchSize()

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.

◆ withCompression()

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 crossValidationFromConfig().

◆ withFileType()

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 crossValidationFromConfig().

◆ withPath()

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.

Referenced by main().


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