question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hey Would like to know if the inputs objects support text strings.

I did something like this

var brain = require('brain.js')
var net = new brain.NeuralNetwork();

net.train([
           {input: "my unit-tests failed.", output: "software"},
           {input: "tried the program, but it was buggy.", output: "software"},
           {input: "i need a new power supply.", output: "hardware"},
           {input: "the drive has a 2TB capacity.", output: "hardware"}
         ]);

It outputs { error: NaN, iterations: 1 }

One of the comments says that rnn supports them, so is it only available for it or other models can also make use of strings?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (11 by maintainers)

github_iconTop GitHub Comments

6reactions
robertleeplummerjrcommented, Mar 17, 2017

A recurrent neural net in some form is probably the way to go here, the reason being is that their whole design is based on a varying length input, where as a traditional neural net generally has a defined sized input. There are ways around this, of course, but are essentially hacky, like: a maximum length input, normalize all characters, and the rest where doesn’t take up the rest of the input, set to 0… But don’t do that, too icky.

Try this:

var brain = require('brain.js')
var net = new brain.recurrent.LSTM();
net.train([
  {input: "my unit-tests failed.", output: "software"},
  {input: "tried the program, but it was buggy.", output: "software"},
  {input: "i need a new power supply.", output: "hardware"},
  {input: "the drive has a 2TB capacity.", output: "hardware"},
  //added for less overfitting
  {input: "unit-tests", output: "software"},
  {input: "program", output: "software"},
  {input: "power supply", output: "hardware"},
  {input: "drive", output: "hardware"},
]);

console.log(net.run("drive"));

Try this with a bunch of data, to avoid overfitting, and see what happens.

It, working (careful, it takes time to train, we are working to make that way way way faster): https://jsfiddle.net/g1poj29x/

5reactions
robertleeplummerjrcommented, Mar 23, 2017

Also, fantastic work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Strings, Instrument Strings, Music Strings for Guitar, Bass ...
At JustStrings.com, we offer the world's largest selection of musical instrument strings, including acoustic and electric guitar strings, bass strings, ...
Read more >
Strings Magazine | For players of violin, viola, cello, bass & fiddle
Strings magazine covers the personalities, music, history, instruments, bows, and lessons that matter most to players of violin, viola, cello, bass, ...
Read more >
Strings (band) - Wikipedia
Strings (Urdu: اِسٹرنگز) was a Pakistani pop/rock band composed of two members, plus four live band members from Karachi, Pakistan. The band was...
Read more >
Strings (2004) - IMDb
Strings Directed by Anders Rønnow-Klarlund (2004) The young prince Hal seeks to avenge his father, the king, for the murder made against him....
Read more >
Guitar Strings, Accessories, Sheet Music, Violin ...
Strings By Mail is your online source for Classical, Flamenco, Acoustic and Electric Guitars. We also carry Violin, Cello, Viola, Bass, Sheet Music,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found