// Called on the nueral network to initalize mutation to its weights public void mutate(double rate) { Globals.mutationRate = rate; weights_ho.map(mutateFunc); weights_ih.map(mutateFunc); bias_h.map(mutateFunc); bias_o.map(mutateFunc); }
public double[] predict(double[] input_array) { matrix inputs = matrix.fromArray(input_array); matrix hidden = matrix.multiply(this.weights_ih, inputs); hidden.add(bias_h); hidden.map(Globals.activation_function.sig.func1); // Generating outputs matrix output = matrix.multiply(this.weights_ho, hidden); output.add(this.bias_o); output.map(Globals.activation_function.sig.func1); return(output.toArray()); }
// This function is never used in this car project public double[] feedForward(double[] input_array) { // Generating the hidden outputs matrix inputs = matrix.fromArray(input_array); matrix hidden = matrix.multiply(this.weights_ih, inputs); hidden.add(this.bias_h); // Activation fucntion! hidden.map(sigmoid); // Generating the output's output matrix output = matrix.multiply(this.weights_ho, hidden); output.add(this.bias_o); output.map(sigmoid); // Send back to the caller return(output.toArray()); }