Data Science ยท Chapter 23 of 43

Intro to Machine Learning

MACHINE LEARNING lets a computer LEARN patterns from data instead of being programmed with rules.

Main flavours: supervised (labels), unsupervised (no labels), reinforcement (reward).

Example 1 (python)
from sklearn.linear_model import LogisticRegression
model = LogisticRegression()
model.fit(X_train, y_train)
print(model.score(X_test, y_test))
Output
0.87

Train and evaluate โ€” the same API for every scikit-learn model.

Example 2 (python)
# Supervised: classification & regression
# Unsupervised: clustering, dimensionality reduction

Two big families in supervised learning.

Key points

  • ML learns patterns from data.
  • Supervised needs labels.
  • Unsupervised finds structure.
  • scikit-learn has a consistent fit/predict API.
๐Ÿ’ก Note: Start simple: a linear/logistic regression baseline is often within a few % of the fanciest model.

๐Ÿ“ Quick Quiz

1. Supervised learning needs:

2. Clustering is:

3. scikit-learn's core method to train is: