📄 backprop.h
字号:
//////////////////////////////////////////////
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -