⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bpnet.h

📁 很好用的BP神经网络类
💻 H
字号:
// BPNet.h: interface for the CBPNet class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_BPNET_H__7A0ACB6B_F116_4B2D_8D19_974F755C297A__INCLUDED_)
#define AFX_BPNET_H__7A0ACB6B_F116_4B2D_8D19_974F755C297A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <windows.h>
////////////////定义结构体和宏//////////////////////////////////////
#define UM_CHANGEINFO WM_USER+1
#define UM_SYSTEMICON WM_USER+2
typedef struct 
{
	int ErrorNo;
	int StudyNum;
	double TotleError;
}StudyInfo;
#define MAXSTUDYNUM 10000
#define SENDMSGFREQ 200
#define TestSampleNum 100
#define  PROPORTION 2.5
#define ANGLE 1
#define MAX_STEP 100
#define PI 3.1415926
#define MAX_DECREASE 0.98
#define MIN_DECREASE 0.01
#define DECREASE_STEP 0.01
#define INCREASE_STEP 0.05
#define AB 1
#define VOGL 2
#define NORMAL 3
#define ABVOGLERROR 4
#define ALLERROR 5
#define SCALE 0.8
///////////////////////////////////////////////////
class CBPNet  
{
public:
	int m_Method;
	bool bCreated;
	int Status;
	void DeleteBDNet();
	void CreateBPNet(HWND hWnd,int Inum,int Hnum,int Onum);
	void SetBPParameter(double MinError,double InitStep,double InitMoment,int m_Method);
	void SetStudySample(double **x,double **t,int number);
	void Test(double* Input,double * Output);
	void Study();
	double Sigmoid(double);
	double CaculateTotalError();
	void AdjustWeight();
	void CaculateError();
	void CaculateOutput();
	CBPNet();
	virtual ~CBPNet();
public:
	void ReturnToLast();
	HWND m_hFWnd;
	double **InputX,**OutputY,**Teach,**HidenLayerOut,**OutLayerError,**HidenLayerError,**PowerIH,**PowerHO,*HidenLayerThreshold,*OutLayerThreshold; //x输入
	double **Last_PowerIH,**Last_PowerHO,*Last_HidenLayerThreshold,*Last_OutLayerThreshold;
	double **Old_Last_PowerIH,**Old_Last_PowerHO,*Old_Last_HidenLayerThreshold,*Old_Last_OutLayerThreshold;
	double *MaxInputX,*MaxOutputY;
//    double *last_w1,*last_w2,*last_q,last_p;
//	double *last_dw1,*last_dw2,*last_dq,last_dp;
	//OutputY输出
	//Teach教师
	// HidenLayerOut记录隐单元的输出
	//OutLayerError输出误差
	//HidenLayerErro记录隐单元误差
	//PowerIH输入与第一隐层的权
	//PowerHO第一隐层与输出层的权
	//HidenLayerThreshold第一隐层的阈值
	//OutLayerThreshold输出层的阈值
	double m_coefficient_moment;//动量项系数
	double m_MinError;//最小误差
	double m_Step; //步长
	int m_n;//学习次数
	int HidenLayerNum;//隐节点个数
	int InputLayerNum;
	int OutLayerNum;
	int nSendNum;
	int StudySampleNum;//学习样本个数
	StudyInfo sInfo;
	double EzLast;
	double Ez;
};

#endif // !defined(AFX_BPNET_H__7A0ACB6B_F116_4B2D_8D19_974F755C297A__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -