MeLOn
Loading...
Searching...
No Matches
melon::AnnParserCsv Class Reference

This class implements an specialization of the AnnParser for csv files. More...

#include <AnnParser.h>

Inheritance diagram for melon::AnnParserCsv:
melon::AnnParser melon::ModelParser

Public Member Functions

std::shared_ptr< ModelDataparse_model (const std::string modelPath, const std::string modelName)
 Parsing function which is used to get the ANN data from a csv file.
 
- Public Member Functions inherited from melon::ModelParser
virtual ~ModelParser ()=default
 Virtual desctructor to enable inheritance.
 

Private Member Functions

std::vector< std::vector< std::string > > _csv_to_string_matrix (std::string fileName)
 Parses the content of an csv file into a string matrix.
 
std::vector< std::vector< double > > _csv_to_double_matrix (std::string fileName)
 Parses the content of an csv file into a double matrix.
 
void _parse_config_file (AnnStructure &structure)
 Parses the configuration csv file.
 
void _parse_scalers (std::shared_ptr< ScalerData > inputScalerData, std::shared_ptr< ScalerData > outputScalerData, const AnnStructure &structure)
 Parses the input and output scalers.
 
void _parse_bias_weights (const AnnStructure &structure, AnnWeights &weights)
 Parses the bias weights.
 
void _parse_layer_weights (const AnnStructure &structure, AnnWeights &weights)
 Parses the layer weights.
 
void _parse_input_weights (const AnnStructure &structure, AnnWeights &weights)
 Parses the input weights.
 
bool _check_if_layer_indicator (int number)
 Checks if passed number is a layer indicator.
 
int _get_layer_index_from_indicator (int indicator)
 Extracts layer index from a layer indicator.
 

Private Attributes

const int LAYER_INDICATOR_BASE = 900
 

Additional Inherited Members

- Protected Member Functions inherited from melon::AnnParser
ACTIVATION_FUNCTION _string_to_activation_function (const std::string &activationFunctionName)
 Turns a string containing the name of an activation function in the correct enum representation.
 
- Protected Member Functions inherited from melon::ModelParser
std::string _format_file_path (const std::string modelPath, const std::string modelName, const MODEL_FILE_TYPE fileType)
 Applies the correct format to the path given by the user.
 
std::string _format_folder_path (const std::string modelPath)
 Applies the correct format to the path given by the user.
 
- Static Protected Member Functions inherited from melon::ModelParser
static SCALER_TYPE _string_to_scaler_type (const std::string scalerTypeName)
 Turns a string containing the name of an scaler type in the correct enum representation.
 
static SCALER_PARAMETER _string_to_scaler_parameter (const std::string scalerParameterName)
 Turns a string containing the name of an scaler type in the correct enum representation.
 
- Protected Attributes inherited from melon::ModelParser
std::string _modelPath
 
std::string _modelName
 

Detailed Description

This class implements an specialization of the AnnParser for csv files.

This abstarct class is used to implement an ANN file parser for csv files based on the interface provided by AnnParser.

Member Function Documentation

◆ _check_if_layer_indicator()

bool AnnParserCsv::_check_if_layer_indicator ( int number)
private

Checks if passed number is a layer indicator.

Parameters
[in]numberNumber to be checked
Returns
true if number is an layer indicator, otherwise false is returned

◆ _csv_to_double_matrix()

std::vector< std::vector< double > > AnnParserCsv::_csv_to_double_matrix ( std::string fileName)
private

Parses the content of an csv file into a double matrix.

Parameters
[in]fileNamename of the the csv file that should be parsed
Returns
returns a 2d vector(double) containing the data from the csv file

◆ _csv_to_string_matrix()

std::vector< std::vector< std::string > > AnnParserCsv::_csv_to_string_matrix ( std::string fileName)
private

Parses the content of an csv file into a string matrix.

Parameters
[in]fileNamename of the the csv file that should be parsed
Returns
returns a 2d vector(string) containing the data from the csv file

◆ _get_layer_index_from_indicator()

int AnnParserCsv::_get_layer_index_from_indicator ( int indicator)
private

Extracts layer index from a layer indicator.

Parameters
[in]indicatorIndicator from which the layer index should get
Returns
Layer index

◆ _parse_bias_weights()

void AnnParserCsv::_parse_bias_weights ( const AnnStructure & structure,
AnnWeights & weights )
private

Parses the bias weights.

Parameters
[in]structurestruct containing the information regarding the anns structure
[out]weightsstruct containing the anns weights

◆ _parse_config_file()

void AnnParserCsv::_parse_config_file ( AnnStructure & structure)
private

Parses the configuration csv file.

Parameters
[out]structurestruct containing the information regarding the anns structure

◆ _parse_input_weights()

void AnnParserCsv::_parse_input_weights ( const AnnStructure & structure,
AnnWeights & weights )
private

Parses the input weights.

Parameters
[in]structurestruct containing the information regarding the anns structure
[out]weightsstruct containing the anns weights

◆ _parse_layer_weights()

void AnnParserCsv::_parse_layer_weights ( const AnnStructure & structure,
AnnWeights & weights )
private

Parses the layer weights.

Parameters
[in]structurestruct containing the information regarding the anns structure
[out]weightsstruct containing the anns weights

◆ _parse_scalers()

void AnnParserCsv::_parse_scalers ( std::shared_ptr< ScalerData > inputScalerData,
std::shared_ptr< ScalerData > outputScalerData,
const AnnStructure & structure )
private

Parses the input and output scalers.

Parameters
[out]inputScalerDatastruct containing the parameters used for input sclaing
[out]outputScalerDatastruct containing the parameters used for output scaling
[in]structurestruct containing the information regarding the anns structure

◆ parse_model()

std::shared_ptr< ModelData > AnnParserCsv::parse_model ( const std::string modelPath,
const std::string modelName )
virtual

Parsing function which is used to get the ANN data from a csv file.

Parameters
[in]modelPathPath to the location of the ANN file
[in]modelNamename of the network (either foldername in which csv files are stored)
Returns
returns modelData struct containing the information defining the ann

Implements melon::AnnParser.

Member Data Documentation

◆ LAYER_INDICATOR_BASE

const int melon::AnnParserCsv::LAYER_INDICATOR_BASE = 900
private

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