-
Notifications
You must be signed in to change notification settings - Fork 1
/
BackPro.h
98 lines (90 loc) · 2.67 KB
/
BackPro.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// BackPro.h: interface for the CBackPro class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_BACKPRO_H__E2F48542_1E04_4B71_9935_52B7A6B17724__INCLUDED_)
#define AFX_BACKPRO_H__E2F48542_1E04_4B71_9935_52B7A6B17724__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <malloc.h>
#include <time.h>
#include <math.h>
#include <algorithm>
#include <functional>
typedef struct tag_INPUT
{
vector<double> input;
vector<double> output;
int id;
}INPUTPATTERN;
typedef struct tag_PATTERN
{
int start,jumhuruf;
}PATTERNKATA;
class CBackPro
{
public:
void SetInputOutputLength(UINT uiNumInput, UINT uiNumOutput);
void Load();
void SetConnDB(CADODatabase *db);
void Save(CProgressCtrl * pProg);
void SetParam(UINT uiNumHidden,double dEta, double dTargetError,UINT uiMaxEpoh);
void InitWeight();
void Reset();
void AddData(INPUTPATTERN _input);
void Learning(CProgressCtrl * pProg,CEdit * pStatus);
CBackPro();
vector<double> Test(vector<double> input);
BOOL m_bStop;
virtual ~CBackPro();
private:
void GetTotalHessian();
void DevideHessian(int d);
void EraseHessian();
void CalculateHessian(INPUTPATTERN inputx);
void TotalError(CEdit * pStatus);
void UpdateWeight();
void ResetDeltaWeight();
void CalculateError(INPUTPATTERN inputx);
void FeedForward(INPUTPATTERN inputx);
void CatatBobot();
void Normalize();
void WriteLog(CString sText);
CFile m_fLog;
vector<int> m_vOrder;
vector<PATTERNKATA> m_vPatternKata;
vector<INPUTPATTERN> m_vLearningData;
vector<double> y;
vector<double> y_in;
vector<double> z;
vector<double> z_in;
vector<double> errorhiddenlayer;
vector< vector<double> > m_vWeightInput2Hidden;
vector< vector<double> > m_vBestWeightInput2Hidden;
vector< vector<double> > m_vErrorWeightInput2Hidden;
vector< vector<double> > m_vWeightHidden2Output;
vector< vector<double> > m_vBestWeightHidden2Output;
vector< vector<double> > m_vErrorWeightHidden2Output;
vector< vector<double> > m_v2WeightInput2Hidden;
vector< vector<double> > m_v2WeightHidden2Output;
vector<double> m_vOutputError;
vector<double> m_vHiddenError;
double m_dEta;
double m_dTargetError;
double m_dMSE;
double m_dErrAbs;
double m_dMinMSE;
double m_dMinErrAbs;
double ActivationDerivative( double y_in);
double Activation( double z_in);
UINT m_uiMaxEpoch;
UINT m_uiNumInput;
UINT m_uiNumHidden;
UINT m_uiNumOutput;
UINT m_uiIterations;
int m_iPrevId;
int m_iJumHuruf;
int m_iJumKata;
CADODatabase *m_pDb;
};
#endif // !defined(AFX_BACKPRO_H__E2F48542_1E04_4B71_9935_52B7A6B17724__INCLUDED_)