ReferenceError: deepqlearn is not defined
See original GitHub issueFollowed your example and suddenly it cannot find deepqlearn
. I’m doing this in Node.js.
var convnetjs = require('convnetjs');
// the normal examples with layer_defs etc. worked, but not this:
var brain = new deepqlearn.Brain(3, 2); // 3 inputs, 2 possible outputs (0,1)
var state = [Math.random(), Math.random(), Math.random()];
for(var k=0;k<10000;k++) {
var action = brain.forward(state); // returns index of chosen action
var reward = action === 0 ? 1.0 : 0.0;
brain.backward(reward); // <-- learning magic happens here
state[Math.floor(Math.random()*3)] += Math.random()*2-0.5;
}
brain.epsilon_test_time = 0.0; // don't make any more random choices
brain.learning = false;
// get an optimal action from the learned policy
var action = brain.forward(array_with_num_inputs_numbers);
Seems like it can’t find deepqlearn. Saw under node_modules/convnet/deepqlearn.js
there’s an export statement; but your package.json
specifies convnet.js
as the main
.
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Uncaught ReferenceError: WE is not defined in WebGL Earth
I'm implementing WebGL Earth on my local system i'm getting this error. Uncaught ReferenceError: WE is not defined.
Read more >How to fix "Uncaught ReferenceError: x is not defined" in ...
JS Casts 04 - How to fix "Uncaught TypeError: x is not a function " in JavaScript.Visit https://javascriptcasts.com/episodes/04 for a summary ...
Read more >Uncaught ReferenceError $ is not defined - YouTube
The video shows how to correct the " Uncaught ReferenceError : $ is not defined "#WEB_DEVELOPMENT.
Read more >ConvNetJS Deep Q Learning Demo
The paper is a nice demo of a fairly standard (model-free) Reinforcement Learning algorithm (Q Learning) learning to play Atari games. In this...
Read more >How to fix ReferenceError: _gaq is not defined
Looking for a way to fix the _gaq is not defined JavaScript error? Simply add this code snippet before the close of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah node.js has a slightly different way of importing dependencies.
A quick and dirty solution is to simply go into
node_modules/convnetjs/build/deepqlearn.js
manually and add these two lines at the top:@SimplyY If by that you mean if it can run like an efficient program on Java/C++, then yes. Nodejs is a complete and performant language like Python. I just wanted to get rid of the browser dependency here and use convnet like a programming library.