28 #include "parametersettable.h"
29 #include "simpletimer.h"
30 #include "dataexchange.h"
37 #include <QStringList>
45 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5)
46 #pragma GCC diagnostic push
47 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
49 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
53 #include "Eigen/Dense"
56 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5)
57 #pragma GCC diagnostic pop
59 #pragma GCC diagnostic warning "-Wunused-local-typedefs"
130 void evonetUpdated();
133 static const int MAXSTOREDACTIVATIONS = 100;
135 static const int MAXN = 1000;
162 static void describe( QString type );
183 return &neuronsMonitorUploader;
199 void setNetworkName(
const QString& name);
205 const QString& getNetworkName()
const;
216 void create_net_block(
int inputNeuronType,
int hiddenNeuronType,
int outputNeuronType,
bool recurrentHiddens,
bool inputOutputConnections,
bool recurrentOutputs,
bool biasOnHidden,
bool biasOnOutput );
223 int load_net_blocks(
const char *filename,
int mode);
230 void save_net_blocks(
const char *filename,
int mode);
240 void readNewPheLine(QStringList,
float*,
float*);
251 void readOldPheLine(QStringList,
float*,
float*);
264 void computeParameters();
271 int setInput(
int inp,
float value);
277 float getOutput(
int out);
283 float getInput(
int in);
289 float getHidden(
int h);
297 int freeParameters();
301 float getFreeParameter(
int i);
307 void setParameters(
const float* dt);
313 void setParameters(
const int* dt);
320 void getMutations(
float* mut);
327 void copyPheParameters(
int* pheGene);
338 int getParamBias(
int nbias);
357 void injectHidden(
int nh,
float val);
363 float logistic(
float f);
389 float getNeuron(
int in);
393 bool pheFileLoaded();
400 void activateMonitorUpdate();
404 void deactivateMonitorUpdate();
406 char neuronl[MAXN][10];
410 int neurondisplay[MAXN];
415 double neuronrange[MAXN][2];
419 QColor neurondcolor[MAXN];
423 bool neuronlesion[MAXN];
427 float neuronlesionVal[MAXN];
440 void setRanges(
double weight,
double bias,
double gain);
451 float* getOldestStoredActivations();
483 void prepareForTraining(QVector<float>& err_w);
487 float tansig(
float f);
493 void initWeightsInRange(
float min,
float max);
501 void initWeightsInRange(
float minBias,
float maxBias,
float minWeight,
float maxWeight);
507 void initWeightsNguyenWidrow(
float min,
float max);
526 float computeMeanSquaredError(QVector<float> trainingSet, QVector<float> desiredOutput);
533 bool showTeachingInput();
541 float getTeachingInputEntry(
int id);
548 float getBackPropError();
557 float backPropStep(QVector<float> tInput,
double rate);
567 float backPropStep2(QVector<float> tInput,
double rate);
575 void calculateBackPropagationError(QVector<float> tInput);
580 void initBackPropFreep();
585 void updateWeightsAfterBackProp();
592 float* getBackPropWeightModification();
594 void saveCopyBackPropFreep();
596 void initCopyBackPropFreep();
598 float* getCopyBackPropFreep();
600 float* getActivations();
602 float* getNetInputs();
610 float trainLevembergMarquardt(QVector<float> trainingSet, QVector<float> desiredOutput,
float maxError);
618 float trainLevembergMarquardtThroughTime(QVector<float> trainingSet, QVector<float> desiredOutput,
int time,
float maxError);
627 int extractWeightsFromNet(Eigen::VectorXf& w);
631 int importWeightsFromVector(Eigen::VectorXf& w);
632 int importWeightsFromMATLABFile(
char *path);
633 int exportWeightsToMATLABFile(
char *path);
637 float getWeight(
int to,
int from);
641 void setWeight(
int to,
int from,
float w);
645 void setNeckReflex();
650 bool inTraining() {
return training; };
652 int isHidden(
int neuron);
656 float derivative(
int n,
float x);
669 int n_outputsToTrain;
673 char *outputsToTrain;
675 char **trainingHiddenBlock;
677 QVector<float> err_weights;
678 float err_weight_sum;
708 int net_block[MAXN][6];
712 int neuronbias[MAXN];
716 int neurontype[MAXN];
720 int neurongain[MAXN];
724 int neuronxy[MAXN][2];
747 float storedActivations[MAXSTOREDACTIVATIONS][MAXN];
748 int nextStoredActivation;
749 int firstStoredActivation;
757 float netinput[MAXN];
765 float *backpropfreep;
767 float *copybackpropfreep;
775 QVector<float> teachingInput;
int nselected
Number of parameters selected through the graphic interface Enable the user to modify the parameters ...
FARSA_UTIL_TEMPLATE const T max(const T &t1, const U &t2)
bool updateNeuronMonitor
Set to true if labels or colors have to be updated in the neuron monitor.
bool updateLabelAndColors
If true the gui should update labels and colors.
DataUploader< ActivationsToGui > * getNeuronsMonitorUploader()
Returns the uploader for activations.
EvonetUI * getCurrentUIManager() const
Returns the current instance of the UI manager.
This file contains the common type defitions used on the whole framework.
int neuronlesions
Whether one or more neurons have been lesioned.
QVector< float > data
The vector with data.
Evonet is the neural network taken from the EvoRobot.
QVector< QColor > neurondcolor
The color for each neuron.
bool activations
Whether data in the vector is neurons activations or net intput and error.
FARSA_UTIL_TEMPLATE const T min(const T &t1, const U &t2)
int maxIterations
Maximum number of training iteration.
The class with data exchanged with the GUI.
float ** selectedp
pointer to the list pointer-to-parameters selected through the graphic interface Enable the user to m...
QVector< QString > neuronl
Neuron labels.
int updatesCounter
The current step.
static const float DEFAULT_VALUE
DEFAULT_VALUE is used for do not assign values to mut and parameters.