ProbabilisticLayer Class Reference

This class represents a layer of probabilistic neurons. More...

#include <probabilistic_layer.h>

Inheritance diagram for ProbabilisticLayer:
Layer

Public Types

enum class  ActivationFunction { Binary , Logistic , Competitive , Softmax }
 Enumeration of available methods for interpreting variables as probabilities. More...
 
- Public Types inherited from Layer
enum class  Type {
  Scaling , Convolutional , Perceptron , Pooling ,
  Probabilistic , LongShortTermMemory , Recurrent , Unscaling ,
  Bounding
}
 This enumeration represents the possible types of layers. More...
 

Public Member Functions

 ProbabilisticLayer ()
 
 ProbabilisticLayer (const Index &, const Index &)
 
virtual ~ProbabilisticLayer ()
 
Index get_inputs_number () const
 Returns the number of inputs. More...
 
Index get_neurons_number () const
 
Index get_biases_number () const
 
Index get_synaptic_weights_number () const
 Returns the number of layer's synaptic weights. More...
 
const type & get_decision_threshold () const
 Returns the decision threshold. More...
 
const ActivationFunctionget_activation_function () const
 
string write_activation_function () const
 
string write_activation_function_text () const
 
const bool & get_display () const
 
void set ()
 
void set (const Index &, const Index &)
 
void set (const ProbabilisticLayer &)
 
void set_inputs_number (const Index &)
 
void set_neurons_number (const Index &)
 
void set_biases (const Tensor< type, 2 > &)
 
void set_synaptic_weights (const Tensor< type, 2 > &)
 
void set_parameters (const Tensor< type, 1 > &, const Index &index=0)
 
void set_decision_threshold (const type &)
 
void set_activation_function (const ActivationFunction &)
 
void set_activation_function (const string &)
 
virtual void set_default ()
 
const Tensor< type, 2 > & get_biases () const
 Returns the biases of the layer. More...
 
const Tensor< type, 2 > & get_synaptic_weights () const
 Returns the synaptic weights of the layer. More...
 
Tensor< type, 2 > get_biases (Tensor< type, 1 > &) const
 
Tensor< type, 2 > get_synaptic_weights (Tensor< type, 1 > &) const
 
Index get_parameters_number () const
 Returns the number of parameters(biases and synaptic weights) of the layer. More...
 
Tensor< type, 1 > get_parameters () const
 
void set_display (const bool &)
 
void set_biases_constant (const type &)
 
void set_synaptic_weights_constant (const type &)
 
void set_synaptic_weights_constant_Glorot ()
 
void set_parameters_constant (const type &)
 
void set_parameters_random ()
 
void insert_parameters (const Tensor< type, 1 > &, const Index &)
 
void calculate_combinations (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void calculate_activations (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void calculate_activations_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 3 > &) const
 
Tensor< type, 2 > calculate_outputs (const Tensor< type, 2 > &)
 
void forward_propagate (const Tensor< type, 2 > &, LayerForwardPropagation *)
 
void forward_propagate (const Tensor< type, 2 > &, Tensor< type, 1 >, LayerForwardPropagation *)
 
void calculate_error_gradient (const Tensor< type, 2 > &, LayerForwardPropagation *, LayerBackPropagation *) const
 
void insert_gradient (LayerBackPropagation *, const Index &, Tensor< type, 1 > &) const
 
void calculate_squared_errors_Jacobian_lm (const Tensor< type, 2 > &, LayerForwardPropagation *, LayerBackPropagationLM *)
 
void insert_squared_errors_Jacobian_lm (LayerBackPropagationLM *, const Index &, Tensor< type, 2 > &) const
 
string write_binary_expression (const Tensor< string, 1 > &, const Tensor< string, 1 > &) const
 
string write_logistic_expression (const Tensor< string, 1 > &, const Tensor< string, 1 > &) const
 
string write_competitive_expression (const Tensor< string, 1 > &, const Tensor< string, 1 > &) const
 
string write_softmax_expression (const Tensor< string, 1 > &, const Tensor< string, 1 > &) const
 
string write_no_probabilistic_expression (const Tensor< string, 1 > &, const Tensor< string, 1 > &) const
 
string write_expression (const Tensor< string, 1 > &, const Tensor< string, 1 > &) const
 
string write_combinations (const Tensor< string, 1 > &) const
 
string write_activations (const Tensor< string, 1 > &) const
 
string write_expression_c () const
 
string write_combinations_c () const
 
string write_activations_c () const
 
string write_expression_python () const
 
string write_combinations_python () const
 
string write_activations_python () const
 
void from_XML (const tinyxml2::XMLDocument &)
 
void write_XML (tinyxml2::XMLPrinter &) const
 
- Public Member Functions inherited from Layer
string get_name () const
 
void set_threads_number (const int &)
 
virtual Tensor< type, 2 > calculate_outputs_from4D (const Tensor< type, 4 > &)
 
virtual Tensor< type, 4 > calculate_outputs_4D (const Tensor< type, 4 > &)
 
virtual void forward_propagate (const Tensor< type, 4 > &, LayerForwardPropagation *)
 
virtual void forward_propagate (const Tensor< type, 4 > &, Tensor< type, 1 >, LayerForwardPropagation *)
 
virtual void calculate_hidden_delta (LayerForwardPropagation *, LayerBackPropagation *, LayerBackPropagation *) const
 
virtual void calculate_hidden_delta_lm (LayerForwardPropagation *, LayerBackPropagationLM *, LayerBackPropagationLM *) const
 
virtual void calculate_error_gradient (const Tensor< type, 4 > &, LayerForwardPropagation *, LayerBackPropagation *) const
 
Type get_type () const
 
string get_type_string () const
 Takes the type of layer used by the model. More...
 

Protected Attributes

Tensor< type, 2 > biases
 
Tensor< type, 2 > synaptic_weights
 This matrix containing conection strengths from a layer's inputs to its neurons. More...
 
ActivationFunction activation_function = ActivationFunction::Logistic
 Activation function variable. More...
 
type decision_threshold
 
bool display = true
 Display messages to screen. More...
 
- Protected Attributes inherited from Layer
NonBlockingThreadPool * non_blocking_thread_pool = nullptr
 
ThreadPoolDevice * thread_pool_device = nullptr
 
string layer_name = "layer"
 Layer name. More...
 
Type layer_type = Type::Perceptron
 Layer type. More...
 
const Eigen::array< IndexPair< Index >, 1 > A_BT = {IndexPair<Index>(1, 1)}
 
const Eigen::array< IndexPair< Index >, 1 > AT_B = {IndexPair<Index>(0, 0)}
 
const Eigen::array< IndexPair< Index >, 1 > A_B = {IndexPair<Index>(1, 0)}
 

Additional Inherited Members

- Protected Member Functions inherited from Layer
void hard_sigmoid (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void hyperbolic_tangent (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void logistic (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void linear (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void threshold (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void symmetric_threshold (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void rectified_linear (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void scaled_exponential_linear (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void soft_plus (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void soft_sign (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void exponential_linear (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void softmax (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void binary (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void competitive (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void hard_sigmoid_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void hyperbolic_tangent_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void linear_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void logistic_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void threshold_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void symmetric_threshold_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void rectified_linear_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void scaled_exponential_linear_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void soft_plus_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void soft_sign_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void exponential_linear_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void hard_sigmoid (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void hyperbolic_tangent (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void logistic (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void linear (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void threshold (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void symmetric_threshold (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void rectified_linear (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void scaled_exponential_linear (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void soft_plus (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void soft_sign (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void exponential_linear (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void softmax (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void binary (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void competitive (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void hard_sigmoid_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void hyperbolic_tangent_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void linear_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void logistic_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void threshold_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void symmetric_threshold_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void rectified_linear_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void scaled_exponential_linear_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void soft_plus_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void soft_sign_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void exponential_linear_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void logistic_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 3 > &) const
 
void softmax_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 3 > &) const
 
void linear (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void logistic (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void hyperbolic_tangent (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void threshold (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void symmetric_threshold (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void rectified_linear (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void scaled_exponential_linear (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void soft_plus (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void soft_sign (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void hard_sigmoid (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void exponential_linear (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void linear_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void logistic_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void hyperbolic_tangent_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void threshold_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void symmetric_threshold_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void rectified_linear_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void scaled_exponential_linear_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void soft_plus_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void soft_sign_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void hard_sigmoid_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void exponential_linear_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 

Detailed Description

This class represents a layer of probabilistic neurons.

The neural network defined in OpenNN includes a probabilistic layer for those problems when the outptus are to be interpreted as probabilities. It does not has Synaptic weights or Biases

Definition at line 49 of file probabilistic_layer.h.

Member Enumeration Documentation

◆ ActivationFunction

enum class ActivationFunction
strong

Enumeration of available methods for interpreting variables as probabilities.

Definition at line 68 of file probabilistic_layer.h.

Constructor & Destructor Documentation

◆ ProbabilisticLayer() [1/2]

ProbabilisticLayer ( )
explicit

Default constructor. It creates a probabilistic layer object with zero probabilistic neurons. It does not has Synaptic weights or Biases

Definition at line 18 of file probabilistic_layer.cpp.

◆ ProbabilisticLayer() [2/2]

ProbabilisticLayer ( const Index &  new_inputs_number,
const Index &  new_neurons_number 
)
explicit

Probabilistic neurons number constructor. It creates a probabilistic layer with a given size.

Parameters
new_neurons_numberNumber of neurons in the layer.

Definition at line 28 of file probabilistic_layer.cpp.

◆ ~ProbabilisticLayer()

~ProbabilisticLayer ( )
virtual

Destructor. This destructor does not delete any pointer.

Definition at line 42 of file probabilistic_layer.cpp.

Member Function Documentation

◆ calculate_activations()

void calculate_activations ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations 
) const

Definition at line 585 of file probabilistic_layer.cpp.

◆ calculate_activations_derivatives()

void calculate_activations_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 3 > &  activations_derivatives 
) const

Definition at line 640 of file probabilistic_layer.cpp.

◆ calculate_combinations()

void calculate_combinations ( const Tensor< type, 2 > &  inputs,
const Tensor< type, 2 > &  biases,
const Tensor< type, 2 > &  synaptic_weights,
Tensor< type, 2 > &  combinations 
) const

Definition at line 566 of file probabilistic_layer.cpp.

◆ calculate_error_gradient()

void calculate_error_gradient ( const Tensor< type, 2 > &  inputs,
LayerForwardPropagation forward_propagation,
LayerBackPropagation back_propagation 
) const
virtual

Reimplemented from Layer.

Definition at line 749 of file probabilistic_layer.cpp.

◆ calculate_outputs()

Tensor< type, 2 > calculate_outputs ( const Tensor< type, 2 > &  inputs)
virtual

This method processes the input to the probabilistic layer in order to obtain a set of outputs which can be interpreted as probabilities. This posprocessing is performed according to the probabilistic method to be used.

Parameters
inputsSet of inputs to the probabilistic layer.

Reimplemented from Layer.

Definition at line 680 of file probabilistic_layer.cpp.

◆ calculate_squared_errors_Jacobian_lm()

void calculate_squared_errors_Jacobian_lm ( const Tensor< type, 2 > &  inputs,
LayerForwardPropagation forward_propagation,
LayerBackPropagationLM back_propagation 
)
virtual

Reimplemented from Layer.

Definition at line 827 of file probabilistic_layer.cpp.

◆ forward_propagate() [1/2]

void forward_propagate ( const Tensor< type, 2 > &  inputs,
LayerForwardPropagation forward_propagation 
)
virtual

Reimplemented from Layer.

Definition at line 695 of file probabilistic_layer.cpp.

◆ forward_propagate() [2/2]

void forward_propagate ( const Tensor< type, 2 > &  inputs,
Tensor< type, 1 >  potential_parameters,
LayerForwardPropagation forward_propagation 
)
virtual

Reimplemented from Layer.

Definition at line 708 of file probabilistic_layer.cpp.

◆ from_XML()

void from_XML ( const tinyxml2::XMLDocument document)
virtual

Deserializes a TinyXML document into this probabilistic layer object.

Parameters
documentXML document containing the member data.

Reimplemented from Layer.

Definition at line 994 of file probabilistic_layer.cpp.

◆ get_activation_function()

const ProbabilisticLayer::ActivationFunction & get_activation_function ( ) const

Returns the method to be used for interpreting the outputs as probabilistic values. The methods available for that are Binary, Probability, Competitive and Softmax.

Definition at line 84 of file probabilistic_layer.cpp.

◆ get_biases() [1/2]

const Tensor< type, 2 > & get_biases ( ) const

Returns the biases of the layer.

Definition at line 169 of file probabilistic_layer.cpp.

◆ get_biases() [2/2]

Tensor< type, 2 > get_biases ( Tensor< type, 1 > &  parameters) const

Returns the biases from a given vector of paramters for the layer.

Parameters
parametersParameters of the layer.

Definition at line 186 of file probabilistic_layer.cpp.

◆ get_biases_number()

Index get_biases_number ( ) const

Definition at line 59 of file probabilistic_layer.cpp.

◆ get_decision_threshold()

const type & get_decision_threshold ( ) const

Returns the decision threshold.

Definition at line 75 of file probabilistic_layer.cpp.

◆ get_display()

const bool & get_display ( ) 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 161 of file probabilistic_layer.cpp.

◆ get_inputs_number()

Index get_inputs_number ( ) const
virtual

Returns the number of inputs.

Reimplemented from Layer.

Definition at line 47 of file probabilistic_layer.cpp.

◆ get_neurons_number()

Index get_neurons_number ( ) const
virtual

Reimplemented from Layer.

Definition at line 53 of file probabilistic_layer.cpp.

◆ get_parameters()

Tensor< type, 1 > get_parameters ( ) const
virtual

Returns a single vector with all the layer parameters. The format is a vector of real values. The size is the number of parameters in the layer.

Reimplemented from Layer.

Definition at line 223 of file probabilistic_layer.cpp.

◆ get_parameters_number()

Index get_parameters_number ( ) const
virtual

Returns the number of parameters(biases and synaptic weights) of the layer.

Reimplemented from Layer.

Definition at line 213 of file probabilistic_layer.cpp.

◆ get_synaptic_weights() [1/2]

const Tensor< type, 2 > & get_synaptic_weights ( ) const

Returns the synaptic weights of the layer.

Definition at line 177 of file probabilistic_layer.cpp.

◆ get_synaptic_weights() [2/2]

Tensor< type, 2 > get_synaptic_weights ( Tensor< type, 1 > &  parameters) const

Returns the synaptic weights from a given vector of paramters for the layer.

Parameters
parametersParameters of the layer.

Definition at line 199 of file probabilistic_layer.cpp.

◆ get_synaptic_weights_number()

Index get_synaptic_weights_number ( ) const
virtual

Returns the number of layer's synaptic weights.

Reimplemented from Layer.

Definition at line 67 of file probabilistic_layer.cpp.

◆ insert_gradient()

void insert_gradient ( LayerBackPropagation back_propagation,
const Index &  index,
Tensor< type, 1 > &  gradient 
) const
virtual

Reimplemented from Layer.

Definition at line 809 of file probabilistic_layer.cpp.

◆ insert_parameters()

void insert_parameters ( const Tensor< type, 1 > &  parameters,
const Index &   
)

Definition at line 556 of file probabilistic_layer.cpp.

◆ insert_squared_errors_Jacobian_lm()

void insert_squared_errors_Jacobian_lm ( LayerBackPropagationLM back_propagation,
const Index &  index,
Tensor< type, 2 > &  squared_errors_Jacobian 
) const
virtual

Reimplemented from Layer.

Definition at line 897 of file probabilistic_layer.cpp.

◆ set() [1/3]

void set ( )

Sets a probabilistic layer with zero probabilistic neurons. It also sets the rest of members to their default values.

Definition at line 245 of file probabilistic_layer.cpp.

◆ set() [2/3]

void set ( const Index &  new_inputs_number,
const Index &  new_neurons_number 
)

Resizes the size of the probabilistic layer. It also sets the rest of class members to their default values.

Parameters
new_neurons_numberNew size for the probabilistic layer.

Definition at line 259 of file probabilistic_layer.cpp.

◆ set() [3/3]

void set ( const ProbabilisticLayer other_probabilistic_layer)

Sets this object to be equal to another object of the same class.

Parameters
other_probabilistic_layerProbabilistic layer object to be copied.

Definition at line 274 of file probabilistic_layer.cpp.

◆ set_activation_function() [1/2]

void set_activation_function ( const ActivationFunction new_activation_function)

Sets the chosen method for probabilistic postprocessing. Current probabilistic methods include Binary, Probability, Competitive and Softmax.

Parameters
new_activation_functionMethod for interpreting the outputs as probabilistic values.

Definition at line 395 of file probabilistic_layer.cpp.

◆ set_activation_function() [2/2]

void set_activation_function ( const string &  new_activation_function)

Sets a new method for probabilistic processing from a string with the name. Current probabilistic methods include Competitive and Softmax.

Parameters
new_activation_functionMethod for interpreting the outputs as probabilistic values.

Definition at line 455 of file probabilistic_layer.cpp.

◆ set_biases()

void set_biases ( const Tensor< type, 2 > &  new_biases)

Definition at line 306 of file probabilistic_layer.cpp.

◆ set_biases_constant()

void set_biases_constant ( const type &  value)

Initializes the biases of all the neurons in the probabilistic layer with a given value.

Parameters
valueBiases initialization value.

Definition at line 500 of file probabilistic_layer.cpp.

◆ set_decision_threshold()

void set_decision_threshold ( const type &  new_decision_threshold)

Sets a new threshold value for discriminating between two classes.

Parameters
new_decision_thresholdNew discriminating value. It must be comprised between 0 and 1.

Definition at line 331 of file probabilistic_layer.cpp.

◆ set_default()

void set_default ( )
virtual

Sets the members to their default values:

  • Probabilistic method: Softmax.
  • Display: True.

Definition at line 368 of file probabilistic_layer.cpp.

◆ set_display()

void 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 491 of file probabilistic_layer.cpp.

◆ set_inputs_number()

void set_inputs_number ( const Index &  new_inputs_number)
virtual

Reimplemented from Layer.

Definition at line 286 of file probabilistic_layer.cpp.

◆ set_neurons_number()

void set_neurons_number ( const Index &  new_neurons_number)
virtual

Reimplemented from Layer.

Definition at line 296 of file probabilistic_layer.cpp.

◆ set_parameters()

void set_parameters ( const Tensor< type, 1 > &  new_parameters,
const Index &  index = 0 
)
virtual

Reimplemented from Layer.

Definition at line 318 of file probabilistic_layer.cpp.

◆ set_parameters_constant()

void set_parameters_constant ( const type &  value)
virtual

Initializes all the biases and synaptic weights in the neural newtork with a given value.

Parameters
valueParameters initialization value.

Reimplemented from Layer.

Definition at line 524 of file probabilistic_layer.cpp.

◆ set_parameters_random()

void set_parameters_random ( )
virtual

Initializes all the biases and synaptic weights in the neural newtork at random with values comprised between -1 and +1.

Reimplemented from Layer.

Definition at line 535 of file probabilistic_layer.cpp.

◆ set_synaptic_weights()

void set_synaptic_weights ( const Tensor< type, 2 > &  new_synaptic_weights)

Definition at line 312 of file probabilistic_layer.cpp.

◆ set_synaptic_weights_constant()

void set_synaptic_weights_constant ( const type &  value)

Initializes the synaptic weights of all the neurons in the probabilistic layer with a given value.

Parameters
valueSynaptic weights initialization value.

Definition at line 509 of file probabilistic_layer.cpp.

◆ set_synaptic_weights_constant_Glorot()

void set_synaptic_weights_constant_Glorot ( )

Definition at line 515 of file probabilistic_layer.cpp.

◆ write_activation_function()

string write_activation_function ( ) const

Returns a string with the probabilistic method for the outputs ("Competitive", "Softmax" or "NoProbabilistic").

Definition at line 93 of file probabilistic_layer.cpp.

◆ write_activation_function_text()

string write_activation_function_text ( ) const

Returns a string with the probabilistic method for the outputs to be included in some text ("competitive", "softmax" or "no probabilistic").

Definition at line 127 of file probabilistic_layer.cpp.

◆ write_activations()

string write_activations ( const Tensor< string, 1 > &  outputs_names) const

Definition at line 1416 of file probabilistic_layer.cpp.

◆ write_activations_c()

string write_activations_c ( ) const
Todo:

Definition at line 1239 of file probabilistic_layer.cpp.

◆ write_activations_python()

string write_activations_python ( ) const

Definition at line 1323 of file probabilistic_layer.cpp.

◆ write_binary_expression()

string write_binary_expression ( const Tensor< string, 1 > &  inputs_names,
const Tensor< string, 1 > &  outputs_names 
) const

Returns a string with the expression of the binary probabilistic outputs function.

Parameters
inputs_namesNames of inputs to the probabilistic layer.
outputs_namesNames of outputs to the probabilistic layer.

Definition at line 1133 of file probabilistic_layer.cpp.

◆ write_combinations()

string write_combinations ( const Tensor< string, 1 > &  inputs_names) const

Definition at line 1391 of file probabilistic_layer.cpp.

◆ write_combinations_c()

string write_combinations_c ( ) const

Definition at line 1214 of file probabilistic_layer.cpp.

◆ write_combinations_python()

string write_combinations_python ( ) const

Definition at line 1296 of file probabilistic_layer.cpp.

◆ write_competitive_expression()

string write_competitive_expression ( const Tensor< string, 1 > &  inputs_names,
const Tensor< string, 1 > &  outputs_names 
) const

Returns a string with the expression of the competitive probabilistic outputs function.

Parameters
inputs_namesNames of inputs to the probabilistic layer.
outputs_namesNames of outputs to the probabilistic layer.

Definition at line 1168 of file probabilistic_layer.cpp.

◆ write_expression()

string write_expression ( const Tensor< string, 1 > &  inputs_names,
const Tensor< string, 1 > &  outputs_names 
) const
virtual

Reimplemented from Layer.

Definition at line 1515 of file probabilistic_layer.cpp.

◆ write_expression_c()

string write_expression_c ( ) const
virtual

Reimplemented from Layer.

Definition at line 1483 of file probabilistic_layer.cpp.

◆ write_expression_python()

string write_expression_python ( ) const
virtual

Reimplemented from Layer.

Definition at line 1499 of file probabilistic_layer.cpp.

◆ write_logistic_expression()

string write_logistic_expression ( const Tensor< string, 1 > &  inputs_names,
const Tensor< string, 1 > &  outputs_names 
) const

Returns a string with the expression of the probability outputs function.

Parameters
inputs_namesNames of inputs to the probabilistic layer.
outputs_namesNames of outputs to the probabilistic layer.

Definition at line 1151 of file probabilistic_layer.cpp.

◆ write_no_probabilistic_expression()

string write_no_probabilistic_expression ( const Tensor< string, 1 > &  inputs_names,
const Tensor< string, 1 > &  outputs_names 
) const

Returns a string with the expression of the no probabilistic outputs function.

Parameters
inputs_namesNames of inputs to the probabilistic layer.
outputs_namesNames of outputs to the probabilistic layer.

Definition at line 1201 of file probabilistic_layer.cpp.

◆ write_softmax_expression()

string write_softmax_expression ( const Tensor< string, 1 > &  inputs_names,
const Tensor< string, 1 > &  outputs_names 
) const

Returns a string with the expression of the softmax probabilistic outputs function.

Parameters
inputs_namesNames of inputs to the probabilistic layer.
outputs_namesNames of outputs to the probabilistic layer.

Definition at line 1184 of file probabilistic_layer.cpp.

◆ write_XML()

void write_XML ( tinyxml2::XMLPrinter file_stream) const
virtual

Serializes the probabilistic layer 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.

Reimplemented from Layer.

Definition at line 916 of file probabilistic_layer.cpp.

Member Data Documentation

◆ activation_function

ActivationFunction activation_function = ActivationFunction::Logistic
protected

Activation function variable.

Definition at line 217 of file probabilistic_layer.h.

◆ biases

Tensor<type, 2> biases
protected

Bias is a neuron parameter that is summed with the neuron's weighted inputs and passed through the neuron's trabsfer function to generate the neuron's output.

Definition at line 209 of file probabilistic_layer.h.

◆ decision_threshold

type decision_threshold
protected

Definition at line 219 of file probabilistic_layer.h.

◆ display

bool display = true
protected

Display messages to screen.

Definition at line 223 of file probabilistic_layer.h.

◆ synaptic_weights

Tensor<type, 2> synaptic_weights
protected

This matrix containing conection strengths from a layer's inputs to its neurons.

Definition at line 213 of file probabilistic_layer.h.


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