Class RubyFann::Shortcut
In: ext/ruby_fann/neural_network.c
Parent: Object
TrainData Standard Neurotica Shortcut VERSION RubyFann dot/f_7.png

Initializes class under RubyFann module/namespace.

Methods

cascadetrain_on_data   get_MSE   get_activation_steepness   get_bias_array   get_bit_fail   get_bit_fail_limit   get_cascade_activation_functions   get_cascade_activation_functions_count   get_cascade_activation_steepnesses   get_cascade_activation_steepnesses_count   get_cascade_candidate_change_fraction   get_cascade_candidate_limit   get_cascade_candidate_stagnation_epochs   get_cascade_max_cand_epochs   get_cascade_max_out_epochs   get_cascade_num_candidate_groups   get_cascade_num_candidates   get_cascade_output_change_fraction   get_cascade_output_stagnation_epochs   get_cascade_weight_multiplier   get_connection_rate   get_layer_array   get_learning_momentum   get_learning_rate   get_network_type   get_neurons   get_num_input   get_num_layers   get_num_output   get_quickprop_decay   get_quickprop_mu   get_rprop_decrease_factor   get_rprop_delta_max   get_rprop_delta_min   get_rprop_delta_zero   get_rprop_increase_factor   get_total_connections   get_total_neurons   get_train_error_function   get_train_error_function   get_train_stop_function   get_training_algorithm   init_weights   new   print_connections   print_parameters   randomize_weights   reset_MSE   run   save   set_activation_function   set_activation_function_hidden   set_activation_function_layer   set_activation_function_output   set_activation_steepness   set_activation_steepness_hidden   set_activation_steepness_layer   set_activation_steepness_output   set_bit_fail_limit   set_cascade_activation_functions   set_cascade_activation_steepnesses   set_cascade_candidate_change_fraction   set_cascade_candidate_limit   set_cascade_candidate_stagnation_epochs   set_cascade_max_cand_epochs   set_cascade_max_out_epochs   set_cascade_num_candidate_groups   set_cascade_output_change_fraction   set_cascade_output_stagnation_epochs   set_cascade_weight_multiplier   set_learning_momentum   set_learning_rate   set_quickprop_decay   set_quickprop_mu   set_rprop_decrease_factor   set_rprop_delta_max   set_rprop_delta_min   set_rprop_delta_zero   set_rprop_increase_factor   set_train_error_function   set_train_error_function   set_train_stop_function   set_training_algorithm   test_data   train_epoch   train_on_data  

Public Class methods

Initialization routine for both standard, shortcut & filename forms of FANN:

Standard Initialization:

  RubyFann::Standard.new(:num_inputs=>1, :hidden_neurons=>[3, 4, 3, 4], :num_outputs=>1)

Shortcut Initialization (e.g., for use in cascade training):

  RubyFann::Shortcut.new(:num_inputs=>5, :num_outputs=>1)

File Initialization

  RubyFann::Standard.new(:filename=>'xor_float.net')

Public Instance methods

Perform cascade training with training data created with RubyFann::TrainData.new

            max_epochs - The maximum number of neurons in trained network
            neurons_between_reports - The number of neurons between printing a status report to stdout.
            desired_error - The desired <get_MSE> or <get_bit_fail>, depending on which stop function
            is chosen by <set_train_stop_function>.

Reads the mean square error from the network.

Get the activation steepness for neuron number neuron in layer number layer, counting the input layer as layer 0.

Return array of bias(es)

    The number of fail bits; means the number of output neurons which differ more

than the bit fail limit (see <fann_get_bit_fail_limit>, <fann_set_bit_fail_limit>). The bits are counted in all of the training data, so this number can be higher than the number of training data.

Returns the bit fail limit used during training.

The cascade activation functions is an array of the different activation functions used by

            the candidates.  The default is [:sigmoid, :sigmoid_symmetric, :gaussian, :gaussian_symmetric, :elliot, :elliot_symmetric]

The number of activation functions in the <get_cascade_activation_functions> array

The cascade activation steepnesses array is an array of the different activation functions used by

            the candidates.

The number of activation steepnesses in the <get_cascade_activation_functions> array.

The cascade candidate change fraction is a number between 0 and 1

The candidate limit is a limit for how much the candidate neuron may be trained.

            The limit is a limit on the proportion between the MSE and candidate score.

The number of cascade candidate stagnation epochs determines the number of epochs training is allowed to

            continue without changing the MSE by a fraction of <get_cascade_candidate_change_fraction>.

The maximum candidate epochs determines the maximum number of epochs the input

            connections to the candidates may be trained before adding a new candidate neuron.

The maximum out epochs determines the maximum number of epochs the output connections

            may be trained after adding a new candidate neuron.

The number of candidate groups is the number of groups of identical candidates which will be used

            during training.

The number of candidates used during training (calculated by multiplying <get_cascade_activation_functions_count>,

            <get_cascade_activation_steepnesses_count> and <get_cascade_num_candidate_groups>).

The cascade output change fraction is a number between 0 and 1

The number of cascade output stagnation epochs determines the number of epochs training is allowed to

            continue without changing the MSE by a fraction of <get_cascade_output_change_fraction>.

The weight multiplier is a parameter which is used to multiply the weights from the candidate neuron

            before adding the neuron to the neural network. This parameter is usually between 0 and 1, and is used
            to make the training a bit less aggressive.

Get the connection rate used when the network was created.

Get list of layers in array format where each element contains number of neurons in that layer

Get the learning momentum.

The learning rate is used to determine how aggressive training should be for some of the

            training algorithms (:incremental, :batch, :quickprop).
            Do however note that it is not used in :rprop.
            The default learning rate is 0.7.

Get the type of network. Returns as ruby symbol (one of :shortcut, :layer)

Return array<hash> where each array element is a hash representing a neuron. It contains the following keys:

            :activation_function, symbol -- the activation function
            :activation_steepness=float -- The steepness of the activation function
            :sum=float -- The sum of the inputs multiplied with the weights
            :value=float -- The value of the activation fuction applied to the sum
            :connections=array<int> -- indices of connected neurons(inputs)

      This could be done more elegantly (e.g., defining more ruby ext classes).
            This method does not directly correlate to anything in FANN, and accesses
            structs that are not guaranteed to not change.

Get the number of input neurons.

Get the number of layers in the network.

Get the number of output neurons.

The decay is a small negative valued number which is the factor that the weights should become smaller in each iteration during quickprop training. This is used to make sure that the weights do not become too high during training.

The mu factor is used to increase and decrease the step-size during quickprop training. The mu factor should always be above 1, since it would otherwise decrease the step-size when it was suppose to increase it.

The decrease factor is a value smaller than 1, which is used to decrease the step-size during RPROP training.

The maximum step-size is a positive number determining how large the maximum step-size may be.

The minimum step-size is a small positive number determining how small the minimum step-size may be.

The initial step-size is a positive number determining the initial step size.

The increase factor is a value larger than 1, which is used to increase the step-size during RPROP training.

Get the total number of connections in the entire network.

Get the total number of neurons in the entire network.

Returns the error function used during training. One of the following symbols:

                    :linear, :tanh

Returns the error function used during training. One of the following symbols:

                    :linear, :tanh

Returns the training stop function. One of the following symbols:

                    :mse, :bit

Returns the training algorithm. One of the following symbols:

                    :incremental, :batch, :rprop, :quickprop

Initialize the weights using Widrow + Nguyen‘s algorithm.

Will print the connections of the ann in a compact matrix,

            for easy viewing of the internals of the ann.

Print current NN parameters to stdout

Give each connection a random weight between min_weight and max_weight

Resets the mean square error from the network.

    This function also resets the number of bits that fail.

Run neural net on array<Float> of inputs with current parameters. Returns array<Float> as output

Save the entire network to configuration file with given name

Set the activation function for neuron number neuron in layer number layer,

            counting the input layer as layer 0.  activation_func must be one of the following symbols:
                    :linear, :threshold, :threshold_symmetric, :sigmoid, :sigmoid_stepwise, :sigmoid_symmetric,
                    :sigmoid_symmetric_stepwise, :gaussian, :gaussian_symmetric, :gaussian_stepwise, :elliot,
                    :elliot_symmetric, :linear_piece, :linear_piece_symmetric, :sin_symmetric, :cos_symmetric,
                    :sin, :cos

Set the activation function for all of the hidden layers. activation_func must be one of the following symbols:

                    :linear, :threshold, :threshold_symmetric, :sigmoid, :sigmoid_stepwise, :sigmoid_symmetric,
                    :sigmoid_symmetric_stepwise, :gaussian, :gaussian_symmetric, :gaussian_stepwise, :elliot,
                    :elliot_symmetric, :linear_piece, :linear_piece_symmetric, :sin_symmetric, :cos_symmetric,
                    :sin, :cos

Set the activation function for all the neurons in the layer number layer,

            counting the input layer as layer 0.  activation_func must be one of the following symbols:
                    :linear, :threshold, :threshold_symmetric, :sigmoid, :sigmoid_stepwise, :sigmoid_symmetric,
                    :sigmoid_symmetric_stepwise, :gaussian, :gaussian_symmetric, :gaussian_stepwise, :elliot,
                    :elliot_symmetric, :linear_piece, :linear_piece_symmetric, :sin_symmetric, :cos_symmetric,
                    :sin, :cos

  It is not possible to set activation functions for the neurons in the input layer.

Set the activation function for the output layer. activation_func must be one of the following symbols:

              :linear, :threshold, :threshold_symmetric, :sigmoid, :sigmoid_stepwise, :sigmoid_symmetric,
              :sigmoid_symmetric_stepwise, :gaussian, :gaussian_symmetric, :gaussian_stepwise, :elliot,
              :elliot_symmetric, :linear_piece, :linear_piece_symmetric, :sin_symmetric, :cos_symmetric,
              :sin, :cos

Set the activation steepness for neuron number {neuron} in layer number {layer}, counting the input layer as layer 0.

Set the activation steepness in all of the hidden layers.

Set the activation steepness all of the neurons in layer number layer, counting the input layer as layer 0.

Set the activation steepness in the output layer.

Sets the bit fail limit used during training.

The cascade activation functions is an array of the different activation functions used by

            the candidates.  The default is [:sigmoid, :sigmoid_symmetric, :gaussian, :gaussian_symmetric, :elliot, :elliot_symmetric]

The cascade activation steepnesses array is an array of the different activation functions used by

            the candidates.

The cascade candidate change fraction is a number between 0 and 1

The candidate limit is a limit for how much the candidate neuron may be trained.

            The limit is a limit on the proportion between the MSE and candidate score.

The number of cascade candidate stagnation epochs determines the number of epochs training is allowed to

            continue without changing the MSE by a fraction of <get_cascade_candidate_change_fraction>.

The maximum candidate epochs determines the maximum number of epochs the input

            connections to the candidates may be trained before adding a new candidate neuron.

The maximum out epochs determines the maximum number of epochs the output connections

            may be trained after adding a new candidate neuron.

The number of candidate groups is the number of groups of identical candidates which will be used

            during training.

The cascade output change fraction is a number between 0 and 1

The number of cascade output stagnation epochs determines the number of epochs training is allowed to

            continue without changing the MSE by a fraction of <get_cascade_output_change_fraction>.

The weight multiplier is a parameter which is used to multiply the weights from the candidate neuron

            before adding the neuron to the neural network. This parameter is usually between 0 and 1, and is used
            to make the training a bit less aggressive.

The learning rate is used to determine how aggressive training should be for some of the

            training algorithms (:incremental, :batch, :quickprop).
            Do however note that it is not used in :rprop.
            The default learning rate is 0.7.

Sets the quickprop decay factor

Sets the quickprop mu factor.

The decrease factor is a value smaller than 1, which is used to decrease the step-size during RPROP training.

The maximum step-size is a positive number determining how large the maximum step-size may be.

The minimum step-size is a small positive number determining how small the minimum step-size may be.

The initial step-size is a positive number determining the initial step size.

The increase factor used during RPROP training.

Sets the error function used during training. One of the following symbols:

                    :linear, :tanh

Sets the error function used during training. One of the following symbols:

                    :linear, :tanh

Set the training stop function. One of the following symbols:

                    :mse, :bit

Set the training algorithm. One of the following symbols:

                    :incremental, :batch, :rprop, :quickprop

Test a set of training data and calculates the MSE for the training data.

Train one epoch with a set of training data, created with RubyFann::TrainData.new

Train with training data created with RubyFann::TrainData.new

            max_epochs - The maximum number of epochs the training should continue
            epochs_between_reports - The number of epochs between printing a status report to stdout.
            desired_error - The desired <get_MSE> or <get_bit_fail>, depending on which stop function
                is chosen by <set_train_stop_function>.

[Validate]