Belle II Software  release-08-01-10
FANNOptions Class Reference

Options for the FANN MVA method. More...

#include <FANN.h>

Inheritance diagram for FANNOptions:
Collaboration diagram for FANNOptions:

Public Member Functions

virtual void load (const boost::property_tree::ptree &pt) override
 Load mechanism to load Options from a xml tree. More...
 
virtual void save (boost::property_tree::ptree &pt) const override
 Save mechanism to store Options in a xml tree. More...
 
virtual po::options_description getDescription () override
 Returns a program options description for all available options.
 
virtual std::string getMethod () const override
 Return method name.
 
std::vector< unsigned int > getHiddenLayerNeurons (unsigned int nf) const
 Returns the internal vector parameter with the number of hidden neurons per layer. More...
 

Public Attributes

unsigned int m_max_epochs = 10000
 Maximum number of epochs.
 
bool m_verbose_mode = true
 Sets to report training status or not.
 
std::string m_hidden_layers_architecture = "3*N"
 String containing the architecture of hidden neurons. More...
 
std::string m_hidden_activiation_function = "FANN_SIGMOID_SYMMETRIC"
 Activation function in hidden layer.
 
std::string m_output_activiation_function = "FANN_SIGMOID_SYMMETRIC"
 Activation function in output layer.
 
std::string m_error_function = "FANN_ERRORFUNC_LINEAR"
 Loss function.
 
std::string m_training_method = "FANN_TRAIN_RPROP"
 Training method for back propagation.
 
double m_validation_fraction = 0.5
 Fraction of training sample used for validation in order to avoid overtraining.
 
unsigned int m_random_seeds
 Number of times the training is repeated with a new weight random seed. More...
 
unsigned int m_test_rate
 Error on validation is compared with the one before. More...
 
unsigned int m_number_of_threads = 8
 Number of threads for parallel training.
 
bool m_scale_features = true
 Scale features before training.
 
bool m_scale_target = true
 Scale target before training.
 

Detailed Description

Options for the FANN MVA method.

Definition at line 29 of file FANN.h.

Member Function Documentation

◆ getHiddenLayerNeurons()

std::vector< unsigned int > getHiddenLayerNeurons ( unsigned int  nf) const

Returns the internal vector parameter with the number of hidden neurons per layer.

Parameters
nfnumber of features (input nodes).

Definition at line 93 of file FANNOptions.cc.

94  {
95  std::vector<unsigned int> hiddenLayers;
96  std::stringstream iLayers(m_hidden_layers_architecture);
97  std::string layer;
98  while (std::getline(iLayers, layer, ',')) {
99  for (auto& character : layer) {
100  if (character == 'N') character = 'x';
101  }
102  auto* iLayerSize = new TFormula("iLayerSize", layer.c_str());
103  hiddenLayers.push_back(iLayerSize->Eval(nf));
104  }
105  return hiddenLayers;
106  }
std::string m_hidden_layers_architecture
String containing the architecture of hidden neurons.
Definition: FANN.h:62

◆ load()

void load ( const boost::property_tree::ptree &  pt)
overridevirtual

Load mechanism to load Options from a xml tree.

Parameters
ptxml tree

Implements Options.

Definition at line 21 of file FANNOptions.cc.

◆ save()

void save ( boost::property_tree::ptree &  pt) const
overridevirtual

Save mechanism to store Options in a xml tree.

Parameters
ptxml tree

Implements Options.

Definition at line 48 of file FANNOptions.cc.

Member Data Documentation

◆ m_hidden_layers_architecture

std::string m_hidden_layers_architecture = "3*N"

String containing the architecture of hidden neurons.

Ex. "3,3*N,3*(N-1)

Definition at line 62 of file FANN.h.

◆ m_random_seeds

unsigned int m_random_seeds
Initial value:
=
3

Number of times the training is repeated with a new weight random seed.

The one with the best result is saved.

Definition at line 70 of file FANN.h.

◆ m_test_rate

unsigned int m_test_rate
Initial value:
=
500

Error on validation is compared with the one before.

The number of epochs before is given by this parameter.

Definition at line 72 of file FANN.h.


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