A target variable is the outcome a model learns to predict. Distinguish a 5% return label from class 1, a forecast from its outcome, and label availability from a row date.
Target variable
A target variable is the outcome a supervised model is trained to predict. It is also called the response, dependent variable or, especially in machine learning, the label. In a trading study, choosing next-period return rather than the sign of that return changes the question the model learns to answer. A model can predict its chosen target well while answering the wrong economic question.
A sample is one observation in the learning dataset: for example, an instrument at a particular forecast decision, with its features and, once available, its associated target value. Here xi denotes the feature vector for sample i, yi its realised target value, and y^i the model's forecast. The target definition specifies what is to be predicted; a realised label records what happened; the forecast is an estimate made from eligible inputs. These are different objects. The response/predictor distinction is developed in James and colleagues, Chapter 2.
One future outcome can supply different labels
Consider a synthetic position valued in USD. Its value is 100 at the start of a future one-period interval and 105 at the end. Assume no distributions, external cash flows or costs, consistent valuation at both endpoints, and no leverage. The interval starts after the forecast decision. These endpoint values are shown retrospectively; neither is known at that decision.
A continuous simple-return target for regression is
yi=Vstart,iVend,i−1=100105−1=0.05=5%.
Under the stated assumptions this measures the position's one-period return. With distributions or external flows, the target needs an explicit cash-flow and reinvestment convention; an endpoint value ratio alone need not measure the intended return. A target described as net return must also specify the costs it includes.
The same outcome then gives ci=1. Here 1 is the code for the positive-return class. It means neither a 1% return nor a 100% return, and it is not the model's predicted probability. The encoding also places an exactly zero return in class 0. Other tasks may use different class names, thresholds or a separate flat class; the mapping must be documented. Class coding and continuous targets are distinguished in the scikit-learn glossary.
A retrospective timeline places the forecast decision before a future interval with USD values 100 and 105. After the interval and processing, the continuous return label is 0.05, or 5%, and its positive-return class is 1. Neither label was available at the decision.
Original synthetic example with no distributions, external flows or costs. Both endpoint values are shown after the fact. Event spacing is schematic; no execution price or forecasting performance is assumed.
Regression retains magnitude. Binary sign classification discards it: every strictly positive outcome receives the same class. A class-probability forecast also leaves the sizes of gains and losses unspecified, so it cannot alone establish expected return or determine a profitable position size.
The label has its own availability time
Features must be available at the forecast decision. The future target becomes observable only after the outcome interval ends and the required data have been received and processed. A historical row can contain both sides of the problem without making them contemporaneously knowable.
This creates two separate checks:
At prediction: the sample's future realised label cannot enter its current features. Doing so creates look-ahead bias, even if the table gives the label the decision date as its row index.
At model fitting: a historical training sample needs a completed, available label by that fitting cutoff. A sample whose decision is in the past can still have an unfinished target. Older completed outcomes may be used as features at later decisions when their availability and the feature definition permit it.
Those timing rules are necessary; they do not by themselves establish independent training and test evidence. Labels spanning overlapping intervals can share market moves, so cross-validation must account for the outcome intervals. The Labels and Overlapping Outcomes lesson develops feasible entry/exit references, label eligibility and overlap weights; its public preview is open, and the full lesson requires membership.
Before collecting labels, write down the instrument or event represented by a sample, decision time, horizon or stopping rule, valuation units, cash-flow and cost treatment, encoding, missing-outcome policy and label availability. An unavailable or ambiguous outcome should remain explicitly identified; silently encoding it as class 0 changes the task. As the scikit-learn leakage guidance explains, information unavailable at prediction time can make historical performance look better than it is.
Sources
James, Witten, Hastie, Tibshirani and Taylor, An Introduction to Statistical Learning, with Applications in Python (Springer, 2023), Chapter 2, §2.1, pp.15–17: predictors, response and prediction. Author website and free book.