Free self-study · No account needed · Progress stays in this browser. Back it up before clearing site data or changing devices.

← Week 1: AI and Machine Learning Fundamentals

Week 01 / Lesson 1

Learning from labels, structure, and reward

Tell supervised, unsupervised, and reinforcement learning apart by identifying what information teaches the system.

Section 1.1 1 of 7

Overview

Focus

Tell supervised, unsupervised, and reinforcement learning apart by identifying what information teaches the system.

What you will be able to do

  • Identify the information that teaches a system: known target answers, patterns without supplied answers, or rewards from actions.
  • Compare a prediction task, a grouping task, and a decision-learning task by their inputs, feedback, and learned result.
  • Explain two ways to train a recommender: predicting an outcome from labeled examples, or learning action choices from rewards over interactions.

Your route through the lesson

Section What you will do
1.2 Learning from labeled examples Learn the roles of inputs and targets.
1.3 Discovering structure without labels Follow a grouping example and examine how similarity affects it.
1.4 Learning through actions and rewards Trace a game interaction and compare complete reward sequences.
1.5 Put it into practice Apply the three learning setups.
1.6 Guided comparison Follow a completed comparison and the reasoning behind each row.
1.7 Recommendations Learn the same recommendation task in two setups.

How the short reviews work

Each section from 1.2 onward ends with 3–5 multiple-choice questions based on that section's text. Select an answer to get feedback immediately. A wrong choice explains the misconception; a correct choice displays Correct answer. You can change your answers and retry as often as you want. There is no attempt penalty or percentage grade for these reviews.

Continue unlocks when every question in the current review is correct. Earlier sections remain available. Changing a previously correct selection to a wrong one blocks forward progress again until it is corrected. Your selections are saved locally and survive a refresh.

What you need

No prior artificial intelligence knowledge is assumed. New terms are explained before you need them. All required reading is included here. Additional references and background explanations are available below.

You may write personal notes, but written answers are optional and ungraded. There is no teacher reviewing them. Required practice uses choices the app can check and explain. The tutor handoff is available if you want a separate conversation about your reasoning.

The 45–75 minute estimate is only for planning. Record the time you actually study or leave the timer off. Time does not unlock sections or affect a grade.

Section 1.2 2 of 7

Learning from labeled examples

Focus

Identify the input features and target answer in a supervised learning problem.

The idea

Supervised learning uses examples paired with known target answers. A model learns to predict that kind of answer from the input information. The supplied answers provide the supervision; a person need not watch every training step.

An example is one item, such as one email. A feature is information the model can use as input. A label, also called a target, is the answer paired with a historical training example. A dataset is a collection of examples. A model is an adjustable mapping from inputs to predictions.

Worked example: identify what teaches an email filter

We want to predict whether a new email is spam. People have already checked these historical emails:

Email Text excerpt: input Known sender?: input Links: input Human-checked target
A Team meeting at 10 Yes 0 Legitimate
B Claim your prize No 3 Spam
C Your requested invoice No 1 Legitimate

Step 1 — identify the answer. The task asks for spam or legitimate. That makes the human-checked spam category the target. We can check a prediction against it.

Step 2 — identify information available before predicting. The text, sender status, and link count can be inspected when the email arrives. They are input features. The correct spam target is excluded from the new email's inputs: it is what we are trying to estimate.

Step 3 — explain learning. During training, the model predicts from the features, compares its predictions with historical targets, and adjusts its internal values to reduce an error measure. Known answers guide these adjustments.

Step 4 — use the learned mapping. For a new “Meeting agenda” email, the model receives the available features and predicts a category. This use is called inference. A new email can lack a checked target at prediction time while the model's training was still supervised.

Row C matters: an unknown sender can send a legitimate invoice. One cue is not a guarantee.

The target can also be a number

Predicting a category is classification. Predicting a numerical value is regression. Both can be supervised when historical examples include their targets.

For a house-price task, suppose a historical row records 1,500 square feet, a neighborhood, three bedrooms, and an eventual sale price of $300,000. We want to estimate another house's price before it sells.

Floor area, neighborhood, and bedroom count are inputs. The observed historical sale price is the target. Predicting a numerical price from these paired examples is supervised regression.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A filter is trained on emails such as “Your delivery is scheduled,” recording message text, link counts, and a human-checked spam or legitimate category. Which field supplies the target answer during training?
2. A model is trained on historical house records containing size, location, and final sale price. It estimates the price of a house that has not sold yet. Which learning setup fits?
3. An email filter was trained using past emails paired with human-checked spam categories. It now predicts the category of a new “Dinner plans” email that has not been checked. Does the missing category on this new email make the training unsupervised?

Section 1.3 3 of 7

Discovering structure without labels

Focus

Explain how a system can group similar records without supplied target groups.

The idea

Unsupervised learning looks for structure without supplied target answers for each record. We will use clustering: grouping records that are similar under a chosen comparison.

Unlabeled does not mean empty data. Feature names, customer identifiers, and measurements can all be present. What is missing here is a provided answer saying which customer belongs to which target group.

Worked example: group shopping behavior

An average basket is the average amount spent on one visit. Each row is one customer:

Customer Visits per month Average basket ($)
A 1 120
B 2 110
C 8 15
D 9 18
E 1 12
F 2 16

Step 1 — choose the comparison. Consider both visit frequency and basket size. The customer identifier identifies a row; its spelling does not measure shopping behavior.

Step 2 — inspect similar records. Customers A and B are occasional visitors with large baskets. Customers C and D visit frequently with small baskets. Customers E and F visit occasionally with small baskets. These are three reasonable groups for the two-feature comparison.

Step 3 — separate the result from its interpretation. The system could assign arbitrary identifiers such as cluster 0, 1, and 2. A human might then describe customers C and D as frequent small-basket shoppers. That description interprets the result; it was not a correct answer supplied during fitting. Cluster 2 is not inherently better than cluster 1.

A different question can change the grouping

Suppose we compare only basket size. Customers C and D and customers E and F could now be grouped together because all four spend around $12–$18 per visit. If we compare only visits, customers E and F could join customers A and B as occasional visitors. The data stayed the same; what counts as similar changed.

This is why clustering does not guarantee one uniquely correct set of customer types. You must state the features you used and justify the resulting groups.

Place a new customer

A new customer G visits 9 times per month and spends $17 per basket. Using both features, customers C and D are the closest match: they visit 8–9 times per month and spend $15–$18 per basket.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A retailer records customers’ visits per month and average spending per visit. It groups customers with similar measurements without being given desired customer categories. Why is this learning setup unsupervised?
2. Customer J visits 7 times per month and spends $20 per visit. Using both visit frequency and spending, which of these groups is the closest conceptual match?
3. Customers A and B visit 1–2 times per month and spend $110–$120 per visit. Customers E and F also visit 1–2 times but spend $12–$16. If grouping uses only visit frequency, what could happen to customers E and F?

Section 1.4 4 of 7

Learning through actions and rewards

Focus

Identify a situation, an action, and a reward, then explain how consequences can change a learner's next choice.

The idea

Reinforcement learning learns how to choose actions using rewards and the consequences of earlier actions. The learner aims for good total reward over a sequence of interactions. We will make the sequence visible with a small game.

The agent is the learner making decisions; the environment is the game it interacts with. A state describes the current situation, such as the room and remaining health. An action is an available choice. A reward is numerical feedback received after an action. A policy is the rule or model used to select an action from the available information.

Worked example: follow one interaction

At a crossroads, the player can choose a shiny shortcut or a safe corridor. First follow the safe route:

Part of the interaction What happens
Current situation The player is at the crossroads.
Action selected by its policy Choose the safe corridor.
Consequence and reward It reaches a bridge and receives 0 points.
Next decision From the bridge, it moves toward the treasure.
Later consequence and reward It reaches the treasure and receives +5 points.

The next situation is part of what an action changes. A policy decides what to do; a reward tells the learner how an outcome scored under the game's rules. “Collect treasure” is a goal, not a complete policy for choosing moves.

Compare complete experiences

One episode means one complete attempt at the game. This toy attempt has two outcomes; add both rewards to compare the routes:

Choice First reward Later reward Total
Shiny shortcut +2 for a coin −8 for falling into a pit −6
Safe corridor 0 while walking +5 for reaching treasure +5

Reasoning: looking only at the first reward favors the shortcut's +2. Adding both rewards gives 2 − 8 = −6, while 0 + 5 = 5. The safe corridor has the better total in this example.

The environment did not supply a target label saying “safe is the correct move.” It supplied outcomes and rewards. A learner can use repeated attempts to improve its policy. In an uncertain game it must learn which choices tend to produce good totals, rather than trust one lucky attempt. Experience can come from repeated play, a simulator, or recorded interactions.

Do not confuse the signal with the real goal

If the game rewards collecting coins too strongly, a learner could pursue coins while failing to reach the finish. Reward is an engineered signal. You must check whether improving it also improves the actual task.

A supervised model can also influence a decision—for example, an email prediction can trigger blocking. An effect on the world does not by itself make its training reinforcement learning. Ask how behavior was learned: from paired target answers, or from action consequences and rewards.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A game player observes its current room and health, selects a corridor, and receives +5 points on reaching treasure. Which part is its policy?
2. In a cave game, a quick route gives +3 points for a coin followed by −9 for falling into a pit. A slower route gives 0 points followed by +4 for reaching the exit. Which route has the better total reward?
3. A learner playing a navigation game chooses moves, records the resulting locations and points, and uses those experiences to improve future choices. No expert move labels are supplied. What feedback guides its learning?

Section 1.5 5 of 7

Put it into practice

Focus

Apply the three learning setups by identifying the input, learning feedback, and learned result in concrete cases.

Apply what you have learned

You have seen a model learn from known targets, a system group records without supplied groups, and a player learn choices from rewards. Identify those roles in the following three cases.

The three cases

House-price prediction: historical records contain floor area, neighborhood, bedrooms, and observed sale price. The trained model estimates the price of a house that has not sold yet.

Customer grouping: records contain visits and basket size. No desired customer-group targets were supplied. The system groups similar records.

Game play: the player observes its current situation, chooses a route, receives rewards and subsequent observations, and improves which choices it makes.

Separate the roles before choosing

  • Input is information available to the learner or predictor.
  • Learning feedback is what guides fitting or improvement: paired targets, recorded similarities without target groups, or action consequences and rewards.
  • Learned result is what the system learns to predict, group, or choose.

For example, an email's text is an input, its historical human-checked spam category is a target used for learning, and a new spam prediction is the model's result. Do not put all three into one vague category called “email data.”

Choose the mapping that correctly separates input, learning feedback, and learned result for each case.

Download this week’s Python lab ↓

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A price model is trained on historical house size, location, bedroom count, and observed sale price. It estimates the price of an unsold house. Which mapping correctly separates the available input, learning feedback, and learned result?
2. A retailer groups records using visits and basket size without supplied customer-type targets. What does the clustering produce?
3. A game learner uses its current position to choose moves, observes the resulting rewards and situations, and improves its move-selection policy. Which mapping correctly separates the input, feedback, and learned result?
4. A chess program is trained on board positions paired with moves supplied by experienced players. What makes this learning setup supervised?

Section 1.6 6 of 7

Guided comparison

Focus

Explain why each completed comparison row matches its learning setup.

Read the completed comparison

This is one ordinary table. Each row describes a learning problem; each column separates a role in that problem.

Case Input Learning feedback Learned result Approach
House-price prediction Size, location, bedroom count Observed prices paired with historical inputs A numerical estimate for another house Supervised regression
Customer grouping Visits and basket size Similarity patterns without supplied target groups Cluster assignments Unsupervised clustering
Game play Current observed situation Rewards and subsequent observations following actions A policy that selects actions Reinforcement learning

Walk through the house row

Size, location, and bedrooms can be available before the new sale, so they are inputs. The historical observed prices supply answers for fitting. The result is an estimate of a numerical value; that is why this is regression. A model does not receive the future sale price as an input while predicting it.

Walk through the customer row

Visits and basket size describe the records. Nobody supplied the desired groups. Similarity among those features guides clustering, which produces group assignments. A person may interpret or name a group afterward, but that does not create target labels that were present during fitting.

Walk through the game row

The current situation helps select an action. Rewards and later observations show the consequences. The learned result is a policy—a way to choose actions from available information—not merely the numerical score used as feedback.

Check the reason, not just the application name

A game could instead be learned by imitating expert moves paired with positions. That would be a supervised learning setup because the expert moves supply target answers. The domain name does not determine the setup; the learning feedback and objective do.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A model learns from historical house sizes, locations, and recorded sale prices to estimate the price of an unsold house. Why do size and location belong among its prediction inputs?
2. An analyst groups customers by shopping measurements without supplied customer-type targets, then names one discovered group “frequent shoppers.” What did adding that name establish?
3. A game learner uses points received after its moves to improve a policy for selecting future moves. Why is the learned result a policy rather than just the points score?

Section 1.7 7 of 7

Recommendations

Focus

Explain the difference between a recommender trained to predict outcomes and one learning action choices from rewards.

Start with one concrete service

A music service chooses a song for a listener. We can frame its learning task in more than one way. The learning setup depends on what teaches the system.

Worked version A: predict an outcome with known training answers

A historical example records the listener's recent plays, a shown song's features, and whether that song was completed. Context here just means the available information about the listener and recent activity.

Role Music example
Input Listener context and candidate-song features
Historical target Whether the shown song was completed: yes or no
Learned result A prediction of whether the listener will complete a candidate song

The model is fitted to known historical completion targets, so this is supervised learning. Suppose its illustrative scores are 0.8 for song A and 0.4 for song B. A score of 0.8 means an estimated 80% chance of completion, not a promise. A simple ranking rule selects A.

Why this remains supervised: selecting a song uses the prediction, but it does not change what taught the model. Its fitting still used inputs paired with target outcomes.

Worked version B: learn which song to choose over time

Now learn a policy that selects songs to improve total reward over a session. A session is a sequence of listening interactions. For this toy design, give +1 for completion and −1 for an early skip. Recent outcomes change the information available for the next choice.

These first two recorded interactions are complete:

Current context Action Observed outcome Reward Next context
No songs played this session Recommend A A completed +1 A completed
A completed Recommend B B skipped −1 A completed; B skipped

Each record connects a choice to its consequence. The agent can use such experience to improve which action its policy selects from the current context. Its goal is a good expected total—good totals on average across sessions—rather than only copying a supplied correct-song label.

Extend the recorded experience

The current context is A completed; B skipped. The policy recommends C, and the listener completes C. The reward is +1. The next context is A completed; B skipped; C completed. The earlier history is retained and the new outcome is added. The three rewards total 1 − 1 + 1 = 1.

What changes when the domain changes

The same roles apply to an article service. A supervised version predicts completion from reader/article inputs paired with historical completion targets. A reinforcement learning version uses recent reading context to choose an article, receives completion/skip rewards, observes updated history, and learns which choices improve total session reward.

An interaction log needs the five columns above: current context, chosen action, observed outcome, reward, and next context. A list of liked items alone leaves out which actions were taken in which context and what followed them.

There is an important limitation of this reward. Completion is a proxy: an observable substitute for something harder to measure, such as satisfaction or learning. Finishing a short video does not prove the viewer learned. Your reward can be clear and measurable while still missing part of the real goal.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A music service trains a model on historical listener information and song features paired with records of whether each shown song was completed. Why is this training supervised?
2. A music agent uses listening history to choose the next song, receives completion or skip rewards, and updates its choices to improve total session reward. What is the learned result?
3. A music service gives +1 for a completed song and −1 for a skipped song. The session history is “Sunrise completed; Midnight skipped.” The listener now completes “Horizon.” What reward and next context should be recorded?
4. A video recommender receives +1 when a viewer finishes a video and 0 otherwise. The intended goal is to help viewers learn. Why might this completion reward fail to measure that goal?

Your personal notes

Optional, ungraded, and saved only in this browser. Export a backup from the Academy homepage to keep them.

References and further reading
Optional background

Artificial intelligence is the broader field of building systems that perform tasks associated with intelligent behavior. It includes approaches based on explicit rules and search. Machine learning fits a system's adjustable behavior from data or experience. Deep learning uses neural networks with multiple layers. A deep network can be used with supervised, unsupervised, or reinforcement-learning setups. Those names describe how learning is framed, rather than how many layers a model has. You do not need neural-network internals to complete this lesson.

Ask your own AI assistant

Copy this prompt into an assistant you already use. Nothing is sent automatically, and your personal notes are not included.

Next lesson: Preparing data and testing a prediction fairly →