College · 30 classes

Computer Science - Machine Learning

Each class is a short animated explainer with narration and illustrations, plus quick checks and a mastery quiz. Your progress saves automatically as you complete classes.

▶ Watch class 1 free — no sign-up
Progress map · 30 classes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Not startedStartedCompletedMastered
01
What Does It Mean for a Machine to Learn?
Not started
Start →
02
The Anatomy of a Machine Learning Project
Not started
Start →
03
How Do We Reason About Uncertainty?
Not started
Start →
04
Why Is Linear Algebra the Bedrock of ML?
Not started
Start →
05
Can We Predict a Number by Fitting a Line?
Not started
Start →
06
How Do We Prevent Our Models From 'Memorizing'?
Not started
Start →
07
How Do We Classify 'Yes' or 'No'?
Not started
Start →
08
What Can We Assume to Make Classification Tractable?
Not started
Start →
09
Case Study: Is This Email Spam?
Not started
Start →
10
What If the Data Isn't Linearly Separable?
Not started
Start →
11
How Can We Make Decisions Like a Flowchart?
Not started
Start →
12
Can We Improve by Focusing on Our Mistakes?
Not started
Start →
13
What If We Model the Brain?
Not started
Start →
14
How Does a Neural Network Actually Learn?
Not started
Start →
15
What Natural Groups Exist in Our Data?
Not started
Start →
16
Beyond Centroids: What If Clusters Aren't Spherical?
Not started
Start →
17
How Can We Reduce the 'Curse of Dimensionality'?
Not started
Start →
18
Case Study: Who Are Our Customers?
Not started
Start →
19
How Do Computers Learn to 'See'?
Not started
Start →
20
How Can Networks Have 'Memory'?
Not started
Start →
21
What If a Model Knew What to Pay Attention To?
Not started
Start →
22
Can Two Networks Teach Each Other by Competing?
Not started
Start →
23
Case Study: Generating Photorealistic Faces
Not started
Start →
24
How Do We Know if Our Model Is Actually Good?
Not started
Start →
25
The Fundamental Dilemma: Bias vs. Variance
Not started
Start →
26
What Does It Even Mean to 'Generalize'?
Not started
Start →
27
Why Is There No Single Best Algorithm?
Not started
Start →
28
How Can a Machine Learn by Trial and Error?
Not started
Start →
29
What Are the Societal Impacts of Our Models?
Not started
Start →
30
Where Do We Go From Here?
Not started
Start →
See inside a class

Here’s all of Class 1, in full.

Every class is 13 cards · narrated film + illustration · 3 quick checks · an interactive · a 5-question mastery quiz. Nothing hidden — this is the complete text of What Does It Mean for a Machine to Learn?.

▸ Read the full class — What Does It Mean for a Machine to Learn?

In 1959, an IBM researcher named Arthur Samuel wrote a program to play checkers. This wasn't the first checkers program, but it had a crucial difference. Instead of programming the best moves directly, Samuel programmed the machine to learn from experience. By playing thousands of games against itself and slightly modified versions of itself, the program continuously adjusted its own internal logic. After enough 'experience,' it became a formidable player. In fact, it became better than Samuel himself, who was a decent amateur player. This raises a fundamental question that will guide our entire course. What does it mean for a machine to learn? How can a system, which only follows instructions, transcend the explicit knowledge of its creator? This is not a philosophical question; it is an engineering one. And it's the question we will begin to answer today.

1. The Ambiguity of 'Learning'

Without a rigorous definition of learning, we can't measure progress, compare algorithms, or distinguish genuine intelligence from clever tricks.

The term 'learning' is slippery. We use it to describe a child learning to walk, a student memorizing historical dates, and a scientist discovering a new physical law. In the context of a machine, this ambiguity is a problem. If we write a program with a massive database of chess openings, has it 'learned' chess, or has it just memorized it? If we create a complex set of if-then-else rules to sort email, is the program learning, or is it just executing our handcrafted logic? This isn't just semantics. Without a precise, formal definition of learning, we have no way to measure our progress. We can't objectively say whether algorithm A is better than algorithm B. We can't diagnose why a system is failing. We risk falling for hype, mistaking complex programming for genuine adaptation. To build reliable, predictable, and powerful systems, we must move beyond the colloquial meaning of 'learning' and establish a definition that is mathematically grounded and operationally useful. Our goal is to define learning not as a philosopher would, but as an engineer would.

  • In the context of a machine, this ambiguity is a problem
  • We use it to describe a child learning to walk
  • We can't objectively say whether algorithm A is better than algorithm
  • Is the program learning, or is it just executing our handcrafted
  • Without a precise, formal definition of learning

2. The T-P-E Framework: A Formal Definition

Learning is getting better at some task, measured by some performance metric, through experience.

The most widely accepted formal definition of machine learning comes from Tom M. Mitchell's 1997 textbook. It is elegant, precise, and operational. It states: 'A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E.' Let's break that down. T is the Task. This is what we want the program to do—play checkers, recognize faces, predict stock prices. P is the Performance Measure. This is our metric for success—the percentage of games won, the accuracy of predictions, the profit generated. It must be quantitative. E is the Experience. This is the data, the information the program uses to improve. It could be a dataset of past checker games, a folder of labeled images, or a history of market data. This T-P-E framework strips away the ambiguity. Learning is simply the measurable improvement of P at T, given E. It’s a beautifully simple, engineering-centric definition that allows us to treat machine learning as a formal discipline.

  • The most widely accepted formal definition of machine learning comes
  • It could be a dataset of past checker games
  • Data, the information the program uses to improve
  • Learning is simply the measurable improvement
  • It is elegant, precise, and operational

3. From Checkers to Formalism

The idea of a learning machine is nearly as old as the computer itself, originating in the 1950s.

The concept we're discussing today has deep roots. Arthur Samuel, working at IBM on their early 701 computer, published his seminal paper in 1959. He is credited with coining the term 'machine learning'. His key insight was that instead of trying to code a perfect evaluation function for a checkers board, he could have the program learn the weights of a polynomial function through self-play. This was a radical departure from the dominant 'symbolic AI' approach, which focused on encoding human knowledge and rules of logic. Around the same time, in 1958, Frank Rosenblatt developed the Perceptron, a simple algorithm modeled on a single neuron that could learn to classify inputs. These early successes promised a future of intelligent machines. However, the field went through a series of 'AI winters,' where progress stalled and funding dried up. It was during the resurgence in the 1980s and 90s, with the development of more powerful algorithms and access to more data, that the need for a rigorous framework became apparent. Mitchell’s definition in 1997 wasn't the beginning of the idea, but a formalization that consolidated decades of research into a coherent discipline.

  • Around the same time, in 1958, Frank Rosenblatt developed the Perceptron
  • Arthur Samuel, working at IBM on their early 701 computer
  • Mitchell’s definition in 1997 wasn't the beginning of the idea
  • He is credited with coining the term 'machine learning'
  • This was a radical departure from the dominant 'symbolic AI'

4. The Core Loop: Predict, Evaluate, Update

Most machine learning operates on a simple, iterative loop of trial, error, and correction.

So how does a machine actually 'learn' within this framework? The mechanism is typically an iterative optimization process. Think of it as a loop. First, the program, which we call the 'model', is given an input from the experience E and makes a prediction. For example, given the features of a house, it predicts a price. This is its attempt at task T. Second, we evaluate this prediction. We compare the model's output to the true, known outcome from our data using our performance measure P. The difference between the prediction and the truth is the 'error'. Third, and this is the crucial step, we use this error to update the model's internal parameters. If the model predicted too low, the update rule nudges its parameters to produce a slightly higher prediction next time for a similar input. This loop—predict, evaluate, update—repeats for every example in our experience E, often multiple times. Each pass through the data is an opportunity for the model to refine its parameters. The process is complete when the model's parameters converge to a state that minimizes the overall error, or maximizes P, across the entire experience E. This is learning in action: a guided search for the best possible model configuration.

  • The process is complete when the model's parameters converge
  • The mechanism is typically an iterative optimization process
  • Each pass through the data is an opportunity for the model
  • Given the features of a house, it predicts a price
  • The difference between the prediction and the truth is the 'error'

5. The Language of Learning: T, P, E

Formalizing a problem is the first step to solving it.

Let's look at the notation on screen. At the highest level, we have our three components: T, P, and E. T is the task. P is the performance measure. E is the experience. Any machine learning problem, from the simplest to the most complex, can and should be defined in these terms. Let's consider a practical example: building an email spam filter. What is our task, T? It's to classify an incoming email as either 'spam' or 'not spam'. This is a binary classification task. What is our performance measure, P? A straightforward choice would be the percentage of emails correctly classified. We could also choose other metrics, like precision or recall, which we will discuss later in the course. And what is our experience, E? This would be a large dataset of emails that have already been labeled by humans as either spam or not spam. The learning algorithm will process this dataset E to learn the patterns that distinguish spam from legitimate email, with the goal of maximizing the performance P on the task T.

  • Any machine learning problem, from the simplest to the most complex
  • The learning algorithm will process this dataset E to learn
  • It's to classify an incoming email as either 'spam'
  • A straightforward choice would be the percentage of emails correctly classified
  • This would be a large dataset of emails

6. Key Properties of a Learning System

What distinguishes a learning system from a traditional program? It's about generalization, not memorization.

This TPE definition implies several key properties that characterize machine learning systems. First, they are data-driven. The system's logic is derived from the data, E, not from a programmer writing explicit rules. Second, and most importantly, the goal is generalization. A model that perfectly classifies the emails in its training set E by simply memorizing them has not learned. True learning means it performs well on new, previously unseen emails. Performance P should ideally be measured on data that was not part of the experience E. Third, the process is iterative. The model improves with more experience. A spam filter can be updated with new examples of spam and continue to get better. Finally, the knowledge in a learned model is often implicit. A deep neural network that classifies images contains its 'knowledge' as millions of numerical weights. We can't easily read these weights and understand 'why' it made a particular decision. The knowledge is embedded in the complex interplay of these parameters, discovered through the learning process.

  • The system's logic is derived from the data
  • A model that perfectly classifies the emails in its training set
  • The model improves with more experience
  • The knowledge in a learned model is often implicit

7. A Toy Example: Predicting Exam Scores

Let's trace the learning process with a simple, two-variable problem.

Let's walk through a complete, albeit tiny, example. Our task, T, is to predict a student's exam score based on the hours they studied. Our experience, E, is a dataset of three students. Student one studied 2 hours and scored 65. Student two, 4 hours, 75. Student three, 5 hours, 80. Our performance metric, P, will be to minimize the sum of the squared errors between our predicted scores and the actual scores. We'll use a very simple model: score equals some parameter theta times hours. The learning problem is to find the best value for theta. Let's start with a random guess, say theta equals 10. For the first student, we predict a score of 10 times 2, which is 20. The actual score was 65. The squared error is 65 minus 20, squared, which is large. Our prediction is way off. This error signals that our theta is too low. A learning algorithm like gradient descent would use this error to nudge theta upwards. Maybe the next guess is 11. Then 12. The algorithm repeats this process, calculating the total error for all students and adjusting theta in the direction that reduces that error, until it finds the value of theta that best fits our data E.

  • A learning algorithm like gradient descent would use this error
  • Maybe the next guess is 11. Then 12. The algorithm repeats
  • The learning problem is to find the best value for theta
  • A complete, albeit tiny, example
  • Our task, T, is to predict a student's exam score based

8. Limitations of the Formal Definition

The TPE framework is a powerful abstraction, but it hides significant real-world complexity.

The TPE framework is elegant, but it's a simplification. It has several important limitations. First, it says nothing about *how* to choose a model. The 'No Free Lunch' theorem in machine learning, from David Wolpert, formally states that no single learning algorithm is universally the best for all possible tasks. Your choice of model architecture is a critical design decision not captured by the definition. Second, the framework implicitly assumes the experience E is good. But what if the data is noisy, biased, or incomplete? The principle of 'garbage in, garbage out' is absolute. The model's performance is fundamentally capped by the quality of its experience. Third, the definition is agnostic to interpretability. A model can achieve high performance P while being a complete 'black box,' making it difficult to trust, debug, or ensure fairness. Finally, the choice of P itself is a value judgment. Optimizing for one metric, like user clicks, might lead to unintended negative consequences, like promoting sensationalism. The TPE definition is the map, but it is not the territory.

  • It says nothing about how to choose a model
  • The framework implicitly assumes the experience E is good
  • The definition is agnostic to interpretability
  • The choice of P itself is a value judgment

9. ML vs. Programming, Statistics, and Itself

Machine learning is a distinct paradigm, but it exists in a rich context of related fields and sub-disciplines.

How does machine learning relate to fields you already know? Compared to traditional programming, the paradigm is inverted. In traditional programming, you provide the rules and the data, and you get answers. In machine learning, you provide the data and the answers (in E), and the machine infers the rules. The relationship with statistics is much deeper; many ML algorithms are direct applications of statistical modeling. A key difference is often one of focus. Statistics is frequently concerned with inference—understanding the underlying process that generated the data. Machine learning is often, though not always, more focused on predictive performance—achieving the highest P on task T, even if the learned model isn't perfectly interpretable. The TPE framework also provides a lens to understand the major paradigms within ML. In Supervised Learning, the experience E consists of labeled data, like emails marked 'spam'. In Unsupervised Learning, E is unlabeled, and the task T is to find hidden structure, like clustering customers into groups. In Reinforcement Learning, E is generated through trial-and-error interaction with an environment, like a program learning to play a game by being rewarded for good moves.

  • The relationship with statistics is much deeper; many ML algorithms
  • In Unsupervised Learning, E is unlabeled
  • In Reinforcement Learning, E is generated through trial-and-error interaction
  • Statistics is frequently concerned with inference—understanding the underlying process that generated
  • Machine learning is often, though not always

10. Common Traps and Pitfalls

A little knowledge can be a dangerous thing. Here are the most common mistakes beginners make.

As you start applying these ideas, there are several classic pitfalls to avoid. The most fundamental is overfitting. This is when your model learns the training experience E too well, including its noise and quirks, and as a result, it fails to generalize to new data. You might have a 99% accuracy on your training data, but only 60% on real-world data. This means you haven't really learned. Another trap is metric fixation. If your P is poorly chosen, you can end up optimizing for the wrong thing. For example, a model designed to maximize ad clicks might learn to generate deceptive clickbait. You must also resist the urge to interpret the model's learned patterns as causal relationships. A model might learn that ZIP codes with more parks have higher house prices, but that doesn't mean building a park will cause prices to rise. Finally, and crucially, always question your data. The model will learn whatever patterns are present in E. If your historical data for loan applications reflects historical societal biases, your model will learn to be a biased loan officer. The model is a mirror to the data.

  • Overfitting: Mistaking training performance for generalization.
  • Metric Fixation: Choosing a performance metric (P) that is easily gamed.
  • Confusing Correlation with Causation: Models learn patterns, not causal mechanisms.
  • Data Bias: Assuming the experience (E) is a perfect reflection of reality.

11. Your Toolbox: Books, Papers, and Code

Theory is essential, but machine learning is a practical field. Here are the tools you'll need.

To build on today's lecture, there are several key resources. The foundational text is Tom Mitchell’s 'Machine Learning', which expands on the TPE definition in great detail. For those with a strong mathematical background, 'The Elements of Statistical Learning' by Hastie, Tibshirani, and Friedman is the definitive graduate-level reference. In terms of software, we will be using Python. The Scikit-learn library is the workhorse of classical machine learning, providing robust implementations of hundreds of algorithms. For the deep learning modules later in this course, we will use PyTorch and TensorFlow. To find your 'experience' E, the UCI Machine Learning Repository is a classic source for clean, academic datasets. Kaggle offers more complex, real-world datasets and competitions. Finally, I encourage you all to read Arthur Samuel's original 1959 paper on his checkers program. It is surprisingly accessible and provides a powerful historical perspective on the ideas we still use today.

  • For those with a strong mathematical background
  • The Scikit-learn library is the workhorse of classical machine learning
  • The foundational text is Tom Mitchell’s 'Machine Learning'
  • The UCI Machine Learning Repository is a classic source for clean
  • There are several key resources

12. This Week: Frame a Problem with T, P, and E

The most important step in any ML project happens before you write a single line of code: defining the problem.

For this week's exercise, you will practice this crucial first step of problem formulation. I want you to choose a real-world problem that interests you. This could be anything: predicting which songs will become hits, identifying fraudulent credit card transactions, or diagnosing a disease from medical images. Your assignment is to write a single, concise paragraph that frames this problem using the TPE framework. First, define the task T. Be specific. Is it a regression, classification, or something else? Second, describe the experience E you would need to train a model. What would the data look like? Where could you source it? Would it be labeled? Third, and most critically, define the performance measure P. What does success look like, quantitatively? And what are the potential failure modes or unintended consequences of choosing that specific metric? You are not building a model this week. You are practicing the discipline of thinking like a machine learning engineer, translating a vague goal into a well-posed learning problem.

  • This could be anything: predicting which songs will become hits
  • Most critically, define the performance measure
  • Your assignment is to write a single
  • For this week's exercise, you will practice this crucial first step
  • You are practicing the discipline of thinking like a machine learning

13. What We Learned Today

Today, we moved from a vague notion of 'machine learning' to a precise, engineering-driven definition. We defined learning as measurable improvement at a task T, with respect to a performance metric P, through experience E.

  • Machine learning is a formal engineering discipline, not magic.
  • A system learns if it improves at a task (T) with experience (E), as measured by a performance metric (P).
  • The goal of learning is generalization to new, unseen data, not memorization of the experience.
  • The choice of T, P, and E is a human design decision with critical consequences.
  • The three major paradigms—supervised, unsupervised, and reinforcement learning—are all captured by this framework.

Mastery quiz

  1. Who wrote the 1959 checkers program that learned through self-play and is credited with coining 'machine learning'?
    • Frank Rosenblatt
    • Tom Mitchell
    • Arthur Samuel
    • David Wolpert
  2. In the T-P-E framework, what does E (Experience) refer to?
    • The data the program uses to improve
    • The error of the model's predictions
    • The expected runtime of the algorithm
    • The evaluation threshold for success
  3. Which learning paradigm uses experience E that consists of labeled data?
    • Unsupervised learning
    • Reinforcement learning
    • Supervised learning
    • Self-supervised learning
  4. The 'No Free Lunch' theorem, mentioned as a limitation of the formal definition, was formulated by which person?
    • Tom Mitchell
    • David Wolpert
    • Arthur Samuel
    • Frank Rosenblatt
  5. What pitfall describes a model with 99% training accuracy but only 60% accuracy on real-world data?
    • Metric fixation
    • Data bias
    • Overfitting
    • Confusing correlation with causation
HomePracticeFeedBlogMe