brain.js icon indicating copy to clipboard operation
brain.js copied to clipboard

Type mismatch between typescript and documentation

Open Sharcoux opened this issue 3 years ago • 0 comments

A GIF or MEME to give some spice of the internet

What is wrong?

There is a mismatch between the documentation and the type declaration of train function of LSTM and RNN nets

Here is the type description in rnn.d.ts file:

export interface IRNNTrainingOptions {
    iterations: number;
    errorThresh: number;
    log: boolean | ((status: string) => void);
    logPeriod: number;
    learningRate: number;
    callback?: (status: IRNNStatus) => void;
    callbackPeriod: number;
    timeout: number;
}

Here is what you can find in the documentation:

net.train(data, {
  // Defaults values --> expected validation
  iterations: 20000, // the maximum times to iterate the training data --> number greater than 0
  errorThresh: 0.005, // 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: 10, // 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
});
  • momentum is missing in the type declaration
  • callback default value should be undefined in the documentation, not null

Version information

Brain.js: 2.0.0-beta.15 / Also visible in current master branch

How important is this (1-5)?

2

Other Comments

Should be quite easy to fix for anyone knowing the project a bit.

Sharcoux avatar Jun 20 '22 21:06 Sharcoux