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

Possible to remove neurons? #159

Open t-mullen opened 8 years ago

t-mullen commented 8 years ago

Does Synaptic support removal/disconnection of neurons after training?

If not, is there any way to implement dropout?

wagenaartje commented 7 years ago

Yes there is! Well... indirectly though. The good ol' toJSON() allows this.

var network = new synaptic.Architect.Perceptron(2,2,1);
var networkJSON = network.toJSON();
networkJSON.connections.splice(index,1); // e.g. this is how to remove a certain connection
networkJSON.neurons.splice(index,1); // e.g. this is how to remove a certain neuron
network = synaptic.Network.fromJSON(networkJSON); // convert it back

You can even manually remove them by JSON.stringify() and then just deleting one of the elements in the neurons or connections array.

Jabher commented 7 years ago

@wagenaartje dropout is required during training phase, I'm afraid this approach will, kinda, make everything veeery slow