Skip to content

Latest commit

 

History

History
187 lines (144 loc) · 5.8 KB

README.md

File metadata and controls

187 lines (144 loc) · 5.8 KB

Carrot Logo

Build Status via Travis CI Carrot's Monthly Downloads Coverage Status Join the chat at https://gitter.im/carrot-ai/community Carrot's License Made with love

Carrot is a flexible multi-threaded neural network AI Library for Node.js with neuro-evolution capabilities.

For Documentation, visit https://liquidcarrot.github.io/carrot

Key Features

  • Multi-threaded
  • Fully Documented with async-style Docs
  • Preconfigured GRU, LSTM, NARX Networks
  • Mutable Neurons, Layers, Groups, and Networks
  • Neuro-evolution with genetic algorithms
  • SVG Network Visualizations using D3.js

Install

$ npm i @liquid-carrot/carrot

Carrot files are hosted by GitHub Pages, just copy this link into the <head> tag:

<script src="https://liquidcarrot.io/carrot/cdn/0.1.120/carrot.js"></script>

Getting Started

Shaping a network with neuro-evolution

let { Network, methods } = require('@liquid-carrot/carrot');

// this network learns the XOR gate (through neuro-evolution)
async function execute () {
   var network = new Network(2,1);

   // XOR dataset
   var trainingSet = [
       { input: [0,0], output: [0] },
       { input: [0,1], output: [1] },
       { input: [1,0], output: [1] },
       { input: [1,1], output: [0] }
   ];

   await network.evolve(trainingSet, {
       mutation: methods.mutation.FFW,
       equal: true,
       error: 0.05,
       elitism: 5,
       mutationRate: 0.5
   });

   network.activate([0,0]); // 0.2413
   network.activate([0,1]); // 1.0000
   network.activate([1,0]); // 0.7663
   network.activate([1,1]); // -0.008
}

execute();

Building neural networks

let Network = require('@liquid-carrot/carrot').Network

let network = new Network([2, 2, 1]) // Builds a neural network with 5 neurons: 2 + 2 + 1

Building custom network architectures

let architect = require('@liquid-carrot/carrot').architect
let Layer = require('@liquid-carrot/carrot').Layer

let input = new Layer.Dense(1);
let hidden1 = new Layer.LSTM(5);
let hidden2 = new Layer.GRU(1);
let output = new Layer.Dense(1);

// connect however you want
input.connect(hidden1);
hidden1.connect(hidden2);
hidden2.connect(output);

let network = architect.Construct([input, hidden1, hidden2, output]);

Building neurons

let Node = require('@liquid-carrot/carrot').Node

let A = new Node() // neuron
let B = new Node() // neuron

A.connect(B)
A.activate(0.5)
console.log(B.activate())

Training, Testing, and Playing Around

Data Sets * [ ] [MNIST](https://www.npmjs.com/package/mnist)

💬 Contributing

Carrot's GitHub Issues

Your contributions are always welcome! Please have a look at the contribution guidelines first. 🎉

To build a community welcome to all, Carrot follows the Contributor Covenant Code of Conduct.

And finally, a big thank you to all of you for supporting! 🤗

Planned Features * [ ] Performance Enhancements * [ ] GPU Acceleration * [ ] Tests * [ ] Benchmarks * [ ] Matrix Multiplications * [ ] Tests * [ ] Benchmarks * [ ] Clustering | Multi-Threading * [ ] Tests * [ ] Benchmarks * [ ] Syntax Support * [ ] Callbacks * [ ] Promises * [ ] Streaming * [ ] Async/Await * [ ] Math Support * [ ] Big Numbers * [ ] Small Numbers

Backers

Carrot's Backers

Become a Patron

Contributors

This project exists thanks to all the people who contribute. We can't do it without you! 🙇

Acknowledgements

A special thanks to Neataptic, Synaptic, and Brain.js!

Carrot™ was largely brought about by inspiration from these great libraries.