OpenNN  2.2
Open Neural Networks Library
Public Member Functions | Protected Attributes | List of all members
OpenNN::NeuralNetwork Class Reference

#include <neural_network.h>

Public Member Functions

 NeuralNetwork (void)
 
 NeuralNetwork (const MultilayerPerceptron &)
 
 NeuralNetwork (const Vector< size_t > &)
 
 NeuralNetwork (const size_t &, const size_t &)
 
 NeuralNetwork (const size_t &, const size_t &, const size_t &)
 
 NeuralNetwork (const size_t &)
 
 NeuralNetwork (const std::string &)
 
 NeuralNetwork (const tinyxml2::XMLDocument &)
 
 NeuralNetwork (const NeuralNetwork &)
 
virtual ~NeuralNetwork (void)
 
NeuralNetworkoperator= (const NeuralNetwork &)
 
bool operator== (const NeuralNetwork &) const
 
bool has_multilayer_perceptron (void) const
 
bool has_inputs (void) const
 
bool has_outputs (void) const
 
bool has_scaling_layer (void) const
 
bool has_principal_components_layer (void) const
 
bool has_unscaling_layer (void) const
 
bool has_bounding_layer (void) const
 
bool has_probabilistic_layer (void) const
 
bool has_conditions_layer (void) const
 
bool has_independent_parameters (void) const
 
MultilayerPerceptronget_multilayer_perceptron_pointer (void) const
 
Inputsget_inputs_pointer (void) const
 
Outputsget_outputs_pointer (void) const
 
ScalingLayerget_scaling_layer_pointer (void) const
 
PrincipalComponentsLayerget_principal_components_layer_pointer (void) const
 
UnscalingLayerget_unscaling_layer_pointer (void) const
 
BoundingLayerget_bounding_layer_pointer (void) const
 
ProbabilisticLayerget_probabilistic_layer_pointer (void) const
 
ConditionsLayerget_conditions_layer_pointer (void) const
 
IndependentParametersget_independent_parameters_pointer (void) const
 
const bool & get_display (void) const
 
void set (void)
 
void set (const MultilayerPerceptron &)
 
void set (const Vector< size_t > &)
 
void set (const size_t &, const size_t &)
 
void set (const size_t &, const size_t &, const size_t &)
 
void set (const size_t &)
 
void set (const std::string &)
 
void set (const NeuralNetwork &)
 
virtual void set_default (void)
 
void set_multilayer_perceptron_pointer (MultilayerPerceptron *)
 
void set_scaling_layer_pointer (ScalingLayer *)
 
void set_principal_components_layer_pointer (PrincipalComponentsLayer *)
 
void set_unscaling_layer_pointer (UnscalingLayer *)
 
void set_bounding_layer_pointer (BoundingLayer *)
 
void set_probabilistic_layer_pointer (ProbabilisticLayer *)
 
void set_conditions_layer_pointer (ConditionsLayer *)
 
void set_inputs_pointer (Inputs *)
 
void set_outputs_pointer (Outputs *)
 
void set_independent_parameters_pointer (IndependentParameters *)
 
void set_scaling_layer (ScalingLayer &)
 
void set_display (const bool &)
 
void grow_input (const Statistics< double > &new_statistics=Statistics< double >())
 
void prune_input (const size_t &)
 
void prune_output (const size_t &)
 
void resize_inputs_number (const size_t &)
 
void resize_outputs_number (const size_t &)
 
void construct_multilayer_perceptron (void)
 
void construct_scaling_layer (void)
 
void construct_principal_components_layer (void)
 
void construct_unscaling_layer (void)
 
void construct_bounding_layer (void)
 
void construct_probabilistic_layer (void)
 
void construct_conditions_layer (void)
 
void construct_inputs (void)
 
void construct_outputs (void)
 
void construct_independent_parameters (void)
 
void destruct_multilayer_perceptron (void)
 
void destruct_scaling_layer (void)
 
void destruct_unscaling_layer (void)
 
void destruct_bounding_layer (void)
 
void destruct_probabilistic_layer (void)
 
void destruct_conditions_layer (void)
 
void destruct_inputs (void)
 
void destruct_outputs (void)
 
void destruct_independent_parameters (void)
 
void delete_pointers (void)
 
void initialize_random (void)
 
size_t get_layers_number (void) const
 
size_t get_inputs_number (void) const
 
size_t get_outputs_number (void) const
 
Vector< size_t > arrange_architecture (void) const
 
size_t count_parameters_number (void) const
 
Vector< double > arrange_parameters (void) const
 
void set_parameters (const Vector< double > &)
 
void initialize_parameters (const double &)
 
void randomize_parameters_uniform (void)
 
void randomize_parameters_uniform (const double &, const double &)
 
void randomize_parameters_uniform (const Vector< double > &, const Vector< double > &)
 
void randomize_parameters_uniform (const Vector< Vector< double > > &)
 
void randomize_parameters_normal (void)
 
void randomize_parameters_normal (const double &, const double &)
 
void randomize_parameters_normal (const Vector< double > &, const Vector< double > &)
 
void randomize_parameters_normal (const Vector< Vector< double > > &)
 
double calculate_parameters_norm (void) const
 
Statistics< double > calculate_parameters_statistics (void) const
 
Histogram< double > calculate_parameters_histogram (const size_t &=10) const
 
void perturbate_parameters (const double &)
 
Vector< double > calculate_inputs_importance_parameters (const size_t &) const
 
Vector< double > calculate_outputs (const Vector< double > &) const
 
Matrix< double > calculate_Jacobian (const Vector< double > &) const
 
Vector< Matrix< double > > calculate_Hessian_form (const Vector< double > &) const
 
Matrix< double > calculate_directional_input_data (const size_t &, const Vector< double > &, const double &, const double &, const size_t &=101) const
 
Vector< double > calculate_outputs (const Vector< double > &, const Vector< double > &) const
 
Matrix< double > calculate_Jacobian (const Vector< double > &, const Vector< double > &) const
 
Vector< Matrix< double > > calculate_Hessian_form (const Vector< double > &, const Vector< double > &) const
 
Matrix< double > calculate_output_data (const Matrix< double > &) const
 
Matrix< double > calculate_output_data_missing_values (const Matrix< double > &) const
 
Vector< Matrix< double > > calculate_Jacobian_data (const Matrix< double > &) const
 
Vector< Histogram< double > > calculate_outputs_histograms (const size_t &=1000, const size_t &=10) const
 
Vector< Histogram< double > > calculate_outputs_histograms (const Matrix< double > &, const size_t &=10) const
 
std::string to_string (void) const
 
virtual tinyxml2::XMLDocument * to_XML (void) const
 
virtual void from_XML (const tinyxml2::XMLDocument &)
 
virtual void write_XML (tinyxml2::XMLPrinter &) const
 
void print (void) const
 
void save (const std::string &) const
 
void save_parameters (const std::string &) const
 
virtual void load (const std::string &)
 
void load_parameters (const std::string &)
 
void save_data (const std::string &) const
 
std::string write_expression (void) const
 
std::string write_expression_python (void) const
 
std::string write_expression_R (void) const
 
void save_expression (const std::string &)
 
void save_expression_python (const std::string &)
 
void save_expression_R (const std::string &)
 
tinyxml2::XMLDocument * to_PMML (void) const
 
void write_PMML (const std::string &) const
 
void from_PMML (const tinyxml2::XMLDocument &)
 

Protected Attributes

MultilayerPerceptronmultilayer_perceptron_pointer
 
ScalingLayerscaling_layer_pointer
 
PrincipalComponentsLayerprincipal_components_layer_pointer
 
UnscalingLayerunscaling_layer_pointer
 
BoundingLayerbounding_layer_pointer
 
ProbabilisticLayerprobabilistic_layer_pointer
 
ConditionsLayerconditions_layer_pointer
 
Inputsinputs_pointer
 
Outputsoutputs_pointer
 
IndependentParametersindependent_parameters_pointer
 
bool display
 

Detailed Description

This class represents the concept of neural network in the OpenNN library. A neural network here is defined as a multilayer perceptron extended with a scaling layer, an unscaling layer, a bounding layer, a probabilistic layer, a conditions layer and a set of independent parameters. This neural network is used to span a function space for the variational problem at hand.

Definition at line 63 of file neural_network.h.

Constructor & Destructor Documentation

◆ NeuralNetwork() [1/9]

OpenNN::NeuralNetwork::NeuralNetwork ( void  )
explicit

Default constructor. It creates an empty neural network object. All pointers in the object are initialized to NULL. The rest of members are initialized to their default values.

Definition at line 28 of file neural_network.cpp.

◆ NeuralNetwork() [2/9]

OpenNN::NeuralNetwork::NeuralNetwork ( const MultilayerPerceptron new_multilayer_perceptron)
explicit

Multilayer Perceptron constructor. It creates a neural network object from a given multilayer perceptron. The rest of pointers are initialized to NULL. This constructor also initializes the rest of class members to their default values.

Definition at line 51 of file neural_network.cpp.

◆ NeuralNetwork() [3/9]

OpenNN::NeuralNetwork::NeuralNetwork ( const Vector< size_t > &  new_multilayer_perceptron_architecture)
explicit

Multilayer perceptron architecture constructor. It creates a neural network object with a multilayer perceptron given by its architecture. This constructor allows an arbitrary deep learning architecture. The rest of pointers are initialized to NULL. This constructor also initializes the rest of class members to their default values.

Parameters
new_multilayer_perceptron_architectureVector with the number of inputs and the numbers of perceptrons in each layer. The size of this vector must be equal to one plus the number of layers.

Definition at line 85 of file neural_network.cpp.

◆ NeuralNetwork() [4/9]

OpenNN::NeuralNetwork::NeuralNetwork ( const size_t &  new_inputs_number,
const size_t &  new_perceptrons_number 
)
explicit

One layer constructor. It creates a one-layer perceptron object. The number of independent parameters is set to zero. The multilayer perceptron parameters are initialized at random.

Parameters
new_inputs_numberNumber of inputs in the layer.
new_perceptrons_numberNumber of perceptrons in the layer.

Definition at line 118 of file neural_network.cpp.

◆ NeuralNetwork() [5/9]

OpenNN::NeuralNetwork::NeuralNetwork ( const size_t &  new_inputs_number,
const size_t &  new_hidden_perceptrons_number,
const size_t &  new_output_perceptrons_number 
)
explicit

Two layers constructor. It creates a neural network object with a two layers perceptron. The rest of pointers of this object are initialized to NULL. The other members are initialized to their default values.

Parameters
new_inputs_numberNumber of inputs in the multilayer perceptron
new_hidden_perceptrons_numberNumber of neurons in the hidden layer of the multilayer perceptron
new_output_perceptrons_numberNumber of outputs neurons.

Definition at line 152 of file neural_network.cpp.

◆ NeuralNetwork() [6/9]

OpenNN::NeuralNetwork::NeuralNetwork ( const size_t &  new_independent_parameters_number)
explicit

Independent parameters constructor. It creates a neural network with only independent parameters. The independent parameters are initialized at random.

Parameters
new_independent_parameters_numberNumber of independent parameters associated to the multilayer perceptron

Definition at line 183 of file neural_network.cpp.

◆ NeuralNetwork() [7/9]

OpenNN::NeuralNetwork::NeuralNetwork ( const std::string &  file_name)
explicit

File constructor. It creates a neural network object by loading its members from an XML-type file. Please be careful with the format of that file, which is specified in the OpenNN manual.

Parameters
file_nameName of neural network file.

Definition at line 208 of file neural_network.cpp.

◆ NeuralNetwork() [8/9]

OpenNN::NeuralNetwork::NeuralNetwork ( const tinyxml2::XMLDocument &  document)
explicit

XML constructor. It creates a neural network object by loading its members from an XML document.

Parameters
documentTinyXML document containing the neural network data.

Definition at line 230 of file neural_network.cpp.

◆ NeuralNetwork() [9/9]

OpenNN::NeuralNetwork::NeuralNetwork ( const NeuralNetwork other_neural_network)

Copy constructor. It creates a copy of an existing neural network object.

Parameters
other_neural_networkNeural network object to be copied.

Definition at line 252 of file neural_network.cpp.

Member Function Documentation

◆ arrange_architecture()

Vector< size_t > OpenNN::NeuralNetwork::arrange_architecture ( void  ) const

Returns a vector with the architecture of the neural network. The elements of this vector are as follows;

  • Number of scaling neurons (if there is a scaling layer).
  • Number of principal components neurons (if there is a principal components layer).
  • Multilayer perceptron architecture (if there is a multilayer perceptron).
  • Number of conditions neurons (if there is a conditions layer).
  • Number of unscaling neurons (if there is an unscaling layer).
  • Number of probabilistic neurons (if there is a probabilistic layer).
  • Number of bounding neurons (if there is a bounding layer).

Definition at line 1407 of file neural_network.cpp.

◆ arrange_parameters()

Vector< double > OpenNN::NeuralNetwork::arrange_parameters ( void  ) const

Returns the values of the parameters in the multilayer perceptron as a single vector. This contains all the multilayer perceptron parameters (biases and synaptic weights) and preprocessed independent parameters.

Definition at line 1504 of file neural_network.cpp.

◆ calculate_directional_input_data()

Matrix< double > OpenNN::NeuralNetwork::calculate_directional_input_data ( const size_t &  direction,
const Vector< double > &  point,
const double &  minimum,
const double &  maximum,
const size_t &  points_number = 101 
) const

Calculates the input data which is necessary to compute the output data from the neural network in some direction.

Parameters
directionInput index (must be between 0 and number of inputs - 1).
pointInput point through the directional input passes.
minimumMinimum value of the input with the above index.
maximumMaximum value of the input with the above index.
points_numberNumber of points in the directional input data set.

Definition at line 2792 of file neural_network.cpp.

◆ calculate_Hessian_form() [1/2]

Vector< Matrix< double > > OpenNN::NeuralNetwork::calculate_Hessian_form ( const Vector< double > &  inputs) const

Returns the second partial derivatives of the outputs with respect to the inputs.

Todo:

Definition at line 3296 of file neural_network.cpp.

◆ calculate_Hessian_form() [2/2]

Vector< Matrix< double > > OpenNN::NeuralNetwork::calculate_Hessian_form ( const Vector< double > &  inputs,
const Vector< double > &  parameters 
) const

Returns the second partial derivatives of the outputs with respect to the neural network parameters.

Todo:

Definition at line 3307 of file neural_network.cpp.

◆ calculate_inputs_importance_parameters()

Vector< double > OpenNN::NeuralNetwork::calculate_inputs_importance_parameters ( const size_t &  output_index) const

Calculates the inputs importance for a neural network with only one hidden layer. Returns a vector containing the importance for each of the inputs with respect to a given output. The size of the vector is the number of inputs of the neural network.

Parameters
output_indexIndex of the output.

100.0

Definition at line 2553 of file neural_network.cpp.

◆ calculate_Jacobian() [1/2]

Matrix< double > OpenNN::NeuralNetwork::calculate_Jacobian ( const Vector< double > &  inputs) const

Returns the Jacobian Matrix of the neural network for a set of inputs, corresponding to the point in inputs space at which the Jacobian Matrix is to be found. It uses a forward-propagation method.

Parameters
inputsSet of inputs to the neural network.

Definition at line 3023 of file neural_network.cpp.

◆ calculate_Jacobian() [2/2]

Matrix< double > OpenNN::NeuralNetwork::calculate_Jacobian ( const Vector< double > &  inputs,
const Vector< double > &  parameters 
) const

Returns the partial derivatives of the outputs with respect to a given set of parameters.

Todo:

Definition at line 3285 of file neural_network.cpp.

◆ calculate_Jacobian_data()

Vector< Matrix< double > > OpenNN::NeuralNetwork::calculate_Jacobian_data ( const Matrix< double > &  input_data) const

Calculates a set of Jacobians from the neural network in response to a set of inputs. The format is a vector of matrices, where each element is the Jacobian matrix for a single input.

Parameters
input_dataMatrix of inputs to the neural network.

Definition at line 3183 of file neural_network.cpp.

◆ calculate_output_data()

Matrix< double > OpenNN::NeuralNetwork::calculate_output_data ( const Matrix< double > &  input_data) const

Calculates a set of outputs from the neural network in response to a set of inputs. The format is a matrix, where each row contains the output for a single input.

Parameters
input_dataMatrix of inputs to the neural network.

Definition at line 2924 of file neural_network.cpp.

◆ calculate_output_data_missing_values()

Matrix< double > OpenNN::NeuralNetwork::calculate_output_data_missing_values ( const Matrix< double > &  input_data) const

Calculates a set of outputs from the neural network in response to a set of inputs containing missing values. The format is a matrix, where each row contains the output for a single input.

Parameters
input_dataMatrix of inputs to the neural network.

Definition at line 2974 of file neural_network.cpp.

◆ calculate_outputs() [1/2]

Vector< double > OpenNN::NeuralNetwork::calculate_outputs ( const Vector< double > &  inputs) const

Calculates the outputs vector from the multilayer perceptron in response to an inputs vector. The activity for that is the following:

  • Check inputs range.
  • Calculate scaled inputs.
  • Calculate forward propagation.
  • Calculate unscaled outputs.
  • Apply boundary condtions.
  • Calculate bounded outputs.
Parameters
inputsSet of inputs to the neural network.

Definition at line 2702 of file neural_network.cpp.

◆ calculate_outputs() [2/2]

Vector< double > OpenNN::NeuralNetwork::calculate_outputs ( const Vector< double > &  inputs,
const Vector< double > &  parameters 
) const

Returns which would be the outputs for a given inputs and a set of parameters.

Parameters
inputsVector of inputs to the neural network.
parametersVector of potential parameters of the neural network.

Definition at line 2823 of file neural_network.cpp.

◆ calculate_outputs_histograms() [1/2]

Vector< Histogram< double > > OpenNN::NeuralNetwork::calculate_outputs_histograms ( const size_t &  points_number = 1000,
const size_t &  bins_number = 10 
) const

Calculates the histogram of the outputs with random inputs.

Parameters
points_numberNumber of random instances to evaluate the neural network.
bins_numberNumber of bins for the histograms.

Definition at line 3209 of file neural_network.cpp.

◆ calculate_outputs_histograms() [2/2]

Vector< Histogram< double > > OpenNN::NeuralNetwork::calculate_outputs_histograms ( const Matrix< double > &  input_data,
const size_t &  bins_number = 10 
) const

Calculates the histogram of the outputs with a matrix of given inputs.

Parameters
input_dataMatrix of the data to evaluate the neural network.
bins_numberNumber of bins for the histograms.

Definition at line 3271 of file neural_network.cpp.

◆ calculate_parameters_histogram()

Histogram< double > OpenNN::NeuralNetwork::calculate_parameters_histogram ( const size_t &  bins_number = 10) const

Returns a histogram structure of the parameters vector. That will be used for looking at the distribution of the parameters.

Parameters
bins_numberNumber of bins in the histogram (10 by default).

Definition at line 2505 of file neural_network.cpp.

◆ calculate_parameters_statistics()

Statistics< double > OpenNN::NeuralNetwork::calculate_parameters_statistics ( void  ) const

Returns a statistics structure of the parameters vector. That contains the minimum, maximum, mean and standard deviation values of the parameters.

Definition at line 2491 of file neural_network.cpp.

◆ construct_bounding_layer()

void OpenNN::NeuralNetwork::construct_bounding_layer ( void  )

This method constructs a bounding layer within the neural network. The size of the bounding layer is the number of outputs in the multilayer perceptron.

Definition at line 1729 of file neural_network.cpp.

◆ construct_conditions_layer()

void OpenNN::NeuralNetwork::construct_conditions_layer ( void  )

This method constructs a conditions layer within the neural network. The number of external inputs in the conditions layer is the number of inputs in the multilayer perceptron. The size fo the conditions layer is the number of outputs in the multilayer perceptron.

Definition at line 1772 of file neural_network.cpp.

◆ construct_independent_parameters()

void OpenNN::NeuralNetwork::construct_independent_parameters ( void  )

This method constructs an independent parameters object within the neural network. It sets the number of parameters to zero.

Definition at line 1837 of file neural_network.cpp.

◆ construct_inputs()

void OpenNN::NeuralNetwork::construct_inputs ( void  )

This method constructs an inputs object within the neural network. The number of inputs is the number of inputs in the multilayer perceptron.

Definition at line 1795 of file neural_network.cpp.

◆ construct_outputs()

void OpenNN::NeuralNetwork::construct_outputs ( void  )

This method constructs an outputs object within the neural network. The number of outputs is the number of outputs in the multilayer perceptron.

Definition at line 1816 of file neural_network.cpp.

◆ construct_principal_components_layer()

void OpenNN::NeuralNetwork::construct_principal_components_layer ( void  )

This method constructs a principal_components layer within the neural network. The size of the principal components layer is the number of inputs in the multilayer perceptron.

Definition at line 1686 of file neural_network.cpp.

◆ construct_probabilistic_layer()

void OpenNN::NeuralNetwork::construct_probabilistic_layer ( void  )

This method constructs a probabilistic layer within the neural network. The size of the probabilistic layer is the number of outputs in the multilayer perceptron.

Definition at line 1750 of file neural_network.cpp.

◆ construct_scaling_layer()

void OpenNN::NeuralNetwork::construct_scaling_layer ( void  )

This method constructs a scaling layer within the neural network. The size of the scaling layer is the number of inputs in the multilayer perceptron.

Definition at line 1665 of file neural_network.cpp.

◆ construct_unscaling_layer()

void OpenNN::NeuralNetwork::construct_unscaling_layer ( void  )

This method constructs an unscaling layer within the neural network. The size of the unscaling layer is the number of outputs in the multilayer perceptron.

Definition at line 1708 of file neural_network.cpp.

◆ count_parameters_number()

size_t OpenNN::NeuralNetwork::count_parameters_number ( void  ) const

Returns the number of parameters in the multilayer perceptron The number of parameters is the sum of all the multilayer perceptron parameters (biases and synaptic weights) and independent parameters.

Definition at line 1481 of file neural_network.cpp.

◆ delete_pointers()

void OpenNN::NeuralNetwork::delete_pointers ( void  )

This method deletes all the pointers composing the neural network:

  • Inputs.
  • Outputs.
  • Multilayer perceptron.
  • Scaling layer.
  • Unscaling layer.
  • Bounding layer.
  • Probabilistic layer.
  • Conditions layer.
  • Independent parameters.

Definition at line 1621 of file neural_network.cpp.

◆ from_XML()

void OpenNN::NeuralNetwork::from_XML ( const tinyxml2::XMLDocument &  document)
virtual

Deserializes a TinyXML document into this neural network object.

Parameters
documentXML document containing the member data.

Definition at line 4777 of file neural_network.cpp.

◆ get_display()

const bool & OpenNN::NeuralNetwork::get_display ( void  ) const

Returns true if messages from this class are to be displayed on the screen, or false if messages from this class are not to be displayed on the screen.

Definition at line 791 of file neural_network.cpp.

◆ get_layers_number()

size_t OpenNN::NeuralNetwork::get_layers_number ( void  ) const

Returns the number of layers in the neural network. That includes perceptron, scaling, unscaling, bounding, probabilistic or conditions layers.

Definition at line 2239 of file neural_network.cpp.

◆ grow_input()

void OpenNN::NeuralNetwork::grow_input ( const Statistics< double > &  new_statistics = Statistics<double>())

Add an input to the neural network and asociate the statistics to this input.

Parameters
new_statisticsValues of the statistics of the new input. The default value is an empty vector.

Definition at line 2097 of file neural_network.cpp.

◆ has_bounding_layer()

bool OpenNN::NeuralNetwork::has_bounding_layer ( void  ) const

Returns true if the neural network object has a bounding layer object inside, and false otherwise.

Definition at line 470 of file neural_network.cpp.

◆ has_conditions_layer()

bool OpenNN::NeuralNetwork::has_conditions_layer ( void  ) const

Returns true if the neural network object has a conditions layer object inside, and false otherwise.

Definition at line 506 of file neural_network.cpp.

◆ has_independent_parameters()

bool OpenNN::NeuralNetwork::has_independent_parameters ( void  ) const

Returns true if the neural network object has an independent parameters object inside, and false otherwise.

Definition at line 524 of file neural_network.cpp.

◆ has_inputs()

bool OpenNN::NeuralNetwork::has_inputs ( void  ) const

Returns true if the neural network object has an inputs object inside, and false otherwise.

Definition at line 379 of file neural_network.cpp.

◆ has_multilayer_perceptron()

bool OpenNN::NeuralNetwork::has_multilayer_perceptron ( void  ) const

Returns true if the neural network object has a multilayer perceptron object inside, and false otherwise.

Definition at line 361 of file neural_network.cpp.

◆ has_outputs()

bool OpenNN::NeuralNetwork::has_outputs ( void  ) const

Returns true if the neural network object has an outputs object inside, and false otherwise.

Definition at line 397 of file neural_network.cpp.

◆ has_principal_components_layer()

bool OpenNN::NeuralNetwork::has_principal_components_layer ( void  ) const

Returns true if the neural network object has a principal components layer object inside, and false otherwise.

Definition at line 433 of file neural_network.cpp.

◆ has_probabilistic_layer()

bool OpenNN::NeuralNetwork::has_probabilistic_layer ( void  ) const

Returns true if the neural network object has a probabilistic layer object inside, and false otherwise.

Definition at line 488 of file neural_network.cpp.

◆ has_scaling_layer()

bool OpenNN::NeuralNetwork::has_scaling_layer ( void  ) const

Returns true if the neural network object has a scaling layer object inside, and false otherwise.

Definition at line 415 of file neural_network.cpp.

◆ has_unscaling_layer()

bool OpenNN::NeuralNetwork::has_unscaling_layer ( void  ) const

Returns true if the neural network object has an unscaling layer object inside, and false otherwise.

Definition at line 452 of file neural_network.cpp.

◆ initialize_random()

void OpenNN::NeuralNetwork::initialize_random ( void  )

Initializes the neural network at random. This is useful for testing purposes.

Definition at line 1959 of file neural_network.cpp.

◆ load()

void OpenNN::NeuralNetwork::load ( const std::string &  file_name)
virtual

Loads from a XML file the members for this neural network object. Please mind about the file format, which is specified in the User's Guide.

Parameters
file_nameName of neural network XML file.

Definition at line 5097 of file neural_network.cpp.

◆ load_parameters()

void OpenNN::NeuralNetwork::load_parameters ( const std::string &  file_name)

Loads the multilayer perceptron parameters from a data file. The format of this file is just a sequence of numbers.

Parameters
file_nameName of parameters data file.

Definition at line 5124 of file neural_network.cpp.

◆ operator=()

NeuralNetwork & OpenNN::NeuralNetwork::operator= ( const NeuralNetwork other_neural_network)

Assignment operator. It assigns to this object the members of an existing neural network object.

Parameters
other_neural_networkNeural network object to be assigned.

Definition at line 293 of file neural_network.cpp.

◆ operator==()

bool OpenNN::NeuralNetwork::operator== ( const NeuralNetwork other_neural_network) const

Equal to operator.

Parameters
other_neural_networkNeural network object to be compared with.

Definition at line 331 of file neural_network.cpp.

◆ perturbate_parameters()

void OpenNN::NeuralNetwork::perturbate_parameters ( const double &  perturbation)

Perturbate parameters of the multilayer perceptron.

Parameters
perturbationMaximum distance of perturbation.

Definition at line 2517 of file neural_network.cpp.

◆ prune_input()

void OpenNN::NeuralNetwork::prune_input ( const size_t &  index)

Removes a given input to the neural network. This involves removing the input itself and the corresponding scaling layer, conditions layer and multilayer perceptron inputs.

Parameters
indexIndex of input to be pruned.

Definition at line 2134 of file neural_network.cpp.

◆ prune_output()

void OpenNN::NeuralNetwork::prune_output ( const size_t &  index)

Removes a given output from the neural network. This involves removing the output itself and the corresponding unscaling layer, conditions layer, probabilistic layer, bounding layer and multilayer perceptron outputs.

Parameters
indexIndex of output to be pruned.

Definition at line 2172 of file neural_network.cpp.

◆ randomize_parameters_normal() [1/4]

void OpenNN::NeuralNetwork::randomize_parameters_normal ( void  )

Initializes all the parameters in the neural newtork (biases and synaptic weiths + independent parameters) at random with values chosen from a normal distribution with mean 0 and standard deviation 1.

Definition at line 2390 of file neural_network.cpp.

◆ randomize_parameters_normal() [2/4]

void OpenNN::NeuralNetwork::randomize_parameters_normal ( const double &  mean,
const double &  standard_deviation 
)

Initializes all the parameters in the newtork (biases and synaptic weiths + independent parameters) at random with values chosen from a normal distribution with a given mean and a given standard deviation.

Parameters
meanMean of normal distribution.
standard_deviationStandard deviation of normal distribution.

Definition at line 2412 of file neural_network.cpp.

◆ randomize_parameters_normal() [3/4]

void OpenNN::NeuralNetwork::randomize_parameters_normal ( const Vector< double > &  mean,
const Vector< double > &  standard_deviation 
)

Initializes all the parameters in the neural newtork (biases and synaptic weiths + independent parameters) at random with values chosen from normal distributions with a given mean and a given standard deviation for each parameter.

Parameters
meanVector of minimum initialization values.
standard_deviationVector of maximum initialization values.

Definition at line 2434 of file neural_network.cpp.

◆ randomize_parameters_normal() [4/4]

void OpenNN::NeuralNetwork::randomize_parameters_normal ( const Vector< Vector< double > > &  mean_standard_deviation)

Initializes all the parameters in the newtork (biases and synaptic weiths + independent parameters) at random with values chosen from normal distributions with a given mean and a given standard deviation for each parameter. All mean and standard deviation values are given from a vector of two real vectors. The first element must contain the mean value for each parameter. The second element must contain the standard deviation value for each parameter.

Parameters
mean_standard_deviationMean and standard deviation vectors.

Definition at line 2458 of file neural_network.cpp.

◆ randomize_parameters_uniform() [1/4]

void OpenNN::NeuralNetwork::randomize_parameters_uniform ( void  )

Initializes all the parameters in the newtork (biases and synaptic weiths + independent parameters) at random with values comprised between -1 and +1.

Definition at line 2305 of file neural_network.cpp.

◆ randomize_parameters_uniform() [2/4]

void OpenNN::NeuralNetwork::randomize_parameters_uniform ( const double &  minimum,
const double &  maximum 
)

Initializes all the parameters in the newtork (biases and synaptic weiths + independent parameters) at random with values comprised between a given minimum and a given maximum values.

Parameters
minimumMinimum initialization value.
maximumMaximum initialization value.

Definition at line 2326 of file neural_network.cpp.

◆ randomize_parameters_uniform() [3/4]

void OpenNN::NeuralNetwork::randomize_parameters_uniform ( const Vector< double > &  minimum,
const Vector< double > &  maximum 
)

Initializes all the parameters in the newtork (biases and synaptic weiths + independent parameters) at random with values comprised between a different minimum and maximum numbers for each free parameter.

Parameters
minimumVector of minimum initialization values.
maximumVector of maximum initialization values.

Definition at line 2348 of file neural_network.cpp.

◆ randomize_parameters_uniform() [4/4]

void OpenNN::NeuralNetwork::randomize_parameters_uniform ( const Vector< Vector< double > > &  minimum_maximum)

Initializes all the parameters in the newtork (biases and synaptic weiths + independent parameters) values comprised between a different minimum and maximum numbers for each parameter. Minimum and maximum initialization values are given from a vector of two real vectors. The first element must contain the minimum initialization value for each parameter. The second element must contain the maximum initialization value for each parameter.

Parameters
minimum_maximumVector of minimum and maximum initialization vectors.

Definition at line 2371 of file neural_network.cpp.

◆ resize_inputs_number()

void OpenNN::NeuralNetwork::resize_inputs_number ( const size_t &  )
Todo:

Definition at line 2217 of file neural_network.cpp.

◆ resize_outputs_number()

void OpenNN::NeuralNetwork::resize_outputs_number ( const size_t &  )
Todo:

Definition at line 2227 of file neural_network.cpp.

◆ save()

void OpenNN::NeuralNetwork::save ( const std::string &  file_name) const

Saves to a XML file the members of a neural network object.

Parameters
file_nameName of neural network XML file.

Definition at line 5051 of file neural_network.cpp.

◆ save_data()

void OpenNN::NeuralNetwork::save_data ( const std::string &  file_name) const

Saves a set of input-output values from the neural network to a data file.

Parameters
file_nameName of data file.

Definition at line 6218 of file neural_network.cpp.

◆ save_expression()

void OpenNN::NeuralNetwork::save_expression ( const std::string &  file_name)

Saves the mathematical expression represented by the neural network to a text file.

Parameters
file_nameName of expression text file.

Definition at line 6143 of file neural_network.cpp.

◆ save_expression_python()

void OpenNN::NeuralNetwork::save_expression_python ( const std::string &  file_name)

Saves the python function of the expression represented by the neural network to a text file.

Parameters
file_nameName of expression text file.

Definition at line 6168 of file neural_network.cpp.

◆ save_expression_R()

void OpenNN::NeuralNetwork::save_expression_R ( const std::string &  file_name)

Saves the R function of the expression represented by the neural network to a text file.

Parameters
file_nameName of expression text file.

Definition at line 6193 of file neural_network.cpp.

◆ save_parameters()

void OpenNN::NeuralNetwork::save_parameters ( const std::string &  file_name) const

Saves to a data file the parameters of a neural network object.

Parameters
file_nameName of parameters data file.

Definition at line 5066 of file neural_network.cpp.

◆ set() [1/8]

void OpenNN::NeuralNetwork::set ( void  )

This method deletes all the pointers in the neural network. It also sets the rest of members to their default values.

Definition at line 802 of file neural_network.cpp.

◆ set() [2/8]

void OpenNN::NeuralNetwork::set ( const MultilayerPerceptron new_multilayer_perceptron)

This method deletes all the pointers in the neural network and then constructs a copy of an exisiting multilayer perceptron. It also sets the rest of members to their default values.

Parameters
new_multilayer_perceptronMultilayer perceptron object to be copied.

Definition at line 816 of file neural_network.cpp.

◆ set() [3/8]

void OpenNN::NeuralNetwork::set ( const Vector< size_t > &  new_multilayer_perceptron_architecture)

Sets a new neural network with a given multilayer perceptron architecture. It also sets the rest of members to their default values.

Parameters
new_multilayer_perceptron_architectureArchitecture of the multilayer perceptron.

Definition at line 840 of file neural_network.cpp.

◆ set() [4/8]

void OpenNN::NeuralNetwork::set ( const size_t &  new_inputs_number,
const size_t &  new_outputs_number 
)

Sets a new multilayer_perceptron_pointer architecture with one layer and zero independent parameters. It also sets the rest of members to their default values.

Parameters
new_inputs_numberNumber of inputs.
new_outputs_numberNumber of outputs.

Definition at line 865 of file neural_network.cpp.

◆ set() [5/8]

void OpenNN::NeuralNetwork::set ( const size_t &  new_inputs_number,
const size_t &  new_hidden_neurons_number,
const size_t &  new_outputs_number 
)

Sets a new multilayer_perceptron_pointer architecture with one hidden layer and zero independent parameters. It also sets the rest of members to their default values.

Parameters
new_inputs_numberNumber of inputs.
new_hidden_neurons_numberNumber of neurons in the hidden layer.
new_outputs_numberNumber of outputs.

Definition at line 887 of file neural_network.cpp.

◆ set() [6/8]

void OpenNN::NeuralNetwork::set ( const size_t &  new_independent_parameters_number)

Sets a null new multilayer_perceptron_pointer architecture a given number of independent parameters. It also sets the rest of members to their default values.

Parameters
new_independent_parameters_numberNumber of independent_parameters_pointer.

Definition at line 907 of file neural_network.cpp.

◆ set() [7/8]

void OpenNN::NeuralNetwork::set ( const std::string &  file_name)

Sets the neural network members by loading them from a XML file.

Parameters
file_nameNeural network XML file_name.

Definition at line 922 of file neural_network.cpp.

◆ set() [8/8]

void OpenNN::NeuralNetwork::set ( const NeuralNetwork other_neural_network)

Sets the members of this neural network object with those from other neural network object.

Parameters
other_neural_networkNeural network object to be copied.

Definition at line 935 of file neural_network.cpp.

◆ set_bounding_layer_pointer()

void OpenNN::NeuralNetwork::set_bounding_layer_pointer ( BoundingLayer new_bounding_layer_pointer)

Sets a new bounding layer within the neural network.

Parameters
new_bounding_layer_pointerPointer to a bounding layer object. Note that the neural network destructror will delete this pointer.

Definition at line 1208 of file neural_network.cpp.

◆ set_conditions_layer_pointer()

void OpenNN::NeuralNetwork::set_conditions_layer_pointer ( ConditionsLayer new_conditions_layer_pointer)

Sets a new conditions layer within the neural network.

Parameters
new_conditions_layer_pointerPointer to a conditions layer object. Note that the neural network destructror will delete this pointer.

Definition at line 1242 of file neural_network.cpp.

◆ set_display()

void OpenNN::NeuralNetwork::set_display ( const bool &  new_display)

Sets a new display value. If it is set to true messages from this class are to be displayed on the screen; if it is set to false messages from this class are not to be displayed on the screen.

Parameters
new_displayDisplay value.

Definition at line 2086 of file neural_network.cpp.

◆ set_independent_parameters_pointer()

void OpenNN::NeuralNetwork::set_independent_parameters_pointer ( IndependentParameters new_independent_parameters_pointer)

Sets new independent parameters within the neural network.

Parameters
new_independent_parameters_pointerPointer to an independent parameters object. Note that the neural network destructror will delete this pointer.

Definition at line 1293 of file neural_network.cpp.

◆ set_inputs_pointer()

void OpenNN::NeuralNetwork::set_inputs_pointer ( Inputs new_inputs_pointer)

Sets a new inputs object within the neural network.

Parameters
new_inputs_pointerPointer to an inputs object. Note that the neural network destructror will delete this pointer.

Definition at line 1259 of file neural_network.cpp.

◆ set_multilayer_perceptron_pointer()

void OpenNN::NeuralNetwork::set_multilayer_perceptron_pointer ( MultilayerPerceptron new_multilayer_perceptron_pointer)

Sets a new multilayer perceptron within the neural network.

Parameters
new_multilayer_perceptron_pointerPointer to a multilayer perceptron object. Note that the neural network destructror will delete this pointer.

Definition at line 1140 of file neural_network.cpp.

◆ set_outputs_pointer()

void OpenNN::NeuralNetwork::set_outputs_pointer ( Outputs new_outputs_pointer)

Sets a new outputs object within the neural network.

Parameters
new_outputs_pointerPointer to an outputs object. Note that the neural network destructror will delete this pointer.

Definition at line 1276 of file neural_network.cpp.

◆ set_parameters()

void OpenNN::NeuralNetwork::set_parameters ( const Vector< double > &  new_parameters)

Sets all the parameters (multilayer_perceptron_pointer parameters and independent parameters) from a single vector.

Parameters
new_parametersNew set of parameter values.

Definition at line 1547 of file neural_network.cpp.

◆ set_principal_components_layer_pointer()

void OpenNN::NeuralNetwork::set_principal_components_layer_pointer ( PrincipalComponentsLayer new_principal_components_layer_pointer)

Sets a new principal components layer within the neural network.

Parameters
new_principal_components_layer_pointerPointer to a principal components layer object. Note that the neural network destructror will delete this pointer.

Definition at line 1174 of file neural_network.cpp.

◆ set_probabilistic_layer_pointer()

void OpenNN::NeuralNetwork::set_probabilistic_layer_pointer ( ProbabilisticLayer new_probabilistic_layer_pointer)

Sets a new probabilistic layer within the neural network.

Parameters
new_probabilistic_layer_pointerPointer to a probabilistic layer object. Note that the neural network destructror will delete this pointer.

Definition at line 1225 of file neural_network.cpp.

◆ set_scaling_layer()

void OpenNN::NeuralNetwork::set_scaling_layer ( ScalingLayer new_scaling_layer)

Sets new scaling layer within the neural network.

Parameters
new_scaling_layerScaling layer to be asociated to the neural network.

Definition at line 1308 of file neural_network.cpp.

◆ set_scaling_layer_pointer()

void OpenNN::NeuralNetwork::set_scaling_layer_pointer ( ScalingLayer new_scaling_layer_pointer)

Sets a new scaling layer within the neural network.

Parameters
new_scaling_layer_pointerPointer to a scaling layer object. Note that the neural network destructror will delete this pointer.

Definition at line 1157 of file neural_network.cpp.

◆ set_unscaling_layer_pointer()

void OpenNN::NeuralNetwork::set_unscaling_layer_pointer ( UnscalingLayer new_unscaling_layer_pointer)

Sets a new unscaling layer within the neural network.

Parameters
new_unscaling_layer_pointerPointer to an unscaling layer object. Note that the neural network destructror will delete this pointer.

Definition at line 1191 of file neural_network.cpp.

◆ to_XML()

tinyxml2::XMLDocument * OpenNN::NeuralNetwork::to_XML ( void  ) const
virtual

Serializes the neural network object into a XML document of the TinyXML library. See the OpenNN manual for more information about the format of this element.

Definition at line 4518 of file neural_network.cpp.

◆ write_XML()

void OpenNN::NeuralNetwork::write_XML ( tinyxml2::XMLPrinter &  file_stream) const
virtual

Serializes the neural network object into a XML document of the TinyXML library without keep the DOM tree in memory. See the OpenNN manual for more information about the format of this document.

Definition at line 4693 of file neural_network.cpp.


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