cazala / synaptic

architecture-free neural network library for node.js and the browser
http://caza.la/synaptic
Other
6.92k stars 665 forks source link

backpropagation across multiple networks via projections #128

Open jackbackes opened 8 years ago

jackbackes commented 8 years ago

Let's say I have a network structure like this:

[0,1] -> PerceptronOne -> PerceptronTwo -> PerceptronThree -> [1,0]

( I'm using "->" shorthand for network.project(otherNetwork) )

if I call:

let result1 = PerceptronOne.activate([0,1])
let result2 = PerceptronTwo.activate(result1)
PerceptronThree.activate(result1)
PerceptronThree.propagate(0.1, [1,0])

how do I get this to propagate all the way back through the network, not just PerceptronThree? Would I also call propagate on PerceptronTwo and PerceptronOne with [1,0] ?

cazala commented 8 years ago

If PerceptronTwo projects connections to PerceptronThree and PerceptronOne projects connections to PerceptronTwo, then just:

PerceptronThree.propagate(0.1, [1,0])
PerceptronTwo.propagate(0.1)
PerceptronOne.propagate(0.1)

Also, the line PerceptronThree.activate(result1) should be PerceptronThree.activate(result2) if your topology is:

[0,1] -> PerceptronOne -> PerceptronTwo -> PerceptronThree -> [1,0]

Otherwise it is more like:

[0,1] -> PerceptronOne -> PerceptronTwo -> PerceptronThree -> [1,0]
                   |_________________________^

Which is a valid topology, but is not what you show in the diagram on your comment

jackbackes commented 8 years ago

ok, cool. I will try this and let you know.