Systemicalpha

Generic Classifier

systemic:core-gclsMachine learningfunction1 cr

Inputs

NameTypeDescription
N EstimatorsintegerThe number of weak learners (decision stumps) in the AdaBoost ensemble.
Decision Tree Max DepthintegerMaximum depth of each decision tree (weak learner) in the ensemble.
Random StateintegerSeed value for random number generation, ensuring reproducible results.
Classifier typekclassifierSelects the machine learning algorithm used for classification.
Feature matrixfloatmatrixThe input data containing your predictive features. Wire a **Make Matrix** module here: its
Target labelsintegerarrayThe binary class labels that the model learns to predict.

Outputs

NameTypeDescription
Feature ImportancesfloatmatrixRelative contribution of each input feature to the model in force at each timestamp.
PredictionintegerarrayA walk-forward classification: one prediction per timestamp, each computed only from data
Prediction ConfidencefloatarrayThe 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:

RoundFocus
1All samples equally
2Harder samples weighted more
3Even more focus on persistent errors
...Continues adapting
NFinal 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:

h(x)={1,if xj≥θ0,otherwiseh(x) = \begin{cases} 1, & \text{if } x_j \geq \theta \\ 0, & \text{otherwise} \end{cases}

Where:

  • xjx_j is a single feature value
  • θ\theta is the optimal threshold found during training

Sample Weight Update

After each round tt, misclassified samples get higher weights:

wi(t+1)=wi(t)⋅e−αt⋅yi⋅ht(xi)w_i^{(t+1)} = w_i^{(t)} \cdot e^{-\alpha_t \cdot y_i \cdot h_t(x_i)}
SymbolMeaning
wiw_iWeight of sample ii
αt\alpha_tLearner weight (higher if more accurate)
yiy_iTrue label (+1 or -1)
ht(xi)h_t(x_i)Learner's prediction

Ensemble Prediction

The final prediction combines all learners:

H(x)=sign(∑t=1Tαt⋅ht(x))H(x) = \text{sign}\left(\sum_{t=1}^{T} \alpha_t \cdot h_t(x)\right)

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 t is predicted by a model trained only on rows strictly before t. 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.

ValueMeaning
1Positive class (e.g., "bullish", "buy", "trend continues")
0Negative class (e.g., "bearish", "sell", "trend reverses")

2. Confidence Score

How certain the model is about its prediction.

ConfidenceInterpretationSuggested Action
0.90+Very high confidenceStrong signal
0.70–0.90Moderate confidenceValid signal
0.55–0.70Low confidenceConsider filtering out
0.50–0.55Near coin-flipModel 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 FeaturesTarget Label Definition
RSI, MACD, ATR, Volume1 if Close[t+5] > Close[t], else 0

Workflow in Systemic:

  1. Connect technical indicators to the Feature Matrix
  2. Create target labels from price comparisons
  3. Output prediction signals to visualization or agents

Application 2: Regime Classification

Classify market conditions to adapt your strategy:

Market StateLabelIndicators Used
Trending1ADX > 25, ATR rising
Range-bound0ADX < 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

ParameterDescriptionTypical Range
N EstimatorsNumber of weak learners to combine50–200
Decision Tree Max DepthComplexity of each learner1–3
Random StateSeed for reproducibilityAny integer

Parameter Selection Tips

GoalN EstimatorsMax Depth
Fast, simple25–501
Balanced50–1001–2
Maximum accuracy100–2002–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


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

TimestampFeature 1 (RSI)Feature 2 (MACD)Feature 3 (ATR)
t=045.20.051.2
t=152.10.121.4
t=268.30.181.1
............
t=n (today)55.7-0.031.3

Alignment Requirements

ScenarioBehavior
Target vs Feature Matrix row count mismatchRejected - equal row counts are required
A feature column missing at some timestampsThat cell is None; see Missing Data above - never a fabricated forward-filled or padded value

Best Practices

  1. Ensure sufficient history: More observed rows generally improve training
  2. Match timeframes upstream: build the Feature Matrix from series already on the same grid
  3. 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

DimensionStocksCryptoNotes
Popularity4.8/105.5/10Growing adoption, but still niche compared to traditional indicators
Reliability5/104.5/10Highly dependent on feature quality and training data; markets are non-stationary
Complexity7.2/107.0/10Requires ML understanding; feature engineering is critical
Versatility8/108/10Can be applied to any binary classification task across asset classes
Recent Interest7/108/10Surging 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.
Rendering diagrams...
© 2026 WanoLabs. All rights reservedAlpha build v0.1.5