Lecture 1 of 1415 minInteractiveFree lecture

What it means for a machine to learn

Machine learning flips traditional programming around — instead of writing rules, we show a program examples and let it find the rules. Learn the vocabulary, the main types of learning and the workflow every ML project follows.

In this lecture you will

  • Explain how machine learning differs from writing rules by hand
  • Define model, parameters, features, labels and training
  • Distinguish regression, classification, clustering and reinforcement learning
  • Describe the life cycle of a machine-learning project

Suppose you are asked to build a filter that catches fraudulent card payments. The traditional approach is to write rules: flag payments above ₹2,00,000; flag two payments from different countries within an hour; flag… You quickly run into trouble. Fraudsters adapt, the rules multiply and conflict, and many genuine customers get blocked.

Machine learning takes the opposite route. Instead of writing the rules, you collect examples of past payments — each marked fraud or legitimate — and let an algorithm find the patterns that separate them.

Rules versus learning

Traditional programming
Rules + input → output. A programmer writes the logic explicitly.
Machine learning
Examples of inputs and outputs → rules. An algorithm infers the logic, and the result is a model you can apply to new inputs.

This doesn’t replace ordinary software — the model is one component inside an ordinary application. But it lets us solve problems where the rules are too complex, too numerous or too changeable to write down: recognizing speech, ranking search results, forecasting demand or spotting fraud.

The vocabulary

A few terms appear in every ML conversation:

  • Features — the inputs describing each example: payment amount, time of day, merchant category.
  • Label — the answer we want to predict for each example: fraud or legitimate.
  • Model — a mathematical function that maps features to a prediction, like y^=f(x)\hat{y} = f(x).
  • Parameters — the adjustable numbers inside the model, often called weights. A small model may have ten; a large language model has billions.
  • Training — the process of adjusting the parameters so the model’s predictions match the labels on known examples.
  • Inference — using the trained model to make predictions on new data.

What training actually does

“The model learns” sounds mysterious. Scroll through one real training run to see that it is a simple loop: predict, measure the error, adjust the weights, repeat.

Scroll storyInside a training loopStep 1 of 6
Loading visual…
  1. 1
    Labelled examples

    We start with past card payments whose outcome is known: the amount, the time of day, and whether the payment turned out to be fraud.

  2. 2
    A first guess

    The model is a formula with adjustable weights, all starting at zero. Fed one example — ₹85,000 at 3 a.m. — it can only guess: 50% fraud.

  3. 3
    Measure the error

    The label says this payment was fraud. The loss turns the gap between guess and truth into a single number: the lower the predicted probability for the true answer, the higher the loss.

  4. 4
    Adjust the weights

    Gradient descent moves each weight a little in the direction that reduces the loss. Asked again, the model now gives this example an 80% chance of fraud.

  5. 5
    Repeat, many times

    Doing this for every example, pass after pass, steadily lowers the average loss. The weights settle on values that fit all the examples.

  6. 6
    The learned rules

    The trained model now separates fraud from genuine payments in this data. Nobody wrote the rule “large amounts at night are suspicious” — the weights encode it.

Three kinds of learning

Most business problems fall into one of a few families. Switch between them in the visual: the dots are data points, and each mode shows what the model learns from them.

InteractiveThe same kind of data, three kinds of learningSwitch the type of learning
Loading visual…

Supervised learning learns from labelled examples. If the label is a number, it is regression — predicting a price, a delivery time or next week’s demand. If the label is a category, it is classification — fraud or not, which product category, which of 10 digits.

The simplest classifier of all needs no training formula: to classify a new customer, find the k most similar customers you already know and let them vote. This is k-nearest neighbours.

InteractiveClassifying by similar examplesDrag the ring, change k, click to add examples
Loading visual…

With k = 1 the regions become jagged and follow every single example; with k = 15 they are smooth but can miss local detail. Add a few churned customers deep inside the teal region and watch the boundary bend.

Unsupervised learning receives no labels at all. It finds structure on its own: clustering groups similar customers, and dimensionality reduction compresses many features into a few that capture most of the variation.

A third family, reinforcement learning, learns by trial and error. An agent takes actions, receives rewards or penalties, and gradually learns a strategy — the approach behind game-playing systems and some robotics. It also plays a part in fine-tuning today’s chat assistants, as you will see in the Generative AI course.

Train, validate, test

A model that memorizes its training examples is useless; what matters is how it performs on data it has never seen. So we split the data:

  • a training set to fit the parameters;
  • a validation set to compare models and tune settings;
  • a test set, kept aside until the very end, for an honest final estimate.

We will come back to why this matters — and what goes wrong without it — in lecture 5.

The life cycle of an ML project

Training is only one step. A real project loops through:

  1. Frame the problem — what decision will the model support, and how will we measure success?
  2. Collect and label data — often the most expensive part.
  3. Prepare features — clean, combine and transform raw data into useful inputs.
  4. Train and evaluate — fit candidate models and compare them on validation data.
  5. Deploy — put the model behind an API or inside a product.
  6. Monitor — the world changes, data drifts, and model quality decays unless someone watches it.

In the next lecture we build the simplest useful model — a straight line — and define precisely what “a good fit” means.

Key takeaways

  • A model is a function with adjustable parameters; training sets those parameters from examples.
  • Supervised learning learns from labelled examples (regression predicts numbers, classification predicts categories).
  • Unsupervised learning finds structure in unlabelled data; reinforcement learning learns from rewards.
  • Most of an ML project is framing the problem, preparing data and monitoring the model after launch.

Check your understanding

3 questions · answers explained

Q1A bank wants to predict whether a loan applicant will default, using thousands of past loans marked “repaid” or “defaulted”. What kind of problem is this?

The past loans carry labels (repaid or defaulted) and the output is a category, so this is supervised classification. Predicting the amount lost would be regression.

Q2In machine learning, what are a model’s parameters?

Parameters — weights and biases — are the adjustable numbers inside the model. Training searches for the parameter values that make the model’s outputs match the examples.

Q3Why do we keep a test set that the model never sees during training?

A model can look perfect on data it has already seen. Only data held back from training tells you how well it generalizes to the new examples it will meet in production.