Machine Learning for AICore· 30 min read

Machine Learning: The Engine of Modern AI

Supervised, unsupervised and reinforcement learning — the three ways machines learn from data.

What you will learn

  • Name the three styles of machine learning
  • Match a task to the right style
  • Define features, labels and model

Three ways machines learn

StyleYou give itIt learns toExample
SupervisedExamples with answersPredict the answer for new dataSpam / not-spam, price prediction
UnsupervisedData with no answersFind groups or structureGroup customers by behaviour
ReinforcementA goal + rewards/penaltiesAct to earn the most rewardGame-playing AI, robots walking

Supervised learning is the most common and where you should start: you show the model many examples that already have the right answer, and it learns to predict the answer for examples it has never seen.

The words you will use constantly

  • Features — the inputs (e.g. hours studied, house size).
  • Label — the answer you want to predict (pass/fail, price).
  • Model — the pattern the algorithm learns, which then makes predictions.
  • Training — the process of learning the model from data.
Supervised learning pairs each example (X) with its known answer (y)
# Supervised data: features (X) paired with labels (y)
X = [[1], [2], [3], [5], [6], [8]]    # hours studied
y = ['Fail','Fail','Fail','Pass','Pass','Pass']   # the answers

# The model will learn: roughly, study > 4 hours -> Pass

Note: Output: (No output yet — next lesson we feed exactly this kind of X and y to scikit-learn and let it learn the pattern automatically.)

New tool ahead: scikit-learn (a popular free Python library for machine learning) gives you ready-made models, so you do not have to write the maths yourself. We will use it in the very next lesson — just remember it as “the library that does the learning for us”.

Tip: How to choose: predicting a known answer? Supervised. Exploring data to find natural groups? Unsupervised. Learning by trial and error toward a goal? Reinforcement.

Q. You have 10,000 emails already labelled “spam” or “not spam” and want to flag new ones. Which style fits?

Answer: You have labelled examples and want to predict the label for new emails — that is classic supervised learning.

✍️ Practice

  1. Label each as supervised/unsupervised/reinforcement: predicting house prices; grouping news articles by topic; a robot learning to balance.
  2. For a “predict tomorrow’s temperature” task, name the features and the label.

🏠 Homework

  1. Describe a task from your own life for each of the three learning styles.
Want to learn this with a mentor?

CodingClave runs guided, project-based training (28-day, 45-day & 6-month batches).

Explore Training →