Guest User

Untitled

a guest
Feb 23rd, 2019
60
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void singleTrainingPattern()
  2. {
  3. cout << "Single training pattern: \n";
  4. cout << rho1 << " < " << "x[i]" << " < " << rho2 << "\n";
  5. cout << omega1 << " < " << "w[i]" << " < " << omega2 << "\n";
  6. cout << rho1 << " < " << "z" << " < " << rho2 << "\n";
  7. vector<double> x;
  8. vector<double> w;
  9. for (int i = 0; i < rozmiarWzorca; i++)
  10. {
  11. x.push_back(2 * randomDouble(rho1, rho2) - 1);
  12. w.push_back(2 * randomDouble(omega1, omega2) - 1);
  13. }
  14.  
  15. double z = randomDouble(rho1, rho2);
  16. double y;
  17.  
  18. cout << "z = " << z << "\n";
  19.  
  20. for (int k = 0; k < liczbaIteracji; k++)
  21. {
  22. y = dot(x, w);
  23.  
  24. for (int i = 0; i < rozmiarWzorca+1; i++)
  25. {
  26. w[i] = w[i] + stalaUczenia * (z - y) * x[i];
  27. }
  28. }
  29.  
  30. y = dot(x, w);
  31. cout << "After training:\n";
  32. cout << "y = " << y << "\n";
  33. cout << "y - z = " << y - z << "\n";
  34. }
RAW Paste Data