View Javadoc

1   /*
2    * Created on Sep 7, 2004
3    */
4   package yawn.nn.committee.functions;
5   
6   /***
7    * 
8    * <p>$Id: Average.java,v 1.4 2005/04/20 18:55:19 supermarti Exp $</p>
9    * 
10   * @author Luis Mart&iacute; (luis dot marti at uc3m dot es)
11   * @version $Revision: 1.4 $
12   */
13  public class Average extends CommitteeFunction {
14  
15      /***
16       * 
17       */
18      public Average() {
19          super();
20      }
21  
22      protected double piecewise(double[] x) {
23          double res = 0;
24          for (int i = 0; i < x.length; i++) {
25              res += x[i];
26          }
27          return res / x.length;
28      }
29  
30  }