Discussing the article: "Machine Learning Without the Black Box: The Tsetlin Machine for Trading"

 

Check out the new article: Machine Learning Without the Black Box: The Tsetlin Machine for Trading.

This article builds a white-box classifier in MQL5 using the Tsetlin Machine. It learns human-readable AND-rules instead of weights, trains with integer state updates, and requires no external dependencies. You will assemble the automaton, clause, and multi-class voter, verify on XOR and other boolean tasks, booleanize indicators, label by forward ATR-scaled return, save the model to CSV, and view active rules on a live chart.

The Tsetlin Machine is built from four ideas stacked on top of each other. Understanding them in order makes the code obvious, so we introduce them from the bottom up before writing any of it.

At the bottom is the Tsetlin automaton, a single decision that answers one yes-or-no question: should this one condition be part of this one rule? It holds that decision as an integer state and changes its mind only when rewarded or penalized. It is the atom of learning here, and it replaces the floating-point weight of a neural network.

A group of these automata forms a clause, which is a single AND-rule. Each automaton in the clause governs one condition, deciding whether that condition is included. The clause outputs 1 when every included condition holds and 0 otherwise, exactly like an AND gate over the conditions it chose to keep.

A collection of clauses forms the machine for one class. Half the clauses vote in favor of the class and half vote against it, and the class score is simply the votes for minus the votes against. With one such machine per class, prediction is the class with the highest score. This is majority voting over learned rules.

Training is the fourth idea, and it is where the automata get their rewards and penalties. Rather than a single loss and a gradient, the Tsetlin Machine uses two targeted feedback rules, one that reinforces correct patterns and one that suppresses false alarms. We build the first three ideas as code, then spend a full section on the fourth.

One vocabulary point that pays off immediately. Each raw feature is given to the machine together with its negation. If a feature is "RSI is above 50", the machine also receives "RSI is not above 50" as a separate condition. Feature and negation together are called literals. For N features there are 2N literals, and a clause can include any subset of them. This is what lets a rule contain a "NOT" term, which the BUY rule above used twice.

Four stacked boxes: a single automaton at the bottom, a clause built from a bank of automata, a per-class bank of clauses, and multi-class argmax voting at the top

Author: Hammad Dilber

 
This is a nice article for trading research! Thanks for sharing!