GithubHelp home page GithubHelp logo

iviiemtz / carrot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from liquidcarrot/carrot

0.0 0.0 0.0 3.22 MB

πŸ₯• Multi-threaded Self-Assembling Neural Networks in Node.js & Browser

Home Page: https://liquidcarrot.io/carrot/

License: MIT License

JavaScript 96.51% CSS 3.49%

carrot's Introduction

Carrot Logo

Build Status via Travis CI Codacy Badge 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 here

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.2.20/carrot.js"></script>

Getting Started

This is a simple perceptron:

perceptron.

How to build it with Carrot:

let { architect } = require('@liquid-carrot/carrot');

// The example Perceptron you see above with 4 inputs, 5 hidden, and 1 output neuron
let simplePerceptron = new architect.Perceptron(4, 5, 1);

Building networks is easy with 6 built-in networks

let { architect } = require('@liquid-carrot/carrot');

let LSTM = new architect.LSTM(4, 5, 1);

let GRU = new architect.GRU(4, 5, 1);

let NARX = new architect.NARX(4, 5, 1);

let Hopfield = new architect.Hopfield(4);

let Random = new architect.Random(4, 5, 1);

// Add as many hidden layers as needed
let Perceptron = new architect.Perceptron(4, 5, 20, 5, 10, 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]);

Networks can also shape themselves with neuro-evolution

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

// this network learns the XOR gate (through neuro-evolution)
async function execute () {
  // no hidden layers...
   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,
       mutation_rate: 0.5
   });

   // and it works!
   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();

Build vanilla 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

Or implement custom algorithms with neuron-level control

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())

Try with

Data Sets

Contributors ✨

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

Thanks goes to these wonderful people (emoji key):

Luis Carbonell
Luis Carbonell

πŸ’» πŸ€” πŸ‘€ πŸ“–
Christian Echevarria
Christian Echevarria

πŸ’» πŸ“– πŸš‡
Daniel Ryan
Daniel Ryan

πŸ› πŸ‘€
IviieMtz
IviieMtz

⚠️
Nicholas Szerman
Nicholas Szerman

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!

πŸ’¬ 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

Patrons

Carrot's Patrons

Silver Patrons
D-Nice Profile Pitcure
D-Nice
Bronze Patrons
Kappaxbeta's Profile Pitcure
Kappaxbeta
Patrons
DollarBizClub Logo
DollarBizClub

Become a Patron

Acknowledgements

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

Carrotβ„’ was largely brought about by inspiration from these great libraries.

carrot's People

Contributors

christianechevarria avatar luiscarbonell avatar nicoszerman avatar iviiemtz avatar delvinroque avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.