Questions tagged [brain.js]

Brain.js is a Neural Networks In JavaScript.

About

Brain.js is a GPU accelerated library for Neural Networks written in JavaScript. The source code is available on GitHub. It is a continuation of the harthur/brain, which is not maintained anymore.

A full introduction is available as the project's README.md, and recommended tutorials are available on the project's Github Wiki.

Example

Here is an example of creating, training, and applying a model which replicates an XOR function created with Brain.js.

// create a simple feed forward neural network with backpropagation
const net = new brain.NeuralNetwork();

net.train([
  { input: [0, 0], output: [0] },
  { input: [0, 1], output: [1] },
  { input: [1, 0], output: [1] },
  { input: [1, 1], output: [0] },
]);

const output = net.run([1, 0]); // [0.987]

Once initiated and trained, a model created with Brain.js can be exported as a zero-dependency function in 100% ES6 with net.toFunction(), as explained here.

87 questions
42
votes
1 answer

Machine Learning : Tensorflow v/s Tensorflow.js v/s Brain.js

I've recently started coding with Machine learning techniques and had been going back and forth between Machine learning implemented in different platforms. The frameworks i worked a lot with were Tensorflow (Python), Tensorflow.js and Brain.js. And…
user10140016
15
votes
3 answers

Use brain.js neural network to do text analysis

I'm trying to do some text analysis to determine if a given string is... talking about politics. I'm thinking I could create a neural network where the input is either a string or a list of words (ordering might matter?) and the output is whether…
Andrew Rasmussen
  • 14,912
  • 10
  • 45
  • 81
7
votes
2 answers

pre-train brain js model

My Question I just started learning brain js and developed a model which gives you category based on the input text. I want to ask that each time running the model depends on iterations greater the number of iterations the more it will take time…
Fareed Khan
  • 2,613
  • 1
  • 11
  • 19
5
votes
1 answer

Brain.js add training to initial training without completely retraining

I am currently using Brain.js in a project and at the moment it has to be trained all in one go, https://github.com/harthur/brain Use train() to train the network with an array of training data. The network has to be trained with all the data in…
Ryan White
  • 2,366
  • 1
  • 22
  • 34
4
votes
1 answer

Resuming training on a Brain.js Neural Network Model

I am looking to incrementally train a neural net using Brain.js, but can't find a solution using the current version. There is a similar answer to this same problem but it uses a deprecated function parameter keepNetworkIntact. How is this done?
user9856145
4
votes
1 answer

Training brain.js multiple times?

How can I train new information(Only the new information,not everything again, since it would cost too much performance) to my neural network made with brain.js after the first training?
peq42
  • 346
  • 4
  • 18
4
votes
1 answer

brain.js correct training of the neuralNetwork

I must clearly have misunderstood something in the brain.js instructions on training I played around with this repl.it code const brain = require('brain.js'); const network = new brain.NeuralNetwork(); network.train([ { input: { doseA: 0 },…
Norfeldt
  • 8,272
  • 23
  • 96
  • 152
4
votes
1 answer

How to properly set up brain.js Neural Network

I am using the Auto MPG training set from http://archive.ics.uci.edu/ml/datasets/Auto+MPG My code is: 'use strict'; var brain, fs, normalizeData, trainNetwork, _; _ = require('lodash'); brain = require('brain'); fs = require('fs'); trainNetwork…
Shamoon
  • 41,293
  • 91
  • 306
  • 570
3
votes
0 answers

Can't install brain.js through NPM?

I'm trying to install the brain.js module through NPM, but it always throws these errors: npm ERR! code 1 npm ERR! path /var/www/ai/node_modules/gl npm ERR! command failed npm ERR! command sh -c prebuild-install || node-gyp rebuild npm ERR! gyp info…
John Smith
  • 81
  • 7
3
votes
0 answers

Brain.js is not utilizing GPU for training

I have been using Brain.js to train a Neural network, and it has been working just fine, except it seems that it is only using CPU to train the neural net. I am using Windows, and the Task Manager shows the Node process using ~25% CPU (I assume it…
PBXx
  • 31
  • 3
3
votes
1 answer

How do I fix the NaN training error in Brain.js?

I've got a problem with my neural net and I really need your help. When the network is training, it gets me this output: iterations: 10, training error: NaN iterations: 20, training error: NaN and so on... I've tried so far: to use for training…
3
votes
0 answers

Machine Learning brain.js probability

We conduct customer surveys on a weekly basis about our products and We ask for 5 products he choose 2 favorites. I would like to know how do brain.js learn about the choices and give me a probability for the next research based on the previous…
Trevisan
  • 29
  • 4
3
votes
1 answer

How to find pattern with brain.js

Disclaimer: I am new to machine learning. Please forgive me if I am asking a super dumb question. Hi I am trying to find pattern in a set of numbers using brain.js. I have expanded on the example in brain.js github page. const net = new…
PSN
  • 35
  • 6
3
votes
2 answers

Strange npm error when running npm install brain.js

When trying to install brain.js, a strange error occurs and I can't understand what the problem is and where does the python come in since this is the installation of a library through npm. I didn't find similar situations in Google (I don’t even…
Rafael Shepard
  • 214
  • 3
  • 15
3
votes
1 answer

Brain js slow in string classification

I'm using brain js for text classification. The problem that I face is the speed of training is incredibly slow. The below code takes 15-20 minutes to execute. I've read about a couple of simple projects which seem to face the same issue. Some of…
1
2 3 4 5 6