Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef MLP_H
- #define MLP_H
- #include <stdlib.h>
- #include <unistd.h>
- #include <algorithm>
- #include <vector>
- #include <ctime>
- #include <iterator>
- #include <cmath>
- #define sigmoid(value) (1/(1+exp(-value)));
- #define dersigmoid(value) (value*(1-value));
- //Macro's
- #define weightItoH(input,hidden) weightsIH.at(nInput*hidden+input)
- #define weightHtoO(hidden,output) weightsHO.at(nHidden*output+hidden)
- class MLP {
- public:
- std::vector<int> inputNeurons;
- std::vector<float> hiddenNeurons;
- std::vector<float> outputNeurons;
- std::vector<float> weightsIH;
- std::vector<float> weightsHO;
- std::vector< std::vector<int> > inputPatterns;
- std::vector<int> desiredOutput;
- std::vector<float> outputDelta;
- std::vector<float> hiddenDelta;
- int nInput;
- int nOutput;
- int nHidden;
- int nInputPatterns;
- int inPutPatterns;
- MLP (int nInput, int nHidden, int nOutput);
- ~MLP();
- void initWeights();
- void printWeights(int i);
- void feedforward();
- void initInput(int i, int j);
- void backPropagation(int i);
- void trainNetwork();
- };
- #endif
Add Comment
Please, Sign In to add comment