예제 #1
0
 public double[] getAvg(int output, Array1D state, KMetaDependencies meta) {
   double[] avg = new double[meta.origin().inputs().length];
   double total = state.get(getCounter(output, meta));
   if (total != 0) {
     for (int i = 0; i < meta.origin().inputs().length; i++) {
       avg[i] = state.get(getIndex(i, output, SUM, meta)) / total;
     }
   }
   return avg;
 }
예제 #2
0
 public double[] getVariance(int output, Array1D state, double[] avg, KMetaDependencies meta) {
   double[] variances = new double[meta.origin().inputs().length];
   double total = state.get(getCounter(output, meta));
   if (total != 0) {
     for (int i = 0; i < meta.origin().inputs().length; i++) {
       variances[i] =
           state.get(getIndex(i, output, SUMSQUARE, meta)) / total
               - avg[i] * avg[i]; // x count/ (count-1)
     }
   }
   return variances;
 }
예제 #3
0
 private int getCounter(int output, KMetaDependencies meta) {
   return output * (NUMOFFIELDS * meta.origin().inputs().length + 1)
       + NUMOFFIELDS * meta.origin().inputs().length;
 }
예제 #4
0
 private int getIndex(int input, int output, int field, KMetaDependencies meta) {
   return output * (NUMOFFIELDS * meta.origin().inputs().length + 1) + NUMOFFIELDS * input + field;
 }