Skip to content

The right architecture for the prediction program. And the error is - value1.concat is not a function and Cannot read property 'backpropagateIndex' of undefined #529

@tyt34

Description

@tyt34

alt text

What is wrong?

I don’t know which architecture to choose.
I do not know the ideal input and output for my task.

Where does it happen?

node 10.15.2
brain.js 2.0.0-alpha.12

How do we replicate the issue?

I have event. It consists of 2 parts. It happens 0 or 1. I would like to predict the result of it.
I made a program with this logic:
I take last N events. And make an array of them. For example:
1 - 0, 0 (last)
2 - 1, 0
3 - 1, 1
4 - 0, 1
5 - 1, 1
6 - 0, 0

training data:
input (3-6) - [1, 1, 0, 1, 1, 1, 0, 0] , output (2) - [1, 0]
input (2-5) - [1, 0, 1, 1, 0, 1, 1, 1] , output (1) - [0, 0]
question:
[0, 0, 1, 0, 1, 1, 0, 1]
and I get array [0.88, 0.77]
(I write about this in #248)
Moreover, I have interesting setting. Long array (la), and number of case (noc).
la - number events in one array (in my example - 4)
noc - number of arrays in training data (in my example - 2)
Further, I test this program use different la and noc. Usually 2 - 9 (I think that 1 is bad idea). And, I test last 11 events and search best setting, which used for predict.

Effectiveness this program sometimes surprises me, sometimes frustrating. With reservations, I would say 60-90%.

code example

  var net1 = new brain.NeuralNetwork();
  var res1 = net1.train(arr1, {
        iterations:   60000,
        errorThresh:  0.0001,
        hiddenLayers: hiddenLayers,
        learningRate: 0.051,
        activation:   "tanh",
  })

hiddenLayers - I use default. I could not find anything better than the default.
And I think, if I use high la and noc I must use other errorThresh and iterations. But I nothing change.
Activation - "tanh", because I test all. "tanh" - The Best.

After I see this #528
I think use object and add more information about event. But I have problem.

For example:

const brain = require('brain.js');
var obj1 = {xyz: 1, a1: 0, a2: 1}
var obj2 = {xyz: 1, a1: 0, a2: 1}
var obj3 = {xyz: 1, a1: 0, a2: 0}
const trainingData = [obj1,obj2,obj3];
const lstm = new brain.recurrent.LSTM();
const result = lstm.train(trainingData, {
  iterations: 1500,
  log: true,
  errorThresh: 0.011
});
console.log(result);

I get:

../node_modules/brain.js/src/recurrent/rnn.js:243
equations[0].backpropagateIndex(0);
^
TypeError: Cannot read property 'backpropagateIndex' of undefined

or

const brain = require('brain.js');
var obj1 = {input: {xyz: 1}, output: {a1: 1, a2: 0}}
var obj2 = {input: {xyz: 1}, output: {a1: 0, a2: 0}}
var obj3 = {input: {xyz: 1}, output: {a1: 0, a2: 1}}
const trainingData = [obj1,obj2,obj3];
const lstm = new brain.recurrent.LSTM();
const result = lstm.train(trainingData, {
  iterations: 1500,
  log: true,
  errorThresh: 0.011
});
console.log(result);

I get:

node_modules/brain.js/src/utilities/data-formatter.js:97
value1.concat(['stop-input', 'start-output']),
^

TypeError: value1.concat is not a function

How important is this (1-5)?

5 for me, 0.1 for world

Expected behavior (i.e. solution)

  1. Ideally, I want to use the chain of recent events with the greatest efficiency.

  2. Or there would be an opportunity, to receive in the beginning the usual prediction. Then when I find out xyz use his in my program, for greater efficiency.

  3. In short, I want to discover something new.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions