📄 bplayer.h
字号:
// BPLayer.h: interface for the CBPLayer class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_BPLAYER_H__A1AD2505_132E_11D5_92B2_E4EDA6A40E5F__INCLUDED_)
#define AFX_BPLAYER_H__A1AD2505_132E_11D5_92B2_E4EDA6A40E5F__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Matrix.h"
class CBPLayer
{
protected:
void F(void); //Y=F(V)
CMatrix DeltaF(); //F'()
public:
void ForWard(CMatrix & P1);//正向传递信息
CMatrix BackWard(CMatrix & E);//误差反向传递,返回前层误差
void initiate(unsigned int NumIn, unsigned int NumOut,unsigned int Mode, double l);
double lr;//学习速度
CMatrix *P;//输入矩阵
CMatrix W;//权系数矩阵
CMatrix B;//偏差矩阵
CMatrix V;//V=W*P+B
CMatrix Y;//Y=F(V)
//CMatrix dw;//dw=D*P'*lr
//CMatrix db;//db=D*ones()*lr
CMatrix D;//D=F'().*E
enum FunctionMode
{
purelin=0x0,
logsig=0x1,
tansig=0x2
}FunctionType;
CBPLayer();
virtual ~CBPLayer();
};
class CBPNet
{
public:
CEdit * m_message;
void Train();
void BackWard();
void ForWard();
void init(CEdit * edit_message,double m_lr,int m_num);
CBPNet();
virtual ~CBPNet();
CMatrix P, T, Y, E;//输入矩阵,期望输出,实际输出
CBPLayer l1,l2;//两层
double sse;//输出误差
double err_goal;//期望误差
double lr;//学习速率
unsigned int max_epoch;//最大循环次数
};
#endif // !defined(AFX_BPLAYER_H__A1AD2505_132E_11D5_92B2_E4EDA6A40E5F__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -