Created
September 23, 2014 00:24
-
-
Save spolu/699025bd4773c2c2a171 to your computer and use it in GitHub Desktop.
NN train
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do { | |
err = 0; | |
for(unsigned int i = 0; i < train_in_.size(); i++) { | |
vector<double> res = this->learn(train_in_[i], train_out_[i]); | |
/* error calculation */ | |
double e = 0; | |
for(unsigned int j = 0; j < res.size(); j++) { | |
e += pow(res[j] - train_out_[i][j], 2); | |
} | |
err += e / res.size(); | |
} | |
err /= train_in_.size(); | |
it++; | |
if(log_) { | |
cout << "[" << it << "] " << err << endl; | |
} | |
} while(err > error && it < iterations); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment