1.0.2 • Published 5 years ago
jellyfish-brain v1.0.2
��# Simple-Brain
About
jellyfish-brain
is a library of a simple Neural Networks written in JavaScript.
:bulb: Note: You're welcome to check my github repository GabiCtrlZ/simple-brain.
Examples
Here's an example showcasing how to learn a simple task
const Brain = require('jellyfish-brain')
const data = [
{data: [0, 1, 1], result: 0},
{data: [0, 0, 1], result: 0},
{data: [0, 1, 0], result: 0},
{data: [1, 0, 1], result: 1},
{data: [1, 1, 0], result: 1},
]
const b = new Brain(3)
b.train(data)
b.test([1, 0, 0])
b.testPrettify([0, 0, 1])
Usage
Node
If you have node, you can install jellyfish-brain
with npm:
npm install jellyfish-brain
Or if you prefer yarn:
yarn add jellyfish-brain
Training
Use train()
to train the network with an array of training data. The network has to be trained with all the data in bulk in one call to train()
. More training patterns will probably take longer to train, but will usually result in a network better
at classifying new patterns.
Data format
For training with NeuralNetwork
Each training pattern should have an input
and an output
, both of which can be either an array of numbers from 0
to 1
.