From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- .../Aufgabenblatt3/MLP/src/MLP.h | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt3/MLP/src/MLP.h (limited to 'Master/Modellbildung_und_Simulation/Aufgabenblatt3/MLP/src/MLP.h') 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 + +typedef vector Activity; +typedef vector Delta; +typedef vector Pattern; +typedef vector Target; +typedef vector Output; + +struct Trainingpair { + Pattern mPattern; + Target mTarget; +}; + +typedef vector 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_ */ -- cgit v1.2.3