BrainJS / brain.js

🤖 GPU accelerated Neural networks in JavaScript for Browsers and Node.js
https://brain.js.org
MIT License
14.35k stars 1.07k forks source link

"Forecasting" demo is a 404 #908

Open malipeddisaiteja opened 1 year ago

malipeddisaiteja commented 1 year ago

The "Forecasting" example link is leading to 404 error

image
Vectorrent commented 1 year ago

Demos were moved to a dedicated repo: https://github.com/BrainJS/brain.js-examples

mattezell commented 1 year ago

Unfortunately, there's no 1 to 1 association between what currently resides on the site documentation and these examples.

Additionally, the examples don't currently work 'out of the box' - or at least they don't on my Windows 11 WSL 2 nor my MacOS setups...

When running following the readme instructions, I get:

matt@Legion:~/w/github/brain.js-examples$ npx ts-node src/predict-numbers.ts 
(node:10406) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/home/matt/w/github/brain.js-examples/src/predict-numbers.ts:1
import { recurrent } from 'brain.js';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1178:20)
    at Module._compile (node:internal/modules/cjs/loader:1220:27)
    at Module.m._compile (/home/matt/.npm/_npx/1bf7c3c15bf47d04/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Object.require.extensions.<computed> [as .ts] (/home/matt/.npm/_npx/1bf7c3c15bf47d04/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Function.Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at phase4 (/home/matt/.npm/_npx/1bf7c3c15bf47d04/node_modules/ts-node/src/bin.ts:649:14)
matt@Legion:~/w/github/brain.js-examples$ 

If I update my tsconfig to get ts-node to do commonjs module format, I get:

matt@Legion:~/w/github/brain.js-examples$ npx ts-node src/predict-numbers.ts 
Error: Cannot find module '../node_modules/gpu.js/src/index.js'
Require stack:
- /home/matt/w/github/brain.js-examples/node_modules/brain.js/dist/index.js
- /home/matt/w/github/brain.js-examples/src/predict-numbers.ts
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/home/matt/.npm/_npx/1bf7c3c15bf47d04/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/home/matt/w/github/brain.js-examples/node_modules/brain.js/dist/index.js:5:16)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Object.require.extensions.<computed> [as .js] (/home/matt/.npm/_npx/1bf7c3c15bf47d04/node_modules/ts-node/src/index.ts:1608:43)
    at Module.load (node:internal/modules/cjs/loader:1119:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/matt/w/github/brain.js-examples/node_modules/brain.js/dist/index.js',
    '/home/matt/w/github/brain.js-examples/src/predict-numbers.ts'
  ]
}
matt@Legion:~/w/github/brain.js-examples$