karpathy / convnetjs

Deep Learning in Javascript. Train Convolutional Neural Networks (or ordinary ones) in your browser.
MIT License
10.9k stars 2.04k forks source link

how to reference Brain()? #79

Open windmaple opened 8 years ago

windmaple commented 8 years ago

I feel it's a really stupid node question to ask, but really can't figure it out after a few hours. So here is the code that embarrasses me:

var convnetjs = require("convnetjs"); var net = new convnetjs.Net(); var brain = new convnetjs.deepqlearn.Brain(3, 2);

Basically it couldn't find Brain function:

weiwe-macbookpro:test weiwe$ node index.js /Users/weiwe/test/index.js:5 var brain = new convnetjs.deepqlearn.Brain(3, 2); ^

TypeError: Cannot read property 'Brain' of undefined at Object. (/Users/weiwe/test/index.js:5:37) at Module._compile (module.js:556:32) at Object.Module._extensions..js (module.js:565:10) at Module.load (module.js:473:32) at tryModuleLoad (module.js:432:12) at Function.Module._load (module.js:424:3) at Module.runMain (module.js:590:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3

I'm pretty sure the NPM module is installed correctly because I can use functions (e.g., Net()) in convnet.js just fine. Scratching my head on why this doesn't work .....

thomaswmanion commented 6 years ago

const deepqlearn = require('convnetjs/build/deepqlearn');