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;
 }
 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;
 }
 private int getCounter(int output, KMetaDependencies meta) {
   return output * (NUMOFFIELDS * meta.origin().inputs().length + 1)
       + NUMOFFIELDS * meta.origin().inputs().length;
 }
 private int getIndex(int input, int output, int field, KMetaDependencies meta) {
   return output * (NUMOFFIELDS * meta.origin().inputs().length + 1) + NUMOFFIELDS * input + field;
 }