SUPERALGOS PLATFORM NEWS

Superalgos Machine Learning with TensorFlow transitions to Open Beta stage!

As the first deep learning models begin successfully training on data fed from the data-mines, developers at Superalgos are optimistic about the prospects that continued integration of TensorFlow’s tfjs-node will provide to the Trading System Framework.

PLUV
Superalgos | Algorithmic Trading

--

TensorFlow.js Integration Status Update

While Beta 9 saw the foundations for a Learning System incorporated into the project’s plugin workspaces, Beta 11 sees the module take its first long anticipated breath! With some nodes removed, some added, and the codebase largely expanded the Superalgos learning system has been under heavy development in recent months and is now operational; albeit at a ‘beta’ level of functionality. While there is still much to be implemented, tested and ironed out, I’d like to take you on a brief tour of the system’s current state.

If you have experience with TensorFlow and/or node.js development, your help in testing and expanding functionality will be greatly appreciated! Getting involved and helping the project advance is regarded as a contribution that earns you Superalgos (SA) tokens!

- Article Layout -

Part 1:

  • Information about the Learning System’s tested functionality, as it stands, on the date of the Superalgos Beta 11 release.
  • Conceptual Diagram.

Part 2:

  • A brief walk-through of the Machine Learning Demo System.
  • A look at the learning engine.
  • A look at the learning mine.

Part 3:

  • A ‘dev discussion’ of current project pain points, known issues, and insight into the dev team’s ongoing discourse as to the path forward.
  • Open invitation to join the discourse.

Part 1: The Current State of Affairs

As it stands, the collective business’s ambitious expansion and march towards version 1.0 has left Superalgos developers ‘up to their necks’ in tasks vying for attention and completion. That said, the Machine Learning Project has had to temporarily narrow its vision and scope by focusing in on the implementation of specific ML model and loss types that I believe will offer users the most versatility in the near term. This was not a decision that was easy to make but in the absence of additional manpower I felt that getting the system to a workable state and then working to integrate it into the trade system should be the primary objective. Once this is all complete and operating smoothly, and given additional community input, we should circle back to expand the Learning System’s components and functionalities.

A supervised learning sequential model is what we’ve implemented thus far:

The current plugin demo workspace (which we shall walk through in a minute) uses categorical cross entropy as its loss function and consists of a 2_Feature input → 3 dense layers (relu|relu|softmax)→4_Label output. Other model builds that have been tested include a binary cross entropy setup and sparse categorical, but others may work as well so feel free to test, debug, and lets discuss how to integrate into codebase!

Lets briefly run through the nodes that are up and appear to be operational:

MODEL →[

Compile →Optimizers:

  • Add tfjs supported optimizer by name or
  • Add [SGD, Momentum, Adagrad, Adadelta, Adam, Rmsprop] custom instance nodes.

Compile →Loss Function:

  • Add as value to the node’s config.

Compile →Metrics

Fit Dataset →Dataset Args:

  • Add batch size per gradient update
  • Add Shuffle

Fit Dataset →Verbose

Fit Dataset →Epochs

Fit Dataset →Callbacks:

  • For the time being this node is useless as I’ve hard coded the callback as:

Data Reporting [true/false]:

  • SA built-in reports to console.

]

Model →Layers … →[

Data Features:

  • Feature Formula
  • Optional Feature Engineering: FeaturePreprocessing [MinMax_Scaler, Standard_Scaler]
  • Optional: Collection Condition (Formula regulating when to include sample)
  • Optional: Input Shape

Hidden Layers →Dense Layer(s):

  • Dimensionality Units
  • Activation Function
  • Bias [true if included] + optional: [Initializer, Constraint, Regularizer] nodes
  • Dtype
  • Trainable [true/false]
  • Kernel (not tested)

Output Lables →Data Label →Data Formula

Sample Diagram of the Learning System Framework of nodes (not all nodes included)

Part 2: Brief walk-through

A sample Machine Learning Demo System:

Workspace Node

The first demo workspace for the Superalgos ML project is currently titled ‘ML CategoricalCrossEntropy Demo’ to reflect the type of sequential model trained within the workspace.

Snapshot of applicable Learning nodes contained within ‘ML CategoricalCrossEntropy Demo’ workspace

As “Demo” suggests, this workspace does not construct any model to write home about; it will train only to about 55% at stock configuration and is designed for pedagogical purposes only.

First we see here (below) the Model node that is currently the primary ‘root’ node for most of the Learning System’s core functionality.

  • Configure- Where you’ll name your model
  • Layers API- Where you’ll choose functional / sequential ( functional not yet implemented )
  • Compile- required node
  • fit dataset- required node
  • data reporting- optional SA builtin; recommended for detailed reports to console.

Walk the compile and fit dataset subnodes, setting things up as you need.

2 Notes:

  • Loss Function type is obviously directly related to how you must organize your feature(s) and label(s) tensors, thus why I earlier mentioned that not all loss types have been tested and for sure some probably are not compatible with the current codebase.
  • To save devs time tfjs-node Loss Type definitions can be found in code at: @tensorflow -> tf-layers.node.js

Now the fun part:

Here is where you’ll setup your input, output, and hidden layers. Do note the reference trail from input layer to the first sequential layer and output layer to the last sequential layer, which I’ve named input and output layer respectively. These connections need to be made. The rest of the hidden layers will be evaluated and added to the model in a clockwise manner.

  • Down the input subtree you’ll find the features subtrees which include nodes for data engineering methods such as normalization and standardization techniques (more to hopefully be implemented in future releases) and a collection condition node. The [ Data Feature → Feature Formula ] are the data to include in the sample while the collection condition is whether or not a sample will be taken at the specific datetime being evaluated.
  • The layers subtrees have only been tested with Dense Layers and these are what you’ll find in this demo. In code they will basically be constructed as seen here then pushed to the tensorFlowModel prior to compilation.
Example of a Dense Hidden Layer
  • Lastly the [ Output Labels →Data Label →Label Formula ] contain the formulas to be evaluated in order to provide labels to the features collected at this datetime. Output labels can naturally be a bit difficult to conceptualize and construct at first and the way you construct and format them is highly dependent upon your Loss Function.
  • In this demo you can see we are providing formulas that will assign each label either a 0 or a 1 as per the loss function and model we are building.

Also important to note is that the ‘backLearningPredictionRatio’ variable, which is the percentage of the total time range’s dataset used to train on (point at which ‘validation split’ occurs), is not set at the Learning System but is set at the Task within the Learning Parameters subnode titled [ Learning Algorithm ]:

Learning Parameters Subnodes; Children of the Task Runner

Concept behind this Model:

As you may recall, categorical cross entropy is well suited to classification tasks since one sample can be considered to belong to a specific category with probability 1, and to other categories with probability 0. In the model we are constructing, our categories (i.e. labels) refer to where price is relative to the Average True Range (atr) of the previous price from 5 time periods ago (candles ago).

  • The first label gets a 1 if: ( price ≤ previous price )
  • The second label if: ( price > prevPrice && price ≤ 1atr )
  • The third label if: ( price ≥ prevPrice + 1atr && price < 3atr )
  • and fourth label if: ( price > prevPrice + 3atr )

As for the features, well you can check them out but not much thought went into them to be honest ( albeit as soon as I’m done with this article and the immediately pressing issues described below I am excited to put more thought into them! )

That basically sums up what the demo workspace is. Go to task and run it. Modify features and run it again. Look at your console logs and see how your reports look.

The Learning Engine:

The Learning Engine

Similar to the Trading Engine you already know and love the Learning Engine is just a visualization of the data structure which holds the values your Learning System is working with. I’ve added many nodes to it, for example 5 feature nodes, because it is better to have too many of these placeholders than too few. No need to worry if you only have 1 feature or 2 labels or whatever the extra positions will not matter. Think of how many nodes you place under features, values or predictions here only as the max_size the structure will hold but not what it is required to fill.

The Learning Mine:

!!! IMPORTANT INFORMATION !!!

It is inevitable that a massive amount of users will be scratching their heads and hitting up the support channels because their features data is not being pulled from their data-mine data files even though they’ve verified the data.json’s are in their Superalgos Data-Storage folders. This happens all the time with the Trading System and the Learning System, at this current time, is no different. The data-mine containing the product definitions which you are attempting to use as features, labels or conditions must be referenced at the Process Dependencies of the Learning Mine.

Subset view of the Learning Mine

So follow this path: [ Learning mine →Learning Bot →Process Definition →Process Dependencies ] and ensure your data mine is there.

Part 3:

Pain points, issues, possible paths forward

For all that’s been said I hope you will see the prospects and value that a completed Learning System will add to the greater Superalgos ecosystem. Nevertheless, the Learning System as it currently stands is the epitome of ‘Beta-stage’. There is a growing todo file located at your Superalgos/Projects/TensorFlow/TensorFlow_Project_Todos with several things that need completed asap. Feel free to add to it as well.

It is imperative to realize that the Learning System currently has very little versatility nor plenitude relative to the other projects within the Superalgos ecosystem. It is a work in progress and still undergoing construction.

The most pressing issue is to be able to access predictions from the Trading System’s strategy nodes. This actually shouldn’t take me too long and is the next thing I will do along with documentation for the existing nodes. Everything else however, regardless of whether it is on the aforementioned list or not, is completely up for grabs! So pick it up and earn some tokens!

Horrible Issues:

  • Heartbeat spams console; is possibly out of ‘alignment’ / out of place in the loop
  • There is no integration with Charting Space
  • The new idea of a candle.next or candle.future[i] should eventually be implemented
  • Rigidity of codebase in that it is sort of tethered to the sequential model type.
  • Task server not picking up process dependencies from labels thus they must be declared in features even if not used there (this too I/someone else needs to fix ASAP )
  • No support or code for the Functional Model type.

Join the Convo!

Parting Thought:

The Learning System is definitely an exciting aspect of the Superalgos ecosystem and just like everything else here at Superalgos it is quite unique within the crypto intelligence and trading bot space. While this section of the project has come a long way since the last Superalgos Beta release it is still under development. There is currently no tutorial outside of what can be gleaned from this article and the node’s docs, the docs are only about 75% complete, and it is not meant as an educational tool nor introduction to the theory of ML/Deep Learning or Superalgos. Thus it is highly recommended that new users first familiarize themselves with the rest of the Superalgos platform prior to attempting to utilize or build a Learning System workspace.

--

--