I have a simple 3 layer NN which cannot converge on just 3 output values why? Please help explain the very basics of backprop in this example. no fancy notation, dont refer me to a YouTube video.
Use plain vanilla JavaScript only
var weights = (new Array(3)).fill(0).map(A => Math.random());
var bais = (new Array(3)).fill(0).map(A => Math.random());
var input = (new Array(3)).fill(0).map(A => (Math.random()));
var output = (new Array(3)).fill(0).map(A => (Math.random()));
function read(x){//forward pass
var A1 = 1/(1 + (Math.E ** -(x * weights[0] + bais[0])));
var A2 = 1/(1 + (Math.E ** -(A1 * weights[1] + bais[1])));
var A3 = 1/(1 + (Math.E ** -(A2 * weights[2] + bais[2])));
return [A1, A2, A3]; //this returns the activations
}
function Learner(){
var W1 = 0;
var W2 = 0;
var W3 = 0;
var B1 = 0;
var B2 = 0;
var B3 = 0;
for(let a=0;a<input.length;a++){//derivative of the last weight with respect to the cost
var out = read(input[a]);
W3 += ( out[1] * (2 * (out[2] - output[a])) * out[2]*(1-out[2]));
B3 += ( (2 * (out[2] - output[a])) * out[2]*(1-out[2]));
}
for(let a=0;a<input.length;a++){
var out = read(input[a]);
W2 += ( out[0] * out[1]*(1-out[1]))*W3;
B2 += ( 1 * out[1]*(1-out[1]))*W3;
}
for(let a=0;a<input.length;a++){
var out = read(input[a]);
W1 += ( input[a] * out[0]*(1-out[0]))*W2;
B1 += ( 1 * out[0]*(1-out[0]))*W2;
}
weights[0] = (weights[0] - 0.1 * W1)/3;
weights[1] = (weights[1] - 0.1 * W2)/3;
weights[2] = (weights[2] - 0.1 * W3)/3;
bais[0] = (bais[0] - 0.1 * B1)/3;
bais[1] = (bais[1] - 0.1 * B2)/3;
bais[2] = (bais[2] - 0.1 * B3)/3;
}
function check(){
for(let a=0;a<output.length;a++){
console.log(read(input[a])[2] + ", " + output[a]); }
}
var INTERVAL = setInterval(Learner, 10, 10);
I obviously don't know how backprop works please help.