package com.jifalops.wsnlocalize.toolbox.neuralnet;

/**
 *
 */
public class MlpWeightMetrics {
    final int numInputs, numOutputs, numHidden, numWeights,
            hiddenBiasesStart, hiddenToOutputStart, outputBiasesStart;

    public MlpWeightMetrics(int numInputs, int numOutputs) {
        this(numInputs, numOutputs, Math.round((numInputs + numOutputs) / 2));
    }

    public MlpWeightMetrics(int numInputs, int numOutputs, int numHidden) {
        this.numInputs = numInputs;
        this.numOutputs = numOutputs;
        this.numHidden = numHidden;
        hiddenBiasesStart = numInputs * numHidden;
        hiddenToOutputStart = hiddenBiasesStart + numHidden;
        outputBiasesStart = hiddenToOutputStart + numHidden * numOutputs;
        numWeights = numHidden * (numInputs + numOutputs + 1) + numOutputs;  // MLP
    }

    public MlpWeightMetrics(Sample sample, double[] weights) {
        this(sample.toArray().length - sample.getNumOutputs(), sample.getNumOutputs(),
                (weights.length - sample.getNumOutputs()) / (sample.toArray().length + 1));
    }

    public MlpWeightMetrics(String csv) {
        String[] p = csv.split(",");
        numInputs = Integer.valueOf(p[0]);
        numOutputs = Integer.valueOf(p[1]);
        numHidden = Integer.valueOf(p[2]);
        hiddenBiasesStart = Integer.valueOf(p[3]);
        hiddenToOutputStart = Integer.valueOf(p[4]);
        outputBiasesStart = Integer.valueOf(p[5]);
        numWeights = Integer.valueOf(p[6]);
    }

    @Override
    public String toString() {
        return numInputs +","+ numOutputs +","+ numHidden +","+ hiddenBiasesStart +","+
                hiddenToOutputStart +","+ outputBiasesStart +","+ numWeights;
    }
}

@@ -823,32 +823,34 @@
   // MLP%0A    %7D%0A%0A
+//
     public MlpWe
@@ -892,24 +892,26 @@
  weights) %7B%0A
+//
         this
@@ -985,16 +985,18 @@
 puts(),%0A
+//
         
@@ -1075,24 +1075,26 @@
 ngth + 1));%0A
+//
     %7D%0A%0A    p

Remove bad constructor (cannot use untimed)