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.

What is stop-inputstart-output?

See original GitHub issue

What is wrong?

Output of my LSTM sometimes contains keywords stop-input and start-output. I would expect if I ask it to run on my input that it just gives the expected output. For instance, I expect:

var net = new brain.recurrent.LSTM();

net.train([
  { input: 'I feel great about the world!', output: 'happy' },
  { input: 'The world is a terrible place!', output: 'sad' },
]);
var output = net.run('I feel great about');

To output “happy” or “sad”, but instead it outputs “he world is a terrible place!stop-inputstart-outputsad”

What is up with this output ‘clutter’ and why is it there? It’s odd that I’d have to do string splitting to get the actual output.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
robertleeplummerjrcommented, May 17, 2018

The example that came up here as a possible fix is one we are working towards, ie: words in, decimal out. It doesn’t yet work. The issue you are receiving which are the artifact of stop-inputstart-output is two fold: The way the existing neural network in v1 works, all characters are mapped to a single neuron. So when the neuron is activated, it tells that net a character entered into it. To get the net to do interesting things like predict what is next and stop, it needs certain factors, like telling the net: “stop receiving inputs, and just guess the output, then end” and that is what the above artifact is essentially.

It isn’t perfect, and you’ve identified a bug that will need resolved. However, I am working on v2 which will give us some more robust tools for these scenarios. In your specific case where training is as follows:

var net = new brain.recurrent.LSTM();

net.train([
  { input: 'I feel great about the world!', output: 'happy' },
  { input: 'The world is a terrible place!', output: 'sad' },
]);

And running the net as:

var output = net.run('I feel great about');

The net is guessing he world is a terrible place!stop-inputstart-outputsad and in short is linking the whole sentence as: I feel great abouthe world is a terrible place!stop-inputstart-outputsad. If we cut out the artifact of stop-inputstart-out we arrive at I feel great abouthe world is a terrible place!sad and if we jump to the end result just after the artifact we get sad. In short I would say the net either needs more depth, more neurons, more training, or more training data, or a combination of those.

What is up with this output ‘clutter’ and why is it there? It’s odd that I’d have to do string splitting to get the actual output.

You are right, it is clutter, and we can do a better job of ensuring it doesn’t come out of the net, I may be able to dedicate some time to fixing this in the next few days.

The good news: The net is getting easier and easier to configure for situations like this in v2, including word to vector and translations.

1reaction
robertleeplummerjrcommented, May 17, 2018

If you do, however, just run the net with the inputs you trained it with, you’ll get:

net.run('I feel great about the world!'); // -> 'happy'
net.run('The world is a terrible place!'); // -> 'sad'
Read more comments on GitHub >

github_iconTop Results From Across the Web

value1.concat is not a function and Cannot read property ...
node_modules/brain.js/src/utilities/data-formatter.js:97 value1.concat(['stop-input', 'start-output']), ^. TypeError: value1.concat is not a function ...
Read more >
Model 43120 | Manualzz
Model 43120 XCON Triggger System Trigger amplifier + delay generator + pulsed event timer all in one easy to use, compact unit Features:...
Read more >
Untitled - Plunker
toIndexes(value1.concat(['stop-input', 'start-output']), maxThreshold); } if (value2 === null) return result; if (typeof value2 === 'string') { return ...
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