SHARE
TWEET

Untitled

a guest Jan 24th, 2020 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Override
  2.     protected void epoch() {
  3.         for (Point point : points) {
  4.             Map<Integer, Double> neuronIdWithDistanceMap = new HashMap<>();
  5.             double distance;
  6.             for (int i = 0; i < neurons.size(); i++) {
  7.                 distance = point.calculateDistance(neurons.get(i));
  8.                 neuronIdWithDistanceMap.put(i, distance);
  9.             }
  10.  
  11.             List<Integer> sortedNeuronsId = neuronIdWithDistanceMap.entrySet().stream()
  12.                     .sorted((Map.Entry.comparingByValue()))
  13.                     .map(Map.Entry::getKey)
  14.                     .collect(Collectors.toList());
  15.  
  16.             int neuronOrder = 1;
  17.             for (Integer neuronId : sortedNeuronsId) {
  18.                 neurons.get(neuronId).moveCloser(point, 0.01 / Math.pow(neuronOrder, 3));
  19.                 neuronOrder++;
  20.             }
  21.         }
  22.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top