Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool BinaryNeuron::TrainNeuron(std::vector<bool> NeuronInput, bool Output)
- {
- if (this->initialised == false) return false;
- float WeigthSum = 0, Correction;
- bool Error;
- for (int i = 0; i < this->Weigths.size(); i++)
- {
- WeigthSum += (this->Weigths[i] * NeuronInput[i + 1]);
- }
- Error = (Output ^ (WeigthSum >= this->BreakValue));
- if (!Error) return true;
- Correction = Error*this->LearnVal;
- for (int i = 0; i < this->Weigths.size(); i++)
- {
- this->Weigths[i] = (this->Weigths[i] + (NeuronInput[i] * Correction));
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement