snake-dqn as path to ML

Программирование

Found in tensorflow-js what you need for the first steps in ML and trading.

This is dqn training, where the agent is given rewards and penalties for actions.

https://github.com/tensorflow/tfjs-examples/tree/master/snake-dqn

https://storage.googleapis.com/tfjs-examples/snake-dqn/index.html

It turns out that we have a snake that learns from its own experience to move. She has a certain number of moves (turn or continue) and her task is to get to the fruit. Initially, the snake does not know how to do anything, but in the course of training it gains the ability to find fruits and dodge. Very similar to trading, isn’t it?

Well, at least for our task, when we have data running, and the robot needs to make a decision to buy or sell.

The downside of the snake is that it was written for node.js, and we need to be able to train in a browser (so that any user can do it). Therefore, it was necessary to start the same on the client.

I took the snake as it is to my page with the graph and tried to start it. It was not so!

The snake resisted in every possible way,

packages first,

then arguments. (by the way, I also made a pull request next to the fix https://github.com/tensorflow/tfjs-examples/pull/353),

then %% Unhandled Rejection (TypeError): Cannot call a class as a function %%. Which is repaired here https://github.com/tensorflow/tfjs/pull/3906/files, but since there is no release yet, then I had to substitute my hands. Here, by the way, many people have a problem https://github.com/tensorflow/tfjs/issues/3384.

Then there were the minors, like substituting fs for indexeddb. The work with which I spied on here, by the way. Well, in general, cart-pole initially inspired to do everything on the client.

https://github.com/tensorflow/tfjs-examples/tree/master/cart-pole

https://storage.googleapis.com/tfjs-examples/cart-pole/dist/index.html

in the end, this is what happened:

https://github.com/pskucherov/opexflow/pull/16/files

Well, that’s all, the next stage will be:

  1. Fit to charts
  2. Visualization
  3. Train a robot on known data to show the maximum result

Below in the video is a demo of the work-training of robots on the client. Someday they will also trade Sberbank futures instead of me.

pskucherov
Rate author
Add a comment