C++写三层神经网络:
整体网络框架搭建:
bp.h
#include <vector>
// #define LAYER 3
// #define NUM 10
const int NUM = 10;
const int LAYER = 3;
using namespace std;
struct Data
{
vector<double> x;
vector<double> y;
};
class BP{
private:
int in_num;
int out_num;
int hd_num;
vector<Data> data;
vector<vector<double>> testdata;
vector<vector<double>> result;
int rowLen;
int restrowLen;
double w[LAYER][NUM][NUM];
double b[LAYER][NUM];
double x[LAYER][NUM];
double d