28 #include "parametersettable.h"
29 #include "simpletimer.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"
109 void evonetUpdated();
112 static const int MAXSTOREDACTIVATIONS = 100;
114 static const int MAXN = 1000;
141 static void describe( QString type );
156 void setNetworkName(
const QString& name);
162 const QString& getNetworkName()
const;
173 void create_net_block(
int inputNeuronType,
int hiddenNeuronType,
int outputNeuronType,
bool recurrentHiddens,
bool inputOutputConnections,
bool recurrentOutputs,
bool biasOnHidden,
bool biasOnOutput );
180 int load_net_blocks(
const char *filename,
int mode);
187 void save_net_blocks(
const char *filename,
int mode);
197 void readNewPheLine(QStringList,
float*,
float*);
208 void readOldPheLine(QStringList,
float*,
float*);
221 void computeParameters();
228 int setInput(
int inp,
float value);
234 float getOutput(
int out);
240 float getInput(
int in);
246 float getHidden(
int h);
254 int freeParameters();
258 float getFreeParameter(
int i);
264 void setParameters(
const int* dt);
271 void getMutations(
float* mut);
278 void copyPheParameters(
int* pheGene);
289 int getParamBias(
int nbias);
308 void injectHidden(
int nh,
float val);
314 float logistic(
float f);
340 float getNeuron(
int in);
344 bool pheFileLoaded();
348 char neuronl[MAXN][10];
352 int neurondisplay[MAXN];
357 double neuronrange[MAXN][2];
361 QColor neurondcolor[MAXN];
365 bool neuronlesion[MAXN];
369 float neuronlesionVal[MAXN];
378 void setRanges(
double weight,
double bias,
double gain);
389 float* getOldestStoredActivations();
421 void prepareForTraining(QVector<float>& err_w);
425 float tansig(
float f);
431 void initWeightsInRange(
float min,
float max);
439 void initWeightsInRange(
float minBias,
float maxBias,
float minWeight,
float maxWeight);
445 void initWeightsNguyenWidrow(
float min,
float max);
464 float computeMeanSquaredError(QVector<float> trainingSet, QVector<float> desiredOutput);
471 bool showTeachingInput();
479 float getTeachingInputEntry(
int id);
486 float getBackPropError();
495 float backPropStep(QVector<float> tInput,
double rate);
505 float backPropStep2(QVector<float> tInput,
double rate);
513 void calculateBackPropagationError(QVector<float> tInput);
518 void initBackPropFreep();
523 void updateWeightsAfterBackProp();
531 float trainLevembergMarquardt(QVector<float> trainingSet, QVector<float> desiredOutput,
float maxError);
539 float trainLevembergMarquardtThroughTime(QVector<float> trainingSet, QVector<float> desiredOutput,
int time,
float maxError);
548 int extractWeightsFromNet(Eigen::VectorXf& w);
552 int importWeightsFromVector(Eigen::VectorXf& w);
553 int importWeightsFromMATLABFile(
char *path);
554 int exportWeightsToMATLABFile(
char *path);
558 float getWeight(
int to,
int from);
562 void setWeight(
int to,
int from,
float w);
566 void setNeckReflex();
571 bool inTraining() {
return training; };
573 int isHidden(
int neuron);
577 float derivative(
int n,
float x);
590 int n_outputsToTrain;
594 char *outputsToTrain;
596 char **trainingHiddenBlock;
598 QVector<float> err_weights;
599 float err_weight_sum;
629 int net_block[MAXN][6];
633 int neuronbias[MAXN];
637 int neurontype[MAXN];
641 int neurongain[MAXN];
645 int neuronxy[MAXN][2];
668 float storedActivations[MAXSTOREDACTIVATIONS][MAXN];
669 int nextStoredActivation;
670 int firstStoredActivation;
678 float netinput[MAXN];
686 float *backpropfreep;
694 QVector<float> teachingInput;