Exemplo n.º 1
0
 // 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);
 }
Exemplo n.º 2
0
    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());
    }
Exemplo n.º 3
0
    // 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());
    }