I'm trying to implement a neural network in C++. I've created a class "neural", each neural has a vector of weight define like this :
std::vector <float> weight;
I would like to create in my main fonction a vector of neurals. Each neural has to have its weight vector fill randomly.
Here is how I've tried :
each neurals has a methode to fill the weight vector
void neural::fillWeight(int numWeight)
{
srand(time(NULL));
for (size_t i = 0; i < numWeight; i++)
{
std::cout << "on viens de mettre un poid dans le vecteur" << std::endl;
this->poid.push_back(rand());
}
}
I call it here :
std::vector <neural> vectN ;
for (size_t i = 0; i < 5; i++)
{
neural test = neural(i, 1, 4);
vectN.push_back(test);
}
The problem is that every neural in the vector have the same weight vector. How can I solve this issue ? Thank you in advance for you help
Aucun commentaire:
Enregistrer un commentaire