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.

LSTM broken output

See original GitHub issue

What is wrong?

Running a value against the network gives some strange outputs

Where does it happen?

In brain.recurrent.LSTM on my Surface, latest version of Windows, x64

How do we replicate the issue?

  1. Run this code in brain.js:
const brain = require('brain.js');
const net = new brain.recurrent.LSTM();

const trainingData = [
  {
    input: 'Hello',
    output: 'Hi'
  },
  {
    input: 'Hi',
    output: 'Hello'
  },
  {
    input: 'Greetings!',
    output: 'Hello'
  },
  {
    input: 'Hello',
    output: 'Greetings!'
  },
  {
    input: 'Hi, How is it going?',
    output: 'Good'
  },
  {
    input: 'Hi, How is it going?',
    output: 'Fine'
  },
  {
    input: 'Hi, How is it going?',
    output: 'Okay'
  },
  {
    input: 'Hi, How is it going?',
    output: 'Great'
  },
  {
    input: 'Hi, How is it going?',
    output: 'Could be better.'
  },
  {
    input: 'Hi, How is it going?',
    output: 'Not so great.'
  }
];

net.train(trainingData, {
  log: true,
  logPeriod: 100,
  learningRate: 0.3,
  iterations: 2000
});

const output = net.run('hi');
console.log(output);

How important is this (1-5)?

5

Expected behavior (i.e. solution)

I should have gotten this response (or something simillar): "Hello"

Other Comments

Instead of “Hello”, I got NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
robertleeplummerjrcommented, Mar 17, 2020

👍 Looking into this now, fyi.

1reaction
raphtlwcommented, Mar 17, 2020

The only fix I found for it is to create a set of key-value pairs like this:

{
  input: 'Hi, How is it going?',
  output: '0'
}

Where 0 corresponds to “Great” after getting the output of the network.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bad output from keras LSTM generating a simple sequence
I'm trying to implement an LSTM layer with keras and test it on a very simple dataset. Here is my code. X =...
Read more >
LSTM Output Structure - Cross Validated - Stack Exchange
First of all, tf.nn.static_rnn documentation states: Returns: A pair (outputs, state) where: outputs is a length T list of outputs (one for ...
Read more >
LSTM is broken · Issue #157 · apple/tensorflow_macos - GitHub
after upgrade to alpha 2 version i get wrong results from LSTM module. Please check it.
Read more >
Difference Between Return Sequences and Return States for ...
Running the example returns a sequence of 3 values, one hidden state output for each input time step for the single LSTM cell...
Read more >
LSTM with trainer.compute_single_action broken again - Ray.io
LSTM with trainer.compute_single_action broken again ... True } } ) # Train for n iterations and report results (mean episode rewards).
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