MagicInput Model Training App

📈 Overview

The MagicInput Model Training App is a machine learning engine built to train predictive models for crypto trading strategies. It leverages structured datasets generated by the MagicInput Dataset Builder in .parquet format. These datasets capture various trade scenarios across categories (e.g. meme tokens), directions (Long, Short), and strategies (scalp, long_term, etc.).

Once trained, the model can be integrated directly into your trading bot to provide real-time strategy recommendations and decision-making insights.

🧠 Model Configuration – mlconfig.yaml

All training behavior is driven by a flexible configuration file:

# mlconfig.yaml

datasetDir: ./datasets/parquite_latest
modelOutputPath: ./ai/models/trade_predictor.zip
taskType: classification
labelColumn: WinRateAboveThreshold

featureColumns:
  - Leverage
  - Strategy
  - VirtualBalance
  - RiskPercent
  - SL
  - TP
  - Breakeven_Trigger
  - Breakeven_Buffer
  - TrailingSL_Offset
  - TrailingTP_Trigger
  - LongCond_0_Change
  - LongCond_0_Interval
  - ShortCond_0_Change
  - ShortCond_0_Interval

filter:
  symbols:
    - DOGE
    - PEPE
    - WIF
    - SHIB
    - FLOKI
    - BONK
  minWinRate: 60

trainer: FastForest

training:
  maxIterations: 100
  trainTestSplit: 0.8
  stratified: true

evaluation:
  metrics:
    - Accuracy
    - AUC
    - F1Score

exportTrainingStats: true

📂 Dataset Input

The training engine scans datasetDir for .parquet files, typically organized by:

  • Category – e.g. meme, layer1, AI
  • DirectionLong, Short, Both
  • Strategyscalp, long_term, balance_midterm

Using the filter block, you can limit training to specific symbols or apply minimum win-rate thresholds, allowing for fine-tuned models per asset type or market behavior.

🧪 Feature Selection

Only columns listed under featureColumns are included during model training. These represent important input variables such as leverage, risk %, smart SL/TP, and trade signal conditions.

The labelColumn is the binary outcome used for supervised learning, such as WinRateAboveThreshold to classify setups with historically high performance.

⚙️ Training Settings

The following training behavior is defined in the configuration:

  • Algorithm: FastForest (robust binary classification with decision trees)
  • Max Iterations: Training stops after N iterations or convergence
  • Train/Test Split: Split ratio of training vs evaluation (e.g. 80% / 20%)
  • Stratified: Ensures balanced class distribution

📊 Model Evaluation

Once trained, the model is evaluated using standard classification metrics:

  • Accuracy – Correct predictions vs total samples
  • AUC – Area under the ROC curve
  • F1 Score – Harmonic mean of precision and recall

If exportTrainingStats is enabled, these metrics and loss curves are saved as CSV files for later analysis.

📦 Model Output

After training, the binary ML.NET model is saved to modelOutputPath as a .zip file. This file can be loaded at runtime to provide:

  • ⚡ Real-time trade recommendations
  • 📉 Risk-aware entry filtering
  • 🧠 Bot decision augmentation

🚀 Use Case: Category-Specific AI Models

You can train multiple models, each targeting a specific category (e.g. meme tokens), direction (e.g. Long-only setups), or strategy type (e.g. scalp). These models can be served dynamically to boost precision and personalization of your automated strategies.

📎 Related Topics