Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: AI/NeuralNetworks/PatternPair.java


1   /* PatternPair.java */
2   
3   package AI.NeuralNetworks;
4   
5   /**
6     This class has a input - output pattern for a nerual netwrok
7   */
8   public class PatternPair {
9     float[] input;
10    float[] output;
11    
12    /**
13      Creates a new PatternPair instnce
14      @param input the input pattern of the pair
15      @param output the output pattern of the pair
16    */
17    public PatternPair(float[] input, float[] output){
18      this.input = input;
19      this.output = output;
20    }  
21   
22    /**
23      Returns the input pattern
24    */
25    public float[] input() {
26      return input;
27    }
28  
29    /**
30      Returns the output pattern
31    */
32    public float[] output() {
33      return output;
34    }
35  
36    /** 
37      returns a string representation of the pattern
38      */
39    public String toString() {    
40      return "Input: " + niceArray(input) + "\tOutput: " + niceArray(output);
41    }
42    
43    static private String niceArray(float array[]){
44      String s = "[ ";
45      for(int i=0; i<array.length; i++){
46        s += array[i] + " ";
47      }
48      s+= "]";
49      return s;
50    }
51  
52    
53  }
54  
55    
56