Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Thoughtscript/x_team_tensorflow_js

Repository files navigation

x_team_tensorflow_js

WIP: X-Team TensorFlow.js Stock Prediction Example.

Presently only the Logic example is 100% - it includes all basic logic operations implemented in client-side TensorFlow.js RNN.

Examples

Logic training with 100 epochs:

100

Logic training with 1200 epochs:

1200

Installation and Set Up

Setup and installation instructions:

Linux

In order to improve performance and better leverage parallel, asynchronous, processes this example was rearchitected with most of the work put into the server.

We now make heavy use of the great npm libraries:

  1. tfjs.
  2. tfjs-node.
  3. tfjs-node-gpu.

And as a result of that, this example requires using Linux in order to achieve full functionality!

For NVM on Linux:

#!/usr/bin/env bash

echo "Updating OS"
sudo apt-get update

echo "Installing NVM"
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | bash

echo "Installing Linux Dependencies"
sudo apt-get install build-essentials

For NVM on Windows Linux Subsystem:

(This approach is recommended for running the app only!)

  1. See this great article for more!
  2. Access your Linux workspace directly in your usual Windows text-editor.

E.g. - Access this repo in Windows directory: C:\Users\MY_WINDOWS_USER\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_7...c\LocalState\rootfs\home\u\x_team_tensorflow_js

  1. If you run into an Error: EACCESS: permission denied issue during installation try:
    $ sudo chown -R u:p node_modules
    $ sudo chown -R u:p u/.nvm

Node and NPM

Setup instructions:

    $ npm install
    $ npm run start

Views:

    http://localhost:5555/logic
    http://localhost:5555/cnn
    http://localhost:5555/rnn

Licensing

MIT Licensed!

Shout Outs

To my knowledge this is perhaps one of the first 100% JavaScript Stock Prediction examples (either using a Recurrent Neural Net or a Convolutional Neural Net) and probably the first for TensorFlow.js:

  1. John Murphy's outstanding pure-node implementation.
  2. karthikbadam's Encog-based TimeFork.

Other great resources:

  1. TensorFlow's Official CNN Article!
  2. Firdaouss Doukkali's great introductory article!
  3. A great full-stack example leveraging Python, PHP, and JavaScript.
  4. Special thanks to Zaid Alyafeai for several crystal-clear code samples!