summaryrefslogtreecommitdiffstats
path: root/Master/Modellbildung_und_Simulation/Aufgabenblatt3/MLP/src/MLP.h
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Master/Modellbildung_und_Simulation/Aufgabenblatt3/MLP/src/MLP.h
downloadStudium-master.tar.gz
Studium-master.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Master/Modellbildung_und_Simulation/Aufgabenblatt3/MLP/src/MLP.h')
-rw-r--r--Master/Modellbildung_und_Simulation/Aufgabenblatt3/MLP/src/MLP.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt3/MLP/src/MLP.h b/Master/Modellbildung_und_Simulation/Aufgabenblatt3/MLP/src/MLP.h
new file mode 100644
index 0000000..fdb32a3
--- /dev/null
+++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt3/MLP/src/MLP.h
@@ -0,0 +1,64 @@
+/*
+ * MLP.h
+ *
+ * Created on: 09.06.2011
+ * Author: sven
+ */
+
+#ifndef MLP_H_
+#define MLP_H_
+
+#include "MLPConfig.h"
+#include <boost/thread.hpp>
+
+typedef vector<double> Activity;
+typedef vector<double> Delta;
+typedef vector<double> Pattern;
+typedef vector<double> Target;
+typedef vector<double> Output;
+
+struct Trainingpair {
+ Pattern mPattern;
+ Target mTarget;
+};
+
+typedef vector<Trainingpair> Traindata;
+
+class MLP {
+public:
+ MLP(const MLPConfig&);
+ virtual ~MLP();
+ void train(const Traindata&, const Traindata&, const uint32_t, const std::string&);
+ void propagate(const Pattern&, Output& result);
+ void stop();
+
+private:
+ uint32_t mStartHidden;
+ uint32_t mStartOutput;
+ uint32_t mNoNeuron;
+ Weights mWeights;
+ Activity mActivity;
+ Delta mDelta;
+ Weights mDeltaWeights;
+ Weights mOldUpdate;
+ double mMomentum;
+ double mLernrate;
+ const MLPConfig& mConfig;
+ double mOldError;
+ Weights mOldWeights;
+ bool mTrainSuccess;
+ bool mDoStop;
+ boost::mutex mMutex;
+
+ double sigmoid(const double&);
+ void propagate(const Pattern&);
+ void back_propagate(const Target&);
+ void update_weight();
+ void reset_delta();
+ double validate(const Traindata&);
+ void dump();
+ void writeWeightsToFile(const string&, const Weights&);
+ bool isStop();
+};
+
+#endif /* MLP_H_ */