Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. protected void epoch() {
  2.         for (Point point : points) {
  3.             double minDistance = Double.MAX_VALUE;
  4.             double distance;
  5.             int winnerIndex = 0;
  6.             for (int i = 0; i < neurons.size(); i++) {
  7.                 distance = point.calculateDistance(neurons.get(i));
  8.                 if (distance < minDistance) {
  9.                     minDistance = distance;
  10.                     winnerIndex = i;
  11.                 }
  12.             }
  13.             neurons.get(winnerIndex).moveCloser(point, 0.005);
  14.         }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement