backprop.h
来自「windows下台的下的bp神经网络(反向传播算法)源码及工程」· C头文件 代码 · 共 70 行
H
70 行
//////////////////////////////////////////////
// Fully connected multilayered feed //
// forward artificial neural network using //
// Backpropogation algorithm for training. //
//////////////////////////////////////////////
#ifndef backprop_h
#define backprop_h
#include<assert.h>
#include<iostream.h>
#include<stdio.h>
#include<math.h>
class CBackProp{
// output of each neuron
double **out;
// delta error value for each neuron
double **delta;
// vector of weights for each neuron
double ***weight;
// no of layers in net
// including input layer
int numl;
// vector of numl elements for size
// of each layer
int *lsize;
// learning rate
double beta;
// momentum parameter
double alpha;
// storage for weight-change made
// in previous epoch
double ***prevDwt;
// squashing function
double sigmoid(double in);
public:
~CBackProp();
// initializes and allocates memory
CBackProp(int nl,int *sz,double b,double a);
// backpropogates error for one set of input
void bpgt(double *in,double *tgt);
// feed forwards activations for one set of inputs
void ffwd(double *in);
// returns mean square error of the net
double mse(double *tgt) const;
// returns i'th output of the net
double Out(int i) const;
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?