c語言實現3層bp神經網路

2021-07-10 06:55:32 字數 889 閱讀 7131

#include

using namespace std;

#include "math.h"

//#define e 2.718281828;

#define step 0.5

int w1[3][3] = , , };

int  w2[3][2] = , , };

int x[3] = ;

int y[2] = ;

double getf(float x)

double getj(double *p1,int *p2,int i)

void rukou()

sum[i] = getf(nsum);

printf("%f\n",sum[i]);

}for (int i = 0; i < 2; i++)

sum1[i] = getf(nsum);

printf("%f\n", sum[i]);

} //剛剛計算出了這些東西,需要進行回饋引數的修改。

//首先修改隱含層和輸出之間的引數?。

//這時候需要存放di

double dik[2]; 

for (int i = 0; i < 2; i++)

} for (int i = 0; i < 3; i++)

double di = yi*(1 - yi)*he;

for (int j = 0; j < 3; j++)

} //現在輸出調整後的引數

for (int i = 0; i < 3; i++)

}for (int i = 0; i < 3; i++)

}//現在修改輸入與隱含層的引數關係。

int i;

cin >> i;

}void  he()

C 實現神經BP神經網路

bp.h pragma once include include include include include using std vector using std exp using std cout using std endl class bp bp.cpp include bp.h bp ...

C 實現神經BP神經網路

bp.h pragma once include include include include include using std vector using std exp using std cout using std endl class bp bp.cpp include bp.h bp ...

BP神經網路 c 實現

bp神經網路是通過反向傳播來逐漸修正層之間的權值和每個節點的閾值,可以通過學習率避免走入區域性最優解。include include include include include include include using namespace std define layer 3 三層神經網路 d...