int main() { Vector<Data> data; for (int i = 0; i < 41; i++) { Data t; for (int j = 0; j < 3; j++) t.x.push_back(sample[i][j]); t.y.push_back(sample[i][0] + sample[i][1] + sample[i][2]); data.push_back(t); } BP *bp = new BP(); bp->GetData(data); bp->Train(); while (1) { Vector<Type> in; for (int i = 0; i < 3; i++) { Type v; scanf("%lf", &v); in.push_back(v); } Vector<Type> ou; ou = bp->ForeCast(in); printf("%lf\n", ou[0]); } return 0; }
void main(void) { BP B;//生成一个BP类对象B B.Train();//开始训练 B.BP_Print();//把结果打印出来 B.After_Train_Out();//把结果保存到文件 }//end