Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trainAsync is not a function #895

Open
fangiridev opened this issue May 4, 2023 · 1 comment
Open

trainAsync is not a function #895

fangiridev opened this issue May 4, 2023 · 1 comment

Comments

@fangiridev
Copy link

I get this error when trying to use 'net.trainAsync'

  <rejected> TypeError: net.trainAsync is not a function
      at train (/home/container/index.js:21:13)

Code:

  const pool = workerpool.pool();

  await net.trainAsync(data, {
    iterations: 2000,
    errorThresh: 0.01,
    log: true,
    logPeriod: 100,
    useWorkers: true,
    learningRate: 0.01,
    callbackPeriod: 10,
    callback: function(stats) {

      if (stats.accuracy > 0.9) {
        pool.terminate();
        console.log('Training finished');
        client.user.setPresence({ 
          status: 'online', 
          activities: [{ name: 'Estou pronta para uso!', type: 'WATCHING' }]
        });
      }
    }
  });
@Vectorrent
Copy link

Async training is only supported by a couple of classes. Most do not (and will never) support async training: https://github.com/BrainJS/brain.js#async-training

Since you didn't tell us what kind of network you're training, I can only assume you're using one of the unsupported classes.

To make the unsupported classes async, you have to use a worker, and the regular .train() method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants