DEV Community

brain.js - Neural networks in JavaScript

Ben Halpern on December 30, 2018

This is a fairly remarkable project which offers a library of Neural Networks written in JavaScript. BrainJS ...
Collapse
 
mvasigh profile image
Mehdi Vasigh

I love the GitHunt tag and the projects you've been posting, Ben. This has been on my list of libraries I need to play with for a long time. I like Martin's spam filter project idea; anyone else have any other projects or ideas for what to do with this that I can draw inspiration from?

Collapse
 
embiem profile image
Martin Beierling-Mutz • Edited

I love this one. Used it a while back in a side project to filter spammy chat messages and it worked like a charm.

It's also one of the few JS ML libraries that are actively maintained.

A big "competitor" to brain.js is TensorFlow.js, which is backed by Google and Tensorflow in general is very widely used. It was exciting to see Tensorflow coming to JavaScript this year.

Collapse
 
ben profile image
Ben Halpern

Great to hear you had success on spam filtering. That's a notoriously difficult problem without tech like this, but even with neural networks, I don't hear a lot of practical "this worked and how" examples.

If you wanted to write a DEV post on that experience, I think it would go over really well.

Collapse
 
johnkazer profile image
John Kazer

I built a sentence matching system using this library. It matched the words and characters in an input sentence against a database to make a best guess match. The standardised sentence version in the database was linked to properties we used for processing a response.
The response was a set of calculations rather than a chat app.
The library was useful in 3 ways:

  1. We could claim to use AI in the app πŸ˜€.
  2. Once trained (it runs in node but could have done it in browser) you save the settings for fast and repeated use. I think, but never tested this, that it is faster than a traditional brute force best match search.
  3. You don't really need to know much about neural networks to set it up. Getting your training and testing data organised is by far the hardest part.
Collapse
 
masihfathi profile image
masih fathi • Edited

does the speed of computation comparable with c tensorflow library?

Collapse
 
avalander profile image
Avalander

Wow, looks great, thanks for sharing! I'll see if I can try it out soon!

Collapse
 
daijapan profile image
Daisuke Ishii

Love this. Congrats!

Collapse
 
_bigblind profile image
Frederik πŸ‘¨β€πŸ’»βž‘οΈπŸŒ Creemers

If you're running in NodeJS anyway, I'd expect you're better of with some kind of wrapper around native TensorFlow bindings than running a neural network in pure JS.