BrainJS / BrainJS/brain.js

Getting gibberish predictions when using recurrent LSTM and arrays of strings as output training data

Open
#799 2 comments 0 reactions 1 assignee Claimed by @robertleeplummerjr View on GitHub
Dominant language
TypeScript
Stars
14.9k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

I have a bunch of sentences and I want to generate tags for each one. I have my data which are simple:

[{
input: "Buy tickets for opera",
output: ['errands', 'orders']
},
{
input: "Clean garage",
output: ['errands', 'home']
},
....

I am training the model simply with :

const network = new brain.recurrent.LSTM();

network.train(trainingData, {
(error) => console.log(error),
iterations: 1000,
});

When I run a:

network.run('Some random text');

sometimes I get an array with a correct tag, but other times it returns gibberish with random characters or the tags joined together in a string, for example the sentence "*Service my XBox dvd drive*" returns this output:

["sco comhermer fililys.AAouto afamily.shopping"]

I read somewhere that LSTM cannot classify so I am ok with this but what do you suggest?

Will something like making a matching table with numbers and tag words work? Something like:

1: orders
2: errands
3: family
4: personal
.....

and then feeding the output of my training data with numbers ?

Is it something not expected to work as I am hoping to or is it a bug?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.