From 3a46d27f4ed855dc6181c2f08c08110ec882a8ec Mon Sep 17 00:00:00 2001 From: Makarand Lahane Date: Fri, 9 Feb 2018 14:42:50 +0530 Subject: [PATCH] Multilayer Neural Network Created a multilayer neural network class which uses the matrix library in this repository for matrix operations. Some functionality is changed like you need to pass only 2 parameters(number of input nodes, number of output nodes) to the constructor of the neural network and for adding a hidden layer you need to call the function addHiddenLayer(number of neurons) for adding a hiddenLayer to your neural network and before training and after calling all addHiddenLayer function calls you need to call the config() function. --- MultiLayerNN.js | 109 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 MultiLayerNN.js diff --git a/MultiLayerNN.js b/MultiLayerNN.js new file mode 100644 index 0000000..ed862ba --- /dev/null +++ b/MultiLayerNN.js @@ -0,0 +1,109 @@ +function sigmoid(x) { + return 1/(1+Math.exp(-x)); +} + +function derivSigmoid(x) { + return x*(1-x); +} + + +function meanError(m) { + let sum=0; + for(let i=0;i