View Javadoc

1   package yawn.nn.appart;
2   
3   import yawn.util.Pattern;
4   
5   /***
6    * An output layer gain control.
7    * 
8    * <p>$Id: GainControlUnitOnOutput.java,v 1.9 2005/05/09 11:04:55 supermarti Exp $</p>
9    * 
10   * @author Luis Mart&iacute; (luis dot marti at uc3m dot es)
11   * @version $Revision: 1.9 $
12   */
13  
14  public class GainControlUnitOnOutput extends GainControlUnit {
15  
16  	/***
17  	 * 
18  	 * @uml.property name="error" 
19  	 */
20  	double error;
21  
22  	/***
23  	 * 
24  	 * @uml.property name="rho" 
25  	 */
26  	public double rho;
27  
28  
29      public double rhoMin;
30  
31  	/***
32  	 * 
33  	 * @uml.property name="rho"
34  	 */
35  	public void setVigilanceParameter(double val) {
36  		rho = val;
37  	}
38  
39  	/***
40  	 * 
41  	 * @uml.property name="rho"
42  	 */
43  	public double getVigilanceParameter() {
44  		return rho;
45  	}
46  
47  
48      public void calculateAbsoluteError(Pattern o, Pattern y) {
49          error = y.dist(o);
50      }
51  
52  	/***
53  	 * 
54  	 * @uml.property name="error"
55  	 */
56  	public double getError() {
57  		return error;
58  	}
59  
60      public void calculateRelativeError(Pattern o, Pattern y) {
61          calculateAbsoluteError(o, y);
62          error = error / y.norm2();
63      }
64  
65      public GainControlUnitOnOutput(double val) {
66          error = 0.0;
67          rho = val;
68          rhoMin = val;
69      }
70  
71      public boolean fires() {
72          return error > rho;
73      }
74  
75  }