cazala / synaptic

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

Fix squash #205

Closed wagenaartje closed 7 years ago

wagenaartje commented 7 years ago

In the network.toJSON() function, RELU was not included as squash type to convert to json for neurons.

How to cause an error with this:

// create a network
var network = new Architect.Perceptron(1,2,1);
// change squash function of neuron 0 in hidden layer
network.layers.hidden[0].list[0].squash = Neuron.squash.RELU;
// convert to json and check squash
console.log(network.toJSON().neurons[1].squash)

This will log null as squash function. Right now, if you use neurons with this squash function and save the network for later, it would convert null to Neuron.squash.LOGISTIC so your saved network will function differently after loaded with Network.fromJSON(). by merging this pull request the squash type will be saved correctly for RELU.

wagenaartje commented 7 years ago

Oh, it was reported more than 5 months ago. Yeez. https://github.com/cazala/synaptic/issues/112

cazala commented 7 years ago

good catch (: thanks!