What is the difference between a feature and a label?

Prerequisite: Basic Statistics and exposure to ML (Linear Regression)

It can be answered in a sentence -

They are alike but their definition changes according to the necessities.

Explanation

Let me explain my statement. Suppose that you have a dataset, for this purpose consider exercise.csv. Each column in the dataset are called as features. Gender, Age, Height, Heart Rate, Body_temp, and Calories might be one among various columns. Each column represents distinct features or property.

exercise.csv

User_ID  Gender Age  Height  Weight Duration    Heart_Rate  Body_Temp   Calories
14733363 male   68  190.0   94.0    29.0           105.0    40.8        231.0
14861698 female 20  166.0   60.0    14.0            94.0    40.3        66.0
11179863 male   69  179.0   79.0    5.0             88.0    38.7        26.0

To solidify the understanding and clear out the puzzle let us take two different problems (prediction case).

CASE1: In this case we might consider using - Gender, Height, and Weight to predict the Calories burnt during exercise. That prediction(Y) Calories here is a Label. Calories is the column that you want to predict using various features like - x1: Gender, x2: Height and x3: Weight .

CASE2: In the second case here we might want to predict the Heart_rate by using Gender and Weight as a feature. Here Heart_Rate is a Label predicted using features - x1: Gender and x2: Weight.

Once you have understood the above explanation you won't really be confused with Label and Features anymore.


Feature:

In Machine Learning feature means property of your training data. Or you can say a column name in your training dataset.

Suppose this is your training dataset

Height   Sex   Age
 61.5     M     20
 55.5     F     30
 64.5     M     41
 55.5     F     51
 .     .     .
 .     .     .
 .     .     .
 .     .     .

Then here Height, Sex and Age are the features.

label:

The output you get from your model after training it is called a label.

Suppose you fed the above dataset to some algorithm and generates a model to predict gender as Male or Female, In the above model you pass features like age, height etc.

So after computing, it will return the gender as Male or Female. That's called a Label


Here comes a more visual approach to explain the concept. Imagine you want to classify the animal shown in a photo.

The possible classes of animals are e.g. cats or birds. In that case the label would be the possible class associations e.g. cat or bird, that your machine learning algorithm will predict.

The features are pattern, colors, forms that are part of your images e.g. furr, feathers, or more low-level interpretation, pixel values.

Bird Label: Bird
Features: Feathers

Cat

Label: Cat
Features: Furr


Briefly, feature is input; label is output. This applies to both classification and regression problems.

A feature is one column of the data in your input set. For instance, if you're trying to predict the type of pet someone will choose, your input features might include age, home region, family income, etc. The label is the final choice, such as dog, fish, iguana, rock, etc.

Once you've trained your model, you will give it sets of new input containing those features; it will return the predicted "label" (pet type) for that person.