| Class | RubyFann::Shortcut |
| In: |
ext/ruby_fann/neural_network.c
|
| Parent: | Object |
Initializes class under RubyFann module/namespace.
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')
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>.
Get the activation steepness for neuron number neuron in layer number layer, counting the input layer as layer 0.
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.
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 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 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.
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.
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 minimum step-size is a small positive number determining how small the minimum step-size may be.
The increase factor is a value larger than 1, which is used to increase the step-size during RPROP training.
Returns the training algorithm. One of the following symbols:
:incremental, :batch, :rprop, :quickprop
Will print the connections of the ann in a compact matrix,
for easy viewing of the internals of the ann.
Resets the mean square error from the network.
This function also resets the number of bits that fail.
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 all of the neurons in layer number layer, counting the input layer as layer 0.
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 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 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.
The decrease factor is a value smaller than 1, which is used to decrease the step-size during RPROP training.
The minimum step-size is a small positive number determining how small the minimum step-size may be.
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>.