-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29d8f28
commit 2578278
Showing
4 changed files
with
66 additions
and
385 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,65 @@ | ||
Multi layer neural network implemented in several languages. | ||
# multi-layer-neural-network | ||
|
||
This is a multi-layer neural network library created in pure JavaScript. (still in development) | ||
|
||
## Usage: | ||
|
||
### Layer creation: | ||
```js | ||
const layer = NeuralNetwork.createLayer({ | ||
nodes: 2, | ||
activation: 'sigmoid' | ||
}); | ||
``` | ||
|
||
### Neural Network initialization: | ||
```js | ||
const brain = NeuralNetwork.createNeuralNetwork({ | ||
inputNodes: 2, | ||
layers: [ | ||
NeuralNetwork.createLayer({ | ||
nodes: 2, | ||
activation: 'sigmoid' | ||
}), | ||
NeuralNetwork.createLayer({ // output layer | ||
nodes: 1, | ||
activation: 'sigmoid' | ||
}) | ||
], | ||
learningRate: 0.1, | ||
}); | ||
``` | ||
|
||
### Training: | ||
```js | ||
const dataset = [ | ||
{ | ||
inputs: [0, 1], | ||
targets: [1] | ||
}, | ||
{ | ||
inputs: [1, 0], | ||
targets: [1] | ||
}, | ||
{ | ||
inputs: [1, 1], | ||
targets: [0] | ||
}, | ||
{ | ||
inputs: [0, 0], | ||
targets: [0] | ||
} | ||
]; | ||
|
||
for(let i = 0; i < 10000; i++) { // how many times we want it to be trained | ||
for(let data of dataset) { | ||
brain.train(data.inputs, data.targets); | ||
} | ||
} | ||
``` | ||
|
||
### Predicting: | ||
```js | ||
const output = brain.predict([0, 1]); | ||
console.log(output); | ||
``` |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.