+ 1
Why array isnt updating?
Hello everyone! I am doing my first neural network on c++. And I have my array with weights - W0[3][2] I updated it while machine learning, but after that I cant get new values of this array. They are like before machine learning. What am I doing wrong? Thanks. P.s. sorry for my bad eng
3 Réponses
+ 1
Thank you very very much for your reply! I will try to solve this problem with array sizes
+ 1
I have done some experiments with this. And you are right. X_size is always 1 and y_size is always 2. I rewrited code and now it works fine! Thanks a lot! :-)
0
Okey (sorry for some mess in my code)
First of neuron network functions:
void forwards(float Li[][2], float Lo[]
[2], float w[][2]) {
int x_size = sizeof Li/sizeof Li[0];
int y_size = sizeof Li[0]/sizeof Li[0][0];
int y=0;
while (y<y_size) {
Lo[y][0]=0;
int x=0;
while (x<x_size) {
Lo[y][0] = Lo[y][0] + Li[x][0] * w[x][y];
x = x+1;
}
float exp = 2.718;
float minus = -1* Lo[y][0];
float poww = pow(exp, minus);
Lo[y][0] = 1/(1 + poww);
y=y+1;
}
}
And some parts of Main()
float N0[3][2];
float N1[2][2];
float N2[2][2];
float W0[3][2];
float W1[2][2];
float IDL[2][2];
Now I generate random weights (-1...1).
And after that I am calling functions many times for machine learning.
So now my net is working and I need to save results, but when I take W0[0][0], for example, I have that random weight value, but why, I have already done learning..
Sorry for my eng..