naraku9333

Untitled

Nov 25th, 2015
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. public class Neuron {
  2.     private double value;
  3.     private double error;
  4.    
  5.     /**
  6.      * Links to neurons in next layer
  7.      */
  8.     public ArrayList<Link> forward;
  9.    
  10.     /**
  11.      * Links to neurons in previous layer
  12.      */
  13.     public ArrayList<Link> backward;
  14.    
  15.     /**
  16.      * Constructor
  17.      */
  18.     public Neuron() {
  19.         forward = new ArrayList<>();
  20.         backward = new ArrayList<>();
  21.     }
  22.    
  23.     public double getValue() { return value; }
  24.     public void setValue(double v) { value = v; }
  25.     public double getError() { return error; }
  26.     public void setError(double e) { error = e; }
  27. }
  28.  
  29. public class Link {
  30.     static Random r = new Random();
  31.     public Link() {        
  32.         weight = r.nextDouble();
  33.     }
  34.     public double weight;
  35.     public Neuron prev, next;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment