www.pudn.com > BPLetterRecognation.rar > BP.h
#ifndef BP_H
#define BP_H
#define INNUM 64 /*input*/
#define HN 32 /*hidden*/
#define ON 10 /*output*/
#define U0 1
#define YINO 1
#define BETA 0.1
#define AFA 0.6
#define SpNUM 10
#define MINERR 0
double W_IN_HD[HN][INNUM];
double W_HD_OT[ON][HN];
double OT_IN[INNUM]; /*output of input layer*/
double OT_HD[HN]; /*output of hidden layer*/
double OT_OT[ON]; /*output of output layer*/
double delta_HD[HN];
double delta_OT[ON];
double CW_HD[HN]; /*limit value of hidden layer*/
double CW_OT[ON]; /*limit value of output layer*/
//int X[SpNUM][INNUM];
//int T[SpNUM][ON];
double OT[SpNUM][ON];
void init();
double go_one_step();
int recognize( double* to_recog );
double T[SpNUM][ON]=
{
{ 1,0,0,0,0,0,0,0,0,0 },
{ 0,1,0,0,0,0,0,0,0,0 },
{ 0,0,1,0,0,0,0,0,0,0 },
{ 0,0,0,1,0,0,0,0,0,0 },
{ 0,0,0,0,1,0,0,0,0,0 },
{ 0,0,0,0,0,1,0,0,0,0 },
{ 0,0,0,0,0,0,1,0,0,0 },
{ 0,0,0,0,0,0,0,1,0,0 },
{ 0,0,0,0,0,0,0,0,1,0 },
{ 0,0,0,0,0,0,0,0,0,1 },
};
double X[SpNUM][INNUM]=
{
{//A
0,0,0,1,0,0,0,0,
0,0,0,1,0,0,0,0,
0,0,0,1,1,0,0,0,
0,0,1,0,1,0,0,0,
0,0,1,0,1,0,0,0,
0,0,1,1,1,1,0,0,
0,0,1,0,0,1,0,0,
0,1,1,0,0,1,1,0
},
{//B
0,1,1,1,1,0,0,0,
0,0,1,0,0,1,0,0,
0,0,1,0,0,1,0,0,
0,0,1,1,1,0,0,0,
0,0,1,0,0,1,0,0,
0,0,1,0,0,1,0,0,
0,0,1,0,0,1,0,0,
0,1,1,1,1,0,0,0
},
{//C
0,0,1,1,1,1,0,0,
0,1,0,0,0,0,1,0,
0,1,0,0,0,0,0,0,
0,1,0,0,0,0,0,0,
0,1,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