51 #define HIDDEN_ID "HiddenLayerNeurons"
52 #define LEARNING_RATE_ID "LearningRate"
53 #define MOMENTUM_ID "Momentum"
54 #define CHOICE_ID "Choice"
55 #define EPOCH_ID "Epoch"
56 #define MIN_ERROR_ID "MinimunError"
58 #define NN_LOG_PREFIX "NNAlgorithm: "
70 "Number of neurons in the hidden layer",
72 "Number of neurons in the hidden layer (additional layer to the input and output layers, not connected externally).",
73 "Number of neurons in the hidden layer (additional layer to the input and output layers, not connected externally).",
86 "Learning Rate. Training parameter that controls the size of weight and bias changes during learning.",
87 "Learning Rate. Training parameter that controls the size of weight and bias changes during learning.",
100 "Momentum simply adds a fraction m of the previous weight update to the current one. The momentum parameter is used to prevent the system from converging to a local minimum or saddle point.",
101 "Momentum simply adds a fraction m of the previous weight update to the current one. The momentum parameter is used to prevent the system from converging to a local minimum or saddle point. A high momentum parameter can also help to increase the speed of convergence of the system. However, setting the momentum parameter too high can create a risk of overshooting the minimum, which can cause the system to become unstable. A momentum coefficient that is too low cannot reliably avoid local minima, and can also slow down the training of the system.",
114 "0 = train by epoch, 1 = train by minimum error",
115 "0 = train by epoch, 1 = train by minimum error",
128 "Determines when training will stop once the number of iterations exceeds epochs. When training by minimum error, this represents the maximum number of iterations.",
129 "Determines when training will stop once the number of iterations exceeds epochs. When training by minimum error, this represents the maximum number of iterations.",
142 "Minimum mean square error of the epoch.",
143 "Minimum mean square error of the epoch. Square root of the sum of squared differences between the network targets and actual outputs divided by number of patterns (only for training by minimum error).",
161 "Artificial Neural Network",
165 "Artificial neural networks are made up of interconnecting artificial neurons (programming constructs that mimic the properties of biological neurons). Artificial neural networks may either be used to gain an understanding of biological neural networks, or for solving artificial intelligence problems without necessarily creating a model of a real biological system. Content retrieved from Wikipedia on the 06th of May, 2008: http://en.wikipedia.org/wiki/Neural_network",
168 "An artificial neural network (ANN), also called a simulated neural network (SNN) or commonly just neural network (NN), is an interconnected group of artificial neurons that uses a mathematical or computational model for information processing based on a connectionistic approach to computation. In most cases an ANN is an adaptive system that changes its structure based on external or internal information that flows through the network. In more practical terms, neural networks are non-linear statistical data modeling or decision making tools. They can be used to model complex relationships between inputs and outputs or to find patterns in data. Content retrieved from Wikipedia on the 06th of May, 2008: http://en.wikipedia.org/wiki/Neural_network",
170 "Chopra, Paras, modified by Alex Oshika Avilla and Fabrício Augusto Rodrigues",
173 "Alex Oshika Avilla, Fabricio Augusto Rodrigues",
174 "alex.avilla [at] poli . usp .br, fabricio.rodrigues [at] poli . usp .br",
231 if (
_samp->numAbsence() == 0 ) {
403 Sample env_data = (*presences)[j]->environment();
414 Sample env_data = (*absences)[j]->environment();
468 if(num_absences != 0){
599 vector<vector<double> > env_input;
605 env_input[0][i] = (double)x[i];
631 config->addSubsection( model_config );
633 model_config->addNameValue(
"NumLayers",
_num_layers );
637 int *layers =
new int[3];
652 model_config->addSubsection( weight_config );
654 double *weight_values =
new double[size_weight];
659 for(
int i = 0; i < 3; i++){
661 for(
int j = 0; j < layers[i]; j++){
665 for(
int k = 0; k < layers[i+1]; k++){
674 weight_config->addNameValue(
"Values", weight_values, size_weight);
684 model_config->addSubsection( bias_config );
686 double *bias_values =
new double[size_bias];
691 for(
int i = 0; i < 3; i++){
693 for(
int j = 0; j < layers[i]; j++){
703 bias_config->addNameValue(
"ValuesBias", bias_values, size_bias);
706 delete[] weight_values;
707 delete[] bias_values;
717 if ( ! model_config ) {
721 _num_layers = model_config->getAttributeAsInt(
"NumLayers", 0 );
722 _nn_parameter.
hid = model_config->getAttributeAsInt(
"HiddenLayerNeurons", 14 );
725 int *layers =
new int (3);
740 if ( ! weight_config ) {
745 std::vector<double> weight_values = weight_config->getAttributeAsVecDouble(
"Values" );
748 unsigned int siz = 0;
750 for(
int i = 0; i < 3; i++){
752 for(
int j = 0; j < layers[i]; j++){
756 for(
int k = 0; k < layers[i+1]; k++){
769 if ( ! bias_config ) {
774 std::vector<double> bias_values = bias_config->getAttributeAsVecDouble(
"ValuesBias" );
779 for(
int i = 0; i < 3; i++){
781 for(
int j = 0; j < layers[i]; j++){
void trainingEpoch(unsigned long actual_epoch, double epoch_total, int patterns)
Scalar getValue(const Sample &x) const
void warn(const char *format,...)
'Warn' level.
void setWeight(int i, int j, int k, double w)
double getWeight(int i, int j, int k) const
int Train(vector< double > inputs, vector< double > outputs, int number_pattern, int max_pattern, double momentum)
double Scalar
Type of map values.
unsigned long amount_epoch
static Log * instance()
Returns the instance pointer, creating the object on the first call.
nn_parameter _nn_parameter
void setBias(int i, int j, double b)
static AlgParamMetadata parameters[NUM_PARAM]
void SetInputs(vector< double > inputs) const
SamplerPtr createSampler(const EnvironmentPtr &env, const OccurrencesPtr &presence, const OccurrencesPtr &absence)
void error(const char *format,...)
'Error' level.
int getParameter(std::string const &name, std::string *value)
void setNormalization(const SamplerPtr &samp) const
float getProgress() const
double getBias(int i, int j) const
int trainingMinimumError(int patterns, double min_error)
vector< vector< double > > vector_input
vector< vector< double > > vector_output
OM_ALG_DLL_EXPORT AlgorithmImpl * algorithmFactory()
OM_ALG_DLL_EXPORT AlgMetadata const * algorithmMetadata()
virtual void _getConfiguration(ConfigurationPtr &) const
virtual void _setConfiguration(const ConstConfigurationPtr &)
int SetData(double learning_rate, int layers[], int tot_layers)
static AlgMetadata metadata
void info(const char *format,...)
'Info' level.
double * GetOutput(void) const
virtual void computeNormalization(const ReferenceCountedPointer< const SamplerImpl > &samplerPtr)=0
void debug(const char *format,...)
'Debug' level.
Normalizer * _normalizerPtr