Generic Classifier
systemic:core-gclsMachine learningfunction1 crInputs
| Name | Type | Description |
|---|---|---|
| N Estimators | integer | The number of weak learners (decision stumps) in the AdaBoost ensemble. |
| Decision Tree Max Depth | integer | Maximum depth of each decision tree (weak learner) in the ensemble. |
| Random State | integer | Seed value for random number generation, ensuring reproducible results. |
| Classifier type | kclassifier | Selects the machine learning algorithm used for classification. |
| Feature matrix | floatmatrix | The input data containing your predictive features. Wire a **Make Matrix** module here: its |
| Target labels | integerarray | The binary class labels that the model learns to predict. |
Outputs
| Name | Type | Description |
|---|---|---|
| Feature Importances | floatmatrix | Relative contribution of each input feature to the model in force at each timestamp. |
| Prediction | integerarray | A walk-forward classification: one prediction per timestamp, each computed only from data |
| Prediction Confidence | floatarray | The model's certainty in its prediction, expressed as a probability. |
"The best signal is not the one that predicts the market—it's the one that knows when it's confident enough to act."
The Generic Classifier module harnesses ensemble machine learning to transform your indicators into predictive signals. It learns patterns from historical data to classify market conditions, predict trend direction, or generate trading signals—all while providing confidence scores to help you filter out low-conviction predictions.
Why Machine Learning for Trading?
Traditional technical analysis relies on fixed rules—"if RSI > 70, sell." But markets evolve. What worked in 2015 may not work in 2025.
Machine learning offers a different approach:
- Learn patterns from historical data rather than hardcoding rules
- Combine multiple signals into a single coherent prediction
- Quantify confidence so you know when to trust the signal
- Identify feature importance to understand what's driving predictions
This module makes machine learning accessible within your Systemic workflows without requiring any coding.
For background on ML in finance, see Investopedia: Machine Learning in Trading.
Core Concept: AdaBoost Ensemble
The module implements AdaBoost (Adaptive Boosting)—an ensemble method that combines many "weak learners" into a powerful "strong learner."
How AdaBoost Works
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#3498db'}}}%%
flowchart TD
subgraph TRAINING["🎓 Training Phase"]
W1["Start: Equal weights<br/>for all samples"]
L1["Train Weak Learner #1<br/>(Decision Stump)"]
E1["Find misclassified<br/>samples"]
W2["Increase their<br/>weights"]
L2["Train Learner #2<br/>(focuses on hard cases)"]
LN["Repeat N times..."]
end
subgraph ENSEMBLE["🗳️ Final Ensemble"]
V["Weighted Vote<br/>of all learners"]
end
subgraph OUTPUT["📤 Outputs"]
P["Prediction<br/>(0 or 1)"]
C["Confidence<br/>(0.0 to 1.0)"]
end
W1 --> L1 --> E1 --> W2 --> L2 --> LN --> V
V --> P
V --> C
style TRAINING fill:#ecf0f1,stroke:#bdc3c7
style ENSEMBLE fill:#d5f5e3,stroke:#27ae60
style OUTPUT fill:#d6eaf8,stroke:#3498db
Why "Adaptive"?
Each subsequent weak learner focuses on the samples that previous learners got wrong. This iterative refinement is what makes AdaBoost powerful:
| Round | Focus |
|---|---|
| 1 | All samples equally |
| 2 | Harder samples weighted more |
| 3 | Even more focus on persistent errors |
| ... | Continues adapting |
| N | Final ensemble from all learners |
Mathematical Foundation
The Weak Learner: Decision Tree
Each weak learner is a small decision tree, its depth set by the Decision Tree Max Depth parameter. The default, depth 1, is a decision stump—a tree with just one split (the configuration AdaBoost was originally designed around); a higher depth lets each learner capture more feature interactions at the cost of overfitting risk:
Where:
- is a single feature value
- is the optimal threshold found during training
Sample Weight Update
After each round , misclassified samples get higher weights:
| Symbol | Meaning |
|---|---|
| Weight of sample | |
| Learner weight (higher if more accurate) | |
| True label (+1 or -1) | |
| Learner's prediction |
Ensemble Prediction
The final prediction combines all learners:
Each learner's vote is weighted by its accuracy. Better learners have more influence.
Data Flow
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#3498db'}}}%%
flowchart LR
subgraph INPUTS["📥 Inputs"]
F["Feature Matrix<br/>(Multiple indicators)"]
T["Target Labels<br/>(Historical outcomes)"]
end
subgraph SPLIT["✂️ Walk-Forward"]
TR["Train: every observed row before t"]
TE["Predict: row t"]
end
subgraph MODEL["🧠 AdaBoost"]
AB["Ensemble of<br/>Decision Stumps"]
end
subgraph OUTPUTS["📤 Outputs"]
P["Prediction"]
C["Confidence"]
FI["Feature<br/>Importance"]
end
F --> SPLIT
T --> SPLIT
TR --> AB
TE --> AB
AB --> P & C & FI
style INPUTS fill:#fadbd8,stroke:#e74c3c
style MODEL fill:#d5f5e3,stroke:#27ae60
style OUTPUTS fill:#d6eaf8,stroke:#3498db
Preventing Look-Ahead Bias: every timestamp
tis predicted by a model trained only on rows strictly beforet. The model is periodically refit (every 50 observed bars) rather than on every single bar - a cost-bounding optimization, never a look-ahead, since the model used between refits was still trained on data before every bar it predicts. Learn more about look-ahead bias.
Missing Data
A timestamp with an incomplete feature vector (data gap, weekend, holiday, or a feature that
hasn't started reporting yet) never gets a fabricated prediction: Prediction, Confidence, and
that row of Feature Importances are all None at that slot. A feature column with no observed
value among the rows currently available for training is dropped from that fit entirely - the
model trains on the columns it can, and that column's Feature Importance entry is None (not
zero) wherever it was excluded, rather than the whole classifier stalling for one late-arriving
feature.
Understanding the Outputs
1. Prediction
A walk-forward series: one binary classification result per timestamp (backfill), or just today's (live) - see Prediction Output for the full walk-forward semantics.
| Value | Meaning |
|---|---|
| 1 | Positive class (e.g., "bullish", "buy", "trend continues") |
| 0 | Negative class (e.g., "bearish", "sell", "trend reverses") |
2. Confidence Score
How certain the model is about its prediction.
| Confidence | Interpretation | Suggested Action |
|---|---|---|
| 0.90+ | Very high confidence | Strong signal |
| 0.70–0.90 | Moderate confidence | Valid signal |
| 0.55–0.70 | Low confidence | Consider filtering out |
| 0.50–0.55 | Near coin-flip | Model is uncertain |
3. Feature Importance
Which inputs contributed most to the model's decisions:
%%{init: {'theme': 'base'}}%%
pie showData title Example Feature Importance
"RSI" : 42
"MACD Histogram" : 28
"Volume Change" : 18
"Price ROC" : 12
Why this matters:
- Validate intuition — Are important features driving decisions?
- Reduce noise — Remove low-importance features
- Discover patterns — Sometimes unexpected features dominate
Trading Applications
Application 1: Trend Direction Prediction
Train the classifier to predict whether price will be higher or lower in the future:
| Input Features | Target Label Definition |
|---|---|
| RSI, MACD, ATR, Volume | 1 if Close[t+5] > Close[t], else 0 |
Workflow in Systemic:
- Connect technical indicators to the Feature Matrix
- Create target labels from price comparisons
- Output prediction signals to visualization or agents
Application 2: Regime Classification
Classify market conditions to adapt your strategy:
| Market State | Label | Indicators Used |
|---|---|---|
| Trending | 1 | ADX > 25, ATR rising |
| Range-bound | 0 | ADX < 20, ATR stable |
Application 3: Signal Filtering
Use confidence scores to filter signals from other modules:
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#3498db'}}}%%
flowchart TD
Signal["Raw Signal<br/>(e.g., Golden Cross)"]
GCLS["Generic Classifier"]
Check{"Confidence > 0.65?"}
Execute["✅ Execute Trade"]
Skip["⏭️ Skip Trade"]
Signal --> GCLS
GCLS --> Check
Check -->|Yes| Execute
Check -->|No| Skip
style Execute fill:#27ae60,color:#fff
style Skip fill:#e74c3c,color:#fff
Configuration Guide
| Parameter | Description | Typical Range |
|---|---|---|
| N Estimators | Number of weak learners to combine | 50–200 |
| Decision Tree Max Depth | Complexity of each learner | 1–3 |
| Random State | Seed for reproducibility | Any integer |
Parameter Selection Tips
| Goal | N Estimators | Max Depth |
|---|---|---|
| Fast, simple | 25–50 | 1 |
| Balanced | 50–100 | 1–2 |
| Maximum accuracy | 100–200 | 2–3 |
Warning on Overfitting: More estimators and deeper trees can overfit to historical data. Always validate on out-of-sample periods.
Important Considerations
1. No Guarantees
Machine learning identifies patterns in historical data. Markets change. Past performance does not guarantee future results.
2. Garbage In, Garbage Out
The quality of predictions depends entirely on:
- Relevance of features — Use meaningful indicators
- Quality of labels — Define targets carefully
- Sufficient history — More data generally helps
3. Combine with Risk Management
Never rely solely on ML predictions. Use proper:
- Position sizing
- Stop losses
- Portfolio diversification
Further Reading
- Scikit-learn: AdaBoost — Technical documentation
- Ensemble Methods Explained — Accessible introduction
- Investopedia: Look-Ahead Bias — Critical concept for backtesting
- Machine Learning in Trading — Overview and applications
Data Alignment and Input Handling
The Feature Matrix comes from a Make Matrix module: rows are timestamps, columns are your
wired features, and row t is the feature vector observed at timestamp t - no realignment
happens inside GCLS itself.
Feature Matrix Structure
| Timestamp | Feature 1 (RSI) | Feature 2 (MACD) | Feature 3 (ATR) |
|---|---|---|---|
| t=0 | 45.2 | 0.05 | 1.2 |
| t=1 | 52.1 | 0.12 | 1.4 |
| t=2 | 68.3 | 0.18 | 1.1 |
| ... | ... | ... | ... |
| t=n (today) | 55.7 | -0.03 | 1.3 |
Alignment Requirements
| Scenario | Behavior |
|---|---|
| Target vs Feature Matrix row count mismatch | Rejected - equal row counts are required |
| A feature column missing at some timestamps | That cell is None; see Missing Data above - never a fabricated forward-filled or padded value |
Best Practices
- Ensure sufficient history: More observed rows generally improve training
- Match timeframes upstream: build the Feature Matrix from series already on the same grid
- Validate alignment: check that your Make Matrix candidates share a frequency before wiring them in
Indicator Assessment
The following chart evaluates the Generic Classifier across key dimensions:
%%{init: {"themeVariables": {"quadrant1Fill": "#e8f5e9", "quadrant2Fill": "#e3f2fd", "quadrant3Fill": "#fff3e0", "quadrant4Fill": "#fce4ec"}}}%%
quadrantChart
title Generic Classifier Assessment
x-axis Low Complexity --> High Complexity
y-axis Low Popularity --> High Popularity
quadrant-1 High Popularity & Complex
quadrant-2 High Popularity & Simple
quadrant-3 Low Popularity & Simple
quadrant-4 Low Popularity & Complex
GCLS - Stocks: [0.72, 0.48]
GCLS - Crypto: [0.70, 0.55]
Dimension Breakdown
| Dimension | Stocks | Crypto | Notes |
|---|---|---|---|
| Popularity | 4.8/10 | 5.5/10 | Growing adoption, but still niche compared to traditional indicators |
| Reliability | 5/10 | 4.5/10 | Highly dependent on feature quality and training data; markets are non-stationary |
| Complexity | 7.2/10 | 7.0/10 | Requires ML understanding; feature engineering is critical |
| Versatility | 8/10 | 8/10 | Can be applied to any binary classification task across asset classes |
| Recent Interest | 7/10 | 8/10 | Surging interest as ML becomes more accessible |
- Popularity: Machine learning classifiers are gaining traction but remain less common than traditional indicators in retail trading.
- Reliability: Model performance is highly sensitive to feature selection, data quality, and market regime changes. Past performance does not guarantee future results.
- Complexity: Requires understanding of ensemble methods, feature engineering, and avoiding common ML pitfalls like overfitting and look-ahead bias.
- Versatility: Extremely versatile—can predict trend direction, classify regimes, filter signals, and more across any asset class.
- Recent Interest: Strong growth in quant trading and fintech communities, especially for crypto where traditional analysis may be less effective.