# Supervised vs Unsupervised Learning

> Supervised learning trains models on examples with known answers. Learn regression versus classification, how to define trading targets and labels, and key pitfalls.

Source: https://learn.tradelabsai.com/machine-learning/supervised-learning/  
Track: Machine Learning · Level: Advanced · Updated: 2026-10-03  
Publisher: TradeLabs AI (https://tradelabsai.com). Education, not financial advice.  
Cite as: TradeLabs Learn, "Supervised vs Unsupervised Learning", https://learn.tradelabsai.com/machine-learning/supervised-learning/

Supervised learning is the most widely used form of machine learning. You give a model many examples, each with inputs (features) and a known answer (the label or target), and it learns a function that maps inputs to answers. In trading, the inputs might be recent returns, volatility, valuation ratios or sentiment scores, and the target might be next week's return or whether a trade hit its profit target first. The model is only as useful as the question you ask it, which makes defining the target one of the most important decisions.

## Regression versus classification

| | Regression | Classification |
|---|---|---|
| Predicts | A number | A category |
| Trading examples | Next month's return, tomorrow's volatility | Up or down, hit target or stop first, regime |
| Typical models | Linear regression, ridge, gradient boosting | Logistic regression, tree ensembles, neural networks |
| Evaluation | Error measures, correlation with outcomes | Accuracy, precision, recall, log loss |
| Lesson | [Regression Analysis](https://learn.tradelabsai.com/math/regression-analysis/) | [Regression and Classification Models](https://learn.tradelabsai.com/machine-learning/classification-models/) |

## Defining the target

| Target | Pros | Cons |
|---|---|---|
| Next period return | Direct link to profit | Very noisy |
| Return sign (up or down) | Simple | Ignores size; tiny moves count the same as big ones |
| Return above a threshold | Focuses on meaningful moves | Fewer positive examples |
| Triple barrier label | Matches how trades exit: target, stop or time limit | More complex to compute |
| Volatility | More predictable | Not directly a direction trade |
| Cross sectional rank | Predicts which assets beat others | Needs many assets |

The triple barrier method, popularised by Marcos López de Prado, labels each event by which comes first: an upper barrier (profit target), a lower barrier (stop loss) or a vertical barrier (time limit). It ties labels to realistic trade outcomes. See [Profit Targets](https://learn.tradelabsai.com/position-management/profit-targets/) and [Stop Loss Strategies](https://learn.tradelabsai.com/risk/stop-loss-strategies/).

**Example: Labelling with triple barriers**
On a given day a stock closes at $50, and daily volatility is 2%. A label rule sets the upper barrier at 2 times volatility above, $52, the lower barrier at 2 times volatility below, $48, and a time limit of 10 trading days. Over the next days the price reaches $52.10 on day 6 before ever touching $48, so the label is +1. If neither barrier were hit by day 10, the label could be 0 or the sign of the return at day 10, depending on the design. Scaling barriers by volatility keeps labels consistent across calm and volatile periods. See [Volatility and ATR-Based Sizing](https://learn.tradelabsai.com/risk/volatility-and-atr-based-sizing/).

## The supervised workflow

1. **Collect point in time features** and targets. See [Point-in-Time and Survivorship-Free Data](https://learn.tradelabsai.com/programming/point-in-time-data/).
2. **Align carefully:** features must be known before the target period starts.
3. **Split data by time** into training, validation and test sets.
4. **Train simple models first,** such as linear or logistic regression.
5. **Tune on validation data,** never on the test set.
6. **Evaluate once on the test set,** then translate predictions into trades with costs.

## Overlapping labels

If each label covers the next 10 days and you create a label every day, consecutive labels overlap heavily and share most of their information. This makes the data look larger than it is and leaks information across training and test splits. Remedies include sampling less often, weighting samples by uniqueness and purging overlapping samples near split boundaries. See [Model Evaluation and Cross-Validation](https://learn.tradelabsai.com/machine-learning/cross-validation/).

## Class imbalance

When positive examples are rare, such as large moves, a model can score high accuracy by always predicting the common class. Use balanced metrics, class weights or resampling, and judge the model by trading results. See [Regression and Classification Models](https://learn.tradelabsai.com/machine-learning/classification-models/).

## From prediction to position

A prediction is not a trade. Decide how predictions become positions: trade only when confidence is high, size positions by predicted strength, or rank assets and go long the top and short the bottom. Each choice changes turnover and costs. See [Position Sizing](https://learn.tradelabsai.com/risk/position-sizing/) and [Signal Turnover, Breadth and Neutralization](https://learn.tradelabsai.com/research/signal-turnover/).

## Frequently asked questions

### What is supervised learning in trading?

Training a model on historical examples with known outcomes, such as features and the following return, so it can predict outcomes for new data.

### What is the triple barrier method?

A labelling approach that marks each event by whether price first hits a profit target, a stop loss or a time limit, matching how real trades exit.

### Should I predict returns or direction?

Both are used. Direction is simpler but ignores move size; returns or volatility scaled labels often relate more closely to profit.

Next, learn how classification models make decisions in [Regression and Classification Models](https://learn.tradelabsai.com/machine-learning/classification-models/).

## Continue learning

- Next lesson: [Regression and Classification Models](https://learn.tradelabsai.com/machine-learning/classification-models/)
- Previous lesson: [Machine Learning in Trading](https://learn.tradelabsai.com/machine-learning/machine-learning-in-trading/)
- Related: [Machine Learning in Trading](https://learn.tradelabsai.com/machine-learning/machine-learning-in-trading/): An honest guide to machine learning in trading: where it helps, why it often fails on market data, the main model types and a sound workflow for using it safely.
- Related: [Regression and Classification Models](https://learn.tradelabsai.com/machine-learning/classification-models/): How classification models predict up or down moves and trade outcomes. Learn logistic regression, probability thresholds, precision, recall and confusion matrices.
- Related: [Regression Analysis](https://learn.tradelabsai.com/math/regression-analysis/): Regression models how one variable relates to others. Learn linear regression, beta, R squared, multiple regression for factors, hedge ratios and common pitfalls.
- Related: [Feature Engineering](https://learn.tradelabsai.com/machine-learning/feature-engineering/): Features are the inputs that give trading models a chance. Learn the main feature families, how to make them stationary and comparable, and how to avoid leakage.
- Related: [Model Evaluation and Cross-Validation](https://learn.tradelabsai.com/machine-learning/cross-validation/): Standard cross validation leaks future data in time series. Learn time series splits, purging and embargo, combinatorial purged cross validation and good practice.
- Related: [Random Forests and Gradient Boosting](https://learn.tradelabsai.com/machine-learning/random-forests/): Random forests and gradient boosted trees are strong models for tabular trading data. Learn how they work, key settings, feature importance and overfitting risks.
