Lesson 3 of 10
Supervised learning: predict a known answer
In supervised learning, each training example includes the expected answer. Classification predicts a category, such as spam or not spam. Regression predicts a numeric value, such as tomorrow's energy demand. The model adjusts its parameters to reduce the difference between its predictions and known answers.
Imagine examples of messages labeled “urgent” or “normal.” A classifier learns relationships between message features and labels, then returns a predicted class or score for a new message. The score is not necessarily a calibrated probability unless the model has been checked for that purpose.
# Conceptual supervised-learning workflow
examples = load_labeled_examples()
train, test = split_examples(examples)
model = fit_model(train.features, train.labels)
predictions = model.predict(test.features)
review_metrics(test.labels, predictions)
Try it: Decide whether classifying product reviews by topic is classification or regression. Name one useful input feature and one possible label.