0
0
ML Pythonml~5 mins

Label encoding in ML Python - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is label encoding in machine learning?
Label encoding is a technique that converts categorical text data into numbers so that machine learning models can understand and use it.
Click to reveal answer
beginner
Why do we need to use label encoding?
Because many machine learning models only work with numbers, label encoding changes categories like 'red', 'blue', 'green' into numbers like 0, 1, 2.
Click to reveal answer
beginner
How does label encoding assign numbers to categories?
It assigns a unique integer to each category, usually starting from 0 and increasing by 1 for each new category.
Click to reveal answer
intermediate
What is a potential problem with label encoding for some machine learning models?
Label encoding can make models think that one category is greater or less than another because of the numbers, which might not be true for categories without order.
Click to reveal answer
beginner
Give an example of label encoding for the categories: ['cat', 'dog', 'bird'].
An example encoding could be: 'cat' → 0, 'dog' → 1, 'bird' → 2. Each category gets a unique number.
Click to reveal answer
What does label encoding do to categorical data?
AConverts categories into numbers
BRemoves categories from data
CChanges numbers into categories
DSplits data into training and testing sets
Which of these is a possible label encoding for ['apple', 'banana', 'cherry']?
A[0, 1, 2]
B[10, 20, 30]
C['apple', 'banana', 'cherry']
D[1, 2, 3]
Why might label encoding cause problems for some models?
AIt removes important data
BIt creates a false order between categories
CIt changes numbers into text
DIt duplicates categories
Which type of data is label encoding used for?
AImage data
BNumerical continuous data
CCategorical data
DAudio data
What is the first number assigned in label encoding?
A100
B-1
C1
D0
Explain what label encoding is and why it is important in machine learning.
Think about how models understand data.
You got /3 concepts.
    Describe a situation where label encoding might cause problems and why.
    Consider how numbers might mislead a model.
    You got /3 concepts.