📄 nnbpdlg.h
字号:
// NNBPDlg.h : header file
//
#if !defined(AFX_NNBPDLG_H__C646FE1F_4498_483B_8CFF_EC573C349AEB__INCLUDED_)
#define AFX_NNBPDLG_H__C646FE1F_4498_483B_8CFF_EC573C349AEB__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//***************************************************************************
// Add the required header files
#include "Matrix.h"
#include "BtnST.h"
#include "StaticFader.h"
//
//***************************************************************************
/////////////////////////////////////////////////////////////////////////////
// Levenberg-Marquart ----> 第一次前向计算初始化 //
/////////////////////////////////////////////////////////////////////////////
__declspec (dllimport) void LMForwardCalculateInit( int nInputLayerNumber,
int nHideLayerNumber,
int nOutputLayerNumber,
CMatrix &matrixDemoDataInput,
CMatrix &matrixInputLayerValue,
CMatrix &matrixInputToHideWeightValue,
CMatrix &matrixHideLayerValveValue,
CMatrix &matrixHideToOutputWeightValue,
CMatrix &matrixOutputLayerValveValue
);
/////////////////////////////////////////////////////////////////////////////
// Levenberg-Marquart ----> 前向计算 //
/////////////////////////////////////////////////////////////////////////////
__declspec(dllimport) 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 ----> 反馈计算 //
/////////////////////////////////////////////////////////////////////////////
__declspec(dllimport) 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
);
/////////////////////////////////////////////////////////////////////////////
// Back propagation ----> 前向计算(Only for Training) //
/////////////////////////////////////////////////////////////////////////////
__declspec(dllexport) void BPForwardCalculate ( 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,
CMatrix &cMatrixExHideLayerValveValue,
CMatrix &cMatrixExOutputLayerValveValue
);
/////////////////////////////////////////////////////////////////////////////
// Back propagation ----> 前向计算(Only for Simulating) //
/////////////////////////////////////////////////////////////////////////////
__declspec(dllimport) void BPForwardCalculate2( 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
);
/////////////////////////////////////////////////////////////////////////////
// Back propagation ----> 反馈计算 //
/////////////////////////////////////////////////////////////////////////////
__declspec(dllimport) bool BPDemoDataTrainRepeat ( 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
);
//***************************************************************************
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 };
CComboBox m_ctrlComboArithmetic;
CComboBox m_ctrlComboFunc;
CStaticFader m_staticTextTitle;
CButtonST m_btnState;
CButtonST m_btnSimuResultBrowser;
CButtonST m_btnSimuNetworkFoldBrowser;
CButtonST m_btnSimuDataInputBrowser;
CButtonST m_btnDemoSaveResultBrowser;
CButtonST m_btnDemoSaveNetworkBrowser;
CButtonST m_btnDemoDataInputBrowser;
CButtonST m_btnStopTrain;
CButtonST m_btnExit;
CButtonST m_btnAboutUs;
CButtonST m_btnBeginTrain;
CString m_strDemoDataInput;
CString m_strDemoSaveResult;
UINT m_nInputLayerNumber;
UINT m_nHideLayerNumber;
UINT m_nOutputLayerNumber;
int m_nComboFunc;
double m_nSystemError;
UINT m_nTrainTimes;
double m_nSystemErrorLevel;
UINT m_nMaxTrainTimes;
CString m_strDemoSaveNetwork;
CString m_strSimuNetworkFold;
CString m_strSimuDataInput;
CString m_strSimuResult;
int m_nComboArithmetic;
double m_nStep;
//}}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 OnExit();
afx_msg void OnAboutus();
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnDemoDataInputBrowser();
afx_msg void OnDemoSaveNetworkBrowser();
afx_msg void OnDemoSaveResultBrowser();
afx_msg void OnSimuNetworkFoldBrowser();
afx_msg void OnSimuDataInputBrowser();
afx_msg void OnSimuResultBrowser();
afx_msg void OnBeginTrain();
afx_msg void OnState();
afx_msg void OnStopTrain();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
// 是否开始训练的标志
bool m_bStartFlag;
// 是样本训练还是数据仿真?
bool m_bSimulateDataFlag;
// 数据仿真
bool SimulateData();
// 样本训练
bool TrainingDemo();
private:
// 向文件中写入常量字符串
bool SaveConstantStringToFile(CString& strFileName,CString& strConstantData);
// 前向计算初始化
void ForwardCalculateInit();
// 反复训练
bool DemoDataTrainRepeat();
// 用于存储输入的样本数据的矩阵
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__C646FE1F_4498_483B_8CFF_EC573C349AEB__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -