📄 bpnet.hpp
字号:
//Header: BPNet.hpp
//Language: Borland C++ 3.1
//Version: 1.0
//Environ: Any
//Author: Liu Kang
//Date: 3/1996
//Purpose: Provide a class for BP neural network
#ifndef __BPNET__HPP
#define __BPNET__HPP
#include "frdnrl.hpp"
#include <fstream.h>
class BPNet:public FrdNrl
{
protected:
double StepLrn; //learn step
double RushLrn; //coefficient of rush when learn
double ErrAllow; //error allowed when learning
double ErrFlAllow; //error fail threshold when learning
void ThdInitial(); //threshold initial method of BP network
int CFGLoad();
int CFGLoadIn(istream&);
int CFGWrite();
int CFGWriteIn(ostream&);
int (*LrnCom)(const long,BPNet&,const Matrix&,double**,double**,const int);
//learn commulacation function pointer,learning continue when return 0
double (*DifFun)(double); //differential function when learning
public:
//constructor
BPNet();
BPNet(char*); //for exist network
BPNet(int ln, int nn[], char* nname=NULL); //for new network
//destructor
~BPNet();
//other methods
virtual long Learn(double **input, double **output, int examplenum);
//network learn method
void SetNdFun(double (*f)(double));
void SetDifFun(double (*f)(double)){ DifFun=f; };
void SetLrnCom(int (*f)(const long,BPNet&,const Matrix&,
double**,double**,const int)) { LrnCom=f; };
void SetErrAllow(double e){ ErrAllow=e;};//error allowed of learning set
void SetStepLrn(double s){ StepLrn=s; };
void SetRushLrn(double r){ RushLrn=r; };
void SetErrFail(double e){ ErrFlAllow=e; };
};
double SigFun(double);
double SigFun1(double);
double InputFun(double x);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -