Skip to content

LSTMTimeStep can't forecast a simple array of numbers... #342

@philippscheer

Description

@philippscheer

A GIF or MEME to give some spice of the internet

What is wrong?

LSTMTimeStep cannot correctly predict a simple array of numbers

Where does it happen?

When I want to use forecast()

How do we replicate the issue?

Just use my code, it's simple:

	const net = new brain.recurrent.LSTMTimeStep();
	const trainingConfig = {
								// Defaults values --> expected validation
		  iterations: 10000,    // the maximum times to iterate the training data --> number greater than 0
		  errorThresh: 0.00000000001,   // the acceptable error percentage from training data --> number between 0 and 1
		  log: false,           // true to use console.log, when a function is supplied it is used --> Either true or a function
		  logPeriod: 100,        // iterations between logging out --> number greater than 0
		  learningRate: 0.3,    // scales with delta to effect training rate --> number between 0 and 1
		  momentum: 0.1,        // scales with next layer's change value --> number between 0 and 1
		  callback: null,       // a periodic call back that can be triggered while training --> null or function
		  callbackPeriod: 10,   // the number of iterations through the training data between callback calls --> number greater than 0
		  timeout: Infinity     // the max number of milliseconds to train for --> number greater than 0
	}
	const training = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
	net.train([
		training
	], trainingConfig);
	const output = net.forecast(training)
	console.log(output);

How important is this (1-5)?

2

Expected behavior (i.e. solution)

It should output 11... (+-0.5)

Other Comments

When I use forecast(input), it gives me different results based on the iteration count. That's what I noticed (first number is iterations second one is the output => should be 11):
500: 13.98
1000: 9.5
2000: 12.87
3000: 10.74
10000: 9.84

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions