Free lesson · Financial machine learning
Choose the model’s job: targets, horizons and decision layers
Open interactive lessonPractice calculationsExplore labs
Start with the idea
Machine learning estimates a relationship from examples. In trading, the most useful target is the one that improves a defined decision—not necessarily tomorrow’s raw closing price.
Symbols, units & horizon
- X_t: feature vector genuinely available at decision time
- θ: fitted model parameters
- f_θ: prediction function
- y_(t,H): future simple return label over horizon H
- P_entry,P_exit: consistently specified executable or reference prices
- μ̂: predicted conditional return in the same units as the label
- H: bars or time interval, explicitly fixed
When and why to use this
Use target design before architecture selection. It determines what the learner can improve and which execution assumptions enter its apparent accuracy.
A supervised example contains features available at decision time and a label observed later. Regression can estimate forward residual return, volatility, implementation shortfall or expected loss. Classification can estimate convergence, a positive net trade outcome or a liquidity event. Ranking can order assets for a constrained selection process.
Separate an alpha model from a risk model and an execution model. Alpha predicts conditional opportunity; risk predicts uncertainty or joint losses; execution predicts cost and fill probability. Combining them in a decision layer makes it easier to identify which component adds value and which assumptions fail.
For a forward-return target, use an executable start price and a horizon consistent with the strategy. Barrier labels answer a path-dependent question, but their stop times overlap and require interval-aware purging. A binary sign discards payoff magnitude; a probability above .5 alone need not justify a trade.
Choose the model’s job: targets, horizons and decision layers
- Divide the future exit price by the feasible entry price to obtain a wealth ratio. Subtract one for a simple return.
- Collect features only from information preceding the decision and retain the label’s availability end time.
- Fit a function on training pairs (X,y), then evaluate its output against unseen labels and the strategy’s cost hurdle. The equation defines a supervised task, not a causal economic mechanism.
An executable entry of 100.10 and exit of 100.40 give label .002997, approximately 29.97 bps. A label based on a midpoint entry of 100 would overstate the executable move.
Apply it in a strategy
- Choose one role—alpha, risk, cost, fill or ranking—and state the downstream decision it changes.
- Define target units, horizon, label maturity and executable price convention; audit example rows by hand.
- Evaluate against a zero, mean, linear or fixed-policy baseline appropriate to that role.
Research deliverable
Create a target contract and feature/label timeline for one real strategy component, including the decision that uses its prediction.
Research sources, review dates and limitations
Python implementation
Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.
def forward_return(entry,exit):
if entry<=0 or exit<=0: raise ValueError("Positive prices required")
return exit/entry-1
def linear_forecast(features,weights,intercept=0):
if len(features)!=len(weights): raise ValueError("Dimensions must match")
return intercept+sum(x*w for x,w in zip(features,weights))
print(forward_return(100.10,100.40))Continue learning
Machine Learning for Quantitative Strategy Development — all lessons- Choose the model’s job: targets, horizons and decision layers
- Feature engineering, missingness and training-only transformations
- Regularised regression: an interpretable alpha baseline
- Logistic classification and cost-aware entry thresholds
- Trees and boosting: nonlinear interactions with controlled complexity
- Calibration, meta-labels and conditional payoff estimation
- Unsupervised learning, clusters and latent risk structure
- From model forecasts to a constrained strategy
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations