Features, Labels & Training Data
Part of the Machine Learning Roadmap
In short
Every supervised ML project boils down to one table: some columns you know (features), one column you want to predict (the label), and many rows of past examples. Get this table right and the rest becomes much easier.
Features are the input columns a model learns from, the label is the value you want it to predict, and training data is the set of examples where both are known. Good features and correct labels matter more than a fancy algorithm.

Think of it like this
The flat broker's diary
A broker in Pune has noted hundreds of flats in his diary: area in square feet, number of bedrooms, locality, floor, and the rent each one finally went for. When a new flat comes in, he can guess its rent from the similar ones. The flat details are features, the rent is the label, and his diary is the training data.
Watch it happen
One training row, split into features and label
1/5This is one row of training data: one flat the broker already knows about.
The big ideas
What you need to know
Features are inputs
Columns the model can use, often called X. They must be available at the moment you make a prediction.
The label is the answer
The column you want to predict, often called y. In classification it's a category, in regression it's a number.
Rows are examples
Each row is one past case with its known answer. More varied, correct rows usually beat a fancier algorithm.
Keep a test set aside
Hide some rows during training and use them to check the model on examples it has never seen.
See it in code
Walk through the code
1import pandas as pd2from sklearn.model_selection import train_test_split3from sklearn.linear_model import LinearRegression4 5df = pd.DataFrame({6 "area_sqft": [850, 1200, 600, 1500, 950, 700, 1100, 1350],7 "bedrooms": [2, 3, 1, 3, 2, 1, 2, 3],8 "floor": [3, 5, 1, 8, 2, 4, 6, 7],9 "rent": [22000, 31000, 15000, 40000, 24000, 17000, 28000, 35000],10})11 12X = df[["area_sqft", "bedrooms", "floor"]] # features13y = df["rent"] # label14 15X_train, X_test, y_train, y_test = train_test_split(16 X, y, test_size=0.25, random_state=4217)18 19model = LinearRegression().fit(X_train, y_train)20print(model.predict(pd.DataFrame([[1000, 2, 4]], columns=X.columns)))1/4Each row is one flat. Each column is something we know about it.
A tiny flat-rent dataset turned into features, a label, and a train/test split.
Save yourself the pain
Common mistakes
Oops
Using a feature you won't have at prediction time, like 'days the flat stayed vacant'.
Do this instead
Only use columns that exist before the prediction is made, or the model will cheat in training and fail later.
Oops
Trusting labels without checking them.
Do this instead
Spot-check labels. A rent typed as 2,20,000 instead of 22,000 will drag the model in the wrong direction.
Oops
Testing the model on the same rows it trained on.
Do this instead
Always hold out a test set. Scores on training rows are always too optimistic.
Your mission
Design your own dataset
Quick check
You want to predict whether a loan applicant will default. Which column is the label?
Go deeper
- 1For a house price dataset, list which columns are features and which one is the label.
- 2Find two features in a dataset that would not be known at prediction time and should be removed.
- 3Load a small CSV in pandas and split it into X (features) and y (label).
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.