📄 nnbpdlg.h
字号:
// NNBPDlg.h : header file
//
#if !defined(AFX_NNBPDLG_H__2B61537F_0142_4686_8E50_6933D6FC4ED1__INCLUDED_)
#define AFX_NNBPDLG_H__2B61537F_0142_4686_8E50_6933D6FC4ED1__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "matrix.h"
class CNNBPDlg;
struct STHREADDATA
{
CNNBPDlg *pDlg;
};
/////////////////////////////////////////////////////////////////////////////
// CNNBPDlg dialog
class CNNBPDlg : public CDialog
{
// Construction
public:
CNNBPDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CNNBPDlg)
enum { IDD = IDD_NNBP_DIALOG };
CButton m_btnStopTrain;
CButton m_btnState;
CButton m_btnSimuResultBrowser;
CButton m_btnSimuNetworkFoldBrowser;
CButton m_btnSimuDataInputBrowser;
CButton m_btnExit;
CButton m_btnDemoSaveResultBrowser;
CButton m_btnDemoSaveNetworkBrowser;
CButton m_btnDemoDataInputBrowser;
CComboBox m_ctrlComboFunc;
CComboBox m_ctrlComboArithmetic;
CButton m_btnBeginTrain;
CButton m_btnAboutUs;
CString m_strDemoDataInput;
CString m_strDemoSaveNetwork;
CString m_strDemoSaveResult;
UINT m_nHideLayerNumber;
UINT m_nInputLayerNumber;
UINT m_nMaxTrainTimes;
UINT m_nOutputLayerNumber;
CString m_strSimuDataInput;
CString m_strSimuNetworkFold;
CString m_strSimuResult;
double m_nStep;
double m_nSystemError;
double m_nSystemErrorLevel;
UINT m_nTrainTimes;
int m_nComboArithmetic;
int m_nComboFunc;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNNBPDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CNNBPDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnAboutUs();
afx_msg void OnBeginTrain();
afx_msg void OnDemoDataInputBrowser();
afx_msg void OnDemoSaveNetworkBrowser();
afx_msg void OnDemoSaveResultBrowser();
afx_msg void OnSimuDataInputBrowser();
afx_msg void OnSimuNetworkFoldBrowser();
afx_msg void OnSimuResultBrowser();
afx_msg void OnStopTrain();
afx_msg void OnState();
afx_msg void OnExit();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
// 是否开始训练的标志
bool m_bStartFlag;
// 是样本训练还是数据仿真?
bool m_bSimulateDataFlag;
// 数据仿真
bool SimulateData();
// 样本训练
bool TrainingDemo();
private:
// 向文件中写入常量字符串
bool SaveConstantStringToFile(CString& strFileName,CString& strConstantData);
// Levenberg-Marquart ----> 第一次前向计算初始化
void LMForwardCalculateInit( int nInputLayerNumber,
int nHideLayerNumber,
int nOutputLayerNumber,
CMatrix &matrixDemoDataInput,
CMatrix &matrixInputLayerValue,
CMatrix &matrixInputToHideWeightValue,
CMatrix &matrixHideLayerValveValue,
CMatrix &matrixHideToOutputWeightValue,
CMatrix &matrixOutputLayerValveValue
);
// Levenberg-Marquart ----> 前向计算
void LMForwardCalculate ( int nInputLayerNumber,
int nHideLayerNumber,
int nOutputLayerNumber,
bool bSimulateDataFlag,
int nComboFunc,
CMatrix &matrixDemoDataInput,
CMatrix &matrixInputLayerValue,
CMatrix &matrixInputToHideWeightValue,
CMatrix &matrixHideLayerValveValue,
CMatrix &matrixHideLayerOutput,
CMatrix &matrixHideToOutputWeightValue,
CMatrix &matrixOutputLayerOutput,
CMatrix &matrixOutputLayerValveValue
);
// Levenberg-Marquart ----> 反馈计算
bool LMDemoDataTrainRepeat ( int nInputLayerNumber,
int nHideLayerNumber,
int nOutputLayerNumber,
bool bSimulateDataFlag,
int nComboFunc,
double nSystemErrorOld,
double nSystemErrorNew,
double nSystemErrorLevel,
double nSystemError,
double nStep,
UINT nMaxTrainTimes,
UINT nTrainTimes,
DWORD ID_SYSTEM_ERROR,
DWORD ID_TRAIN_TIMES,
HWND hWnd,
CMatrix &matrixDemoDataInput,
CMatrix &matrixInputLayerValue,
CMatrix &matrixInputToHideWeightValue,
CMatrix &matrixHideLayerValveValue,
CMatrix &matrixHideLayerOutput,
CMatrix &matrixHideToOutputWeightValue,
CMatrix &matrixOutputLayerOutput,
CMatrix &matrixOutputLayerValveValue
);
// 前向计算初始化
void ForwardCalculateInit();
// 反复训练
bool DemoDataTrainRepeat();
public:
// 用于存储输入的样本数据的矩阵
CMatrix m_matrixDemoDataInput;
// 样本的输入层的数值矩阵
CMatrix m_matrixInputLayerValue;
// 输入层到隐含层的权值矩阵
CMatrix m_matrixInputToHideWeightValue;
// 隐含层的阀值矩阵
CMatrix m_matrixHideLayerValveValue;
// 隐含层到输出层的权值矩阵
CMatrix m_matrixHideToOutputWeightValue;
// 输出层的阀值矩阵
CMatrix m_matrixOutputLayerValveValue;
// 隐含层的输出值的矩阵
CMatrix m_matrixHideLayerOutput;
// 输出层的输出值的矩阵
CMatrix m_matrixOutputLayerOutput;
// 用来仿真时输入的网络参数矩阵
CMatrix m_matrixSimuNetwork;
// 用来存放仿真数据结果的矩阵
CMatrix m_matrixSimuResult;
// 创建新的线程的线程句柄
HANDLE m_hThread;
// 系统误差
double m_SystemErrorNew;
double m_SystemErrorOld;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_NNBPDLG_H__2B61537F_0142_4686_8E50_6933D6FC4ED1__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -