javascript - Is this a neural network -


i've spent last 2 days watching youtube videos on neural networks.

in particular, i've been trying implement genetic algorithm evolve on time, however, videos seem focused on neural networks trained, , used classification.

being confused, decided try implement basic structure of network, , have coded - in js, convenience.

function sigmoid (x) { return  1 / (1 + math.e ** -x); } function brain(inputs, hiddens, outputs) {     this.weights = {         hidden: [],         output: []     };      (var = hiddens; i--;) {         this.weights.hidden[i] = [];         (var w = inputs; w--;) this.weights.hidden[i].push(math.random());     }     (var = outputs; i--;) {         this.weights.output[i] = [];         (var w = hiddens; w--;) this.weights.output[i].push(math.random());     } }  brain.prototype.compute = function(inputs) {     var hiddeninputs = [];     (var = this.weights.hidden.length; i--;) {         var dot = 0;         (var w = inputs.length; w--;) dot += inputs[w] * this.weights.hidden[i][w];         hiddeninputs[i] = sigmoid(dot);     }      var outputs = [];     (var = this.weights.output.length; i--;) {         var dot = 0;         (var w = this.weights.hidden.length; w--;) dot += hiddeninputs[w] * this.weights.output[i][w];         outputs[i] = sigmoid(dot);     }     return outputs; }  var brain = new brain(1,2,1); brain.compute([1]); 

i values between 0 , 1. and, when use specific weights, same value each time, constant input.

  1. is terminology i'm using in code good?

  2. i fear may observing false positives, , not feeding forward.

  3. is sigmoid function appropriately? should using genetic / evolving algorithm?

i noticed i'm getting results between 0.5 , 1;

to combine neural network genetic algorithm best shot neat. there implementation of algorithm in js called 'neataptic', should able fint on github.

when combining ga ann want not adjust weights, structure well.

sigmoid activation ok ga, in many cases want other activation functions, can find small list of activation functions on wikipedia or create own ones.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -