Created
March 12, 2021 06:39
-
-
Save Albertbol/996e3937ddb129d927a8f96a0680d7c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NeuralNetwork { | |
constructor( | |
inputNodes, | |
hiddenNodes, | |
outputNodes, | |
learningRate, | |
bias, | |
trainingCycles, | |
normalizer | |
) { | |
this.inputNodes = inputNodes | |
this.hiddenNodes = hiddenNodes | |
this.outputNodes = outputNodes | |
this.learningRate = learningRate | |
this.weightsInputToHidden = Matrix.generate( | |
this.hiddenNodes, | |
this.inputNodes, | |
{ randomNormalized: true } | |
) | |
this.weightsHiddenToOutput = Matrix.generate( | |
this.outputNodes, | |
this.hiddenNodes, | |
{ randomNormalized: true } | |
) | |
this.bias = bias | |
this.biasForHidden = Matrix.generate(this.hiddenNodes, 1, { | |
staticNumber: this.bias, | |
}) | |
this.biasForOutput = Matrix.generate(this.outputNodes, 1, { | |
staticNumber: this.bias, | |
}) | |
this.trainingCycles = trainingCycles | |
this.normalizer = normalizer | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment