Learn/Data Science/Chapter 23

Chapter 23 of 30

Keep learning and build your Data Science skills.

77%
Chapter 23

Supervised Learning

Understand how models learn from labeled examples.

Theory

Supervised Learning uses labeled training data. Each training example contains input features and a known target. Common supervised learning tasks include: • Classification • Regression Examples include: Spam detection → Classification House price prediction → Regression

Example

from sklearn.linear_model import LogisticRegression

X = [[1], [2], [3], [4]]
y = [0, 0, 1, 1]

model = LogisticRegression()

model.fit(X, y)

print(model.predict([[3]]))

Output

The classifier predicts the class of the new input.

Practice

Create a supervised learning model using labeled data.

Interview Questions

1

What is supervised learning?

2

What is labeled data?

3

What is classification?

4

What is regression?

Quick Quiz

Which option best describes this chapter?

A.Labeled data
B.Only unlabeled data
C.No data
D.Only database records