📄 nnmod.h
字号:
#if !defined(AFX_NNMOD_H__F30C89A5_D273_4FEB_99A0_9C142E15DD82__INCLUDED_)
#define AFX_NNMOD_H__F30C89A5_D273_4FEB_99A0_9C142E15DD82__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// NNMod.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CNNMod form view
#ifndef __AFXEXT_H__
#include <afxext.h>
#endif
//***************************************************************************
// Add the required header files
#include "Matrix.h"
#include "ForecastDlg.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 CNNMod;
/////////////////////////////////////////////////////////////////////////////
// 线程结构体
struct STHREADDATA
{
CNNMod *pDlg;
};
//***************************************************************************
/////////////////////////////////////////////////////////////////////////////
//zdh加入结束
class CNNMod : public CFormView
{
protected:
CNNMod(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CNNMod)
// Form Data
public:
//{{AFX_DATA(CNNMod)
enum { IDD = IDD_NNLOG };
CButton m_btnStopTrain;
CButton m_btnState;
CButton m_btnSimuResultBrowser;
CButton m_btnSimuNetworkFoldBrowser;
CButton m_btnSimuDataInputBrowser;
CButton m_btnDemoSaveNetworkBrowser;
CButton m_btnDemoDataResultBrowser;
CButton m_btnDemoDataInputBrowser;
CComboBox m_ctrlComboFunc;
CComboBox m_ctrlComboArithmetic;
CButton m_btnBeginTrain;
int m_nComboArithmetic;
int m_nComboFunc;
CString m_strDemoDataInput;
CString m_strDemoSaveNetwork;
CString m_strDemoSaveResult;
UINT m_nInputLayerNumber;
UINT m_nHideLayerNumber;
UINT m_nMaxTrainTimes;
UINT m_nOutputLayerNumber;
CString m_strSimuDataInput;
CString m_strSimuNetworkFold;
double m_nStep;
double m_nSystemError;
UINT m_nTrainTimes;
CString m_strSimuResult;
double m_nSystemErrorLevel;
CString m_MDescription;
//}}AFX_DATA
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNNMod)
public:
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CNNMod();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
//{{AFX_MSG(CNNMod)
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 OnState();
afx_msg void OnStopTrain();
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
afx_msg void OnForecast();
afx_msg void OnModVarDefine();
afx_msg void OnModeling();
afx_msg void OnDocument();
afx_msg void OnDatabase();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
CForecastDlg m_ForecastDlg;
// 是否开始训练的标志
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_NNMOD_H__F30C89A5_D273_4FEB_99A0_9C142E15DD82__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -