Deep Learning in JavaScript

Open-source AI framework for building neural network models with JavaScript

Node.js & Browser

Add models & bots into your code on any device

Multi-Threading

Automatically trains and runs models in parallel in Browser and Node.

Fast Evolution

Create ideal NN topologies using NEAT algorithm, automatically.

Import / Export

Import/export models to/from other languages and frameworks with JSON.

Installing in Node.js

1
npm i @liquid-carrot/carrot

Installing in Browser

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

Using in Node.js

2
const { Network } = require("@liquidcarrot/carrot");

const dataset = [
{ input: [0,0], output: [0] },
{ input: [0,1], output: [1] },
{ input: [1,0], output: [1] },
{ input: [1,1], output: [0] }
];

const net = new Network(2,1);

console.log(net.activate([0,0]));
console.log(net.activate([0,1]));
console.log(net.activate([1,0]));
console.log(net.activate([1,1]));

net.train(dataset);

console.log(net.activate([0,0]));
console.log(net.activate([0,1]));
console.log(net.activate([1,0]));
console.log(net.activate([1,1]));

Using in Node.js

2

Using in Browser

2
const { Network } = carrot;

const dataset = [
{ input: [0,0], output: [0] },
{ input: [0,1], output: [1] },
{ input: [1,0], output: [1] },
{ input: [1,1], output: [0] }
];

const net = new Network(2,1);

console.log(net.activate([0,0]));
console.log(net.activate([0,1]));
console.log(net.activate([1,0]));
console.log(net.activate([1,1]));

net.train(dataset);

console.log(net.activate([0,0]));
console.log(net.activate([0,1]));
console.log(net.activate([1,0]));
console.log(net.activate([1,1]));

Using in Browser

2