Backprop + neuro-evolution in the browser
Version 1.3.0 is on its way, it will have drastic speed improvements!
Neataptic offers extremely flexible networks; neurons and synapses can be removed with a single line of code. No fixed architecture is required for neural networks to function at all. An important aspect that Neataptic introduces is the evolution of neural-networks: for every problem, a neural network can be evolved.
Neataptic trains more than 5x faster than competitors. Run the tests yourself.
Use any of the 6 built-in networks with customisable sizes to create a network:
var myNetwork = new Architect.LSTM(1,10,5,1);
Or built your own network with pre-built layers:
var input = new Layer.Dense(2);
var hidden1 = new Layer.LSTM(5);
var hidden2 = new Layer.GRU(3);
var output = new Layer.Dense(1);
input.connect(hidden1);
hidden1.connect(hidden2);
hidden2.connect(output);
var myNetwork = Architect.Construct([input, hidden1, hidden2, output]);
You can even built your network neuron-by-neuron using nodes and groups!
Neural networks can be used for nearly anything; driving a car, playing a game and even to predict words! At this moment, the website only displays a small amount of examples. If you have an interesting project that you want to share with other users of Neataptic, feel free to create a pull request!
Basic XOR example:
var network = new Architect.Perceptron(2,4,1);
// Train the XOR gate
network.train([{ input: [0,0], output: [0] },
{ input: [0,1], output: [1] },
{ input: [1,0], output: [1] },
{ input: [1,1], output: [0] }]);
network.activate([0,1]); // 0.9824...
Or predict timeseries with a NARX network (run it here yourself):
var narx = new Architect.NARX(1, 5, 1, 3, 3);
// Train a sequence: 00100100..
narx.train([
{ input: [0], output: [0] },
{ input: [0], output: [0] },
{ input: [0], output: [1] },
{ input: [1], output: [0] },
{ input: [0], output: [0] },
{ input: [0], output: [0] },
{ input: [0], output: [1] }
]);
narx.activate([0]); // 0.0275
narx.activate([0]); // 0.0370
narx.activate([0]); // 0.8695
You can also evolve neural networks to perform as an XOR gate (in sequence):
// this network even learns to do an XOR sequence (recurrent)
var network = new Network(1,1);
// trainingSet = XOR sequence
network.evolve(trainingSet, {
mutation: Methods.Mutation.ALL,
equal: true,
popSize: 100,
elitism: 10,
amount: 10
});
network.activate([0]); // 0.0398
network.activate([1]); // 0.9711
network.activate([1]); // 0.0008
network.activate([0]); // 0.9756
More:
Neuroevolution examples (supervised)
LSTM timeseries (supervised)
Color classification (supervised)
Agar.io-AI (unsupervised)
Target seeking AI (unsupervised)
I need your opinion here!
Head over to the wiki for detailed usage. If you want to visualise your graphs, head over to the graph folder.
Neataptic files are hosted by rawgit, just copy this link into the <head>
tag:
<script src="https://wagenaartje.github.io/neataptic/cdn/1.2.34/neataptic.js"></script>
Installing with node is also possible:
npm install neataptic
Parts of Synaptic where used to develop Neataptic.
You made it all the way down! If you appreciate this repo and want to support the development of it, please consider donating 👍