Python · SQL · Web Dev · Java · AI/ML tracks launching soon — your one platform for all of IT
Intermediate

What is Machine Learning?

Not the Wikipedia definition. The actual idea — what it means, how it works, and why it changed everything.

18–22 min March 2026
The problem that started everything

It's 2015. You're a new engineer at DoorDash.

Orders are coming in faster than anyone expected. Customers open the app, see a restaurant they want, and before they place the order they ask the same question: how long will this take?

Your job is to show a delivery time estimate. You sit down and start writing rules.

if distance < 2km:
    estimated_time = 20
elif distance < 5km:
    estimated_time = 30
else:
    estimated_time = 45

if current_hour in rush_hours:
    estimated_time += 10

if is_raining:
    estimated_time += 8

if restaurant == "popular_restaurant":
    estimated_time += 5

# Ship it.

You ship it. The results are terrible. A 1.5 km delivery from a slow kitchen during peak hours takes 55 minutes. The same route on a Tuesday afternoon takes 14. Your rules are off by 20 minutes on a third of all orders. Users are complaining. The product team is not happy.

The problem is not that you wrote bad rules. The problem is that the real relationship between inputs and delivery time involves dozens of interacting variables — kitchen load, rider availability, traffic by street segment, weather severity, order complexity, time since last order from that restaurant — and the combinations are too complex for any human to enumerate.

Machine Learning is the answer to this problem. Instead of writing rules, you take the last 500,000 completed orders — each one a record of what the inputs were and what the actual delivery time turned out to be — and you feed them to a learning algorithm. The algorithm finds the patterns. It discovers that kitchen prep time is 40% of variance. That 6–8 PM Friday adds 12 minutes on average. That rain below 5mm matters less than rain above 20mm. You never wrote those rules. The data wrote them for you.
🎯 Pro Tip
This DoorDash delivery time problem is the running example for the entire Classical ML section. Every algorithm — Linear Regression, Decision Trees, XGBoost — will be explained using this same scenario. By the end of the section you will have built a complete delivery time predictor from scratch.
The actual definition

What Machine Learning actually means

In 1959, Arthur Samuel defined machine learning as: "the field of study that gives computers the ability to learn without being explicitly programmed."

That definition is technically accurate and practically useless. "Without being explicitly programmed" tells you almost nothing about how it works or what you actually do as a practitioner.

The real meaning: in traditional programming, you write the logic and the computer follows it. You are the one who figures out the rules. In Machine Learning, you provide the examples — inputs paired with correct outputs — and the computer writes the logic. The algorithm figures out the rules. Your job shifts from writing rules to curating data.

But what does "learning" actually mean mechanically? It means this loop, run millions of times:

01
Predict

The model takes an input and produces a guess. First prediction: random or near-zero.

02
Measure error

Compare the guess to the actual answer. Quantify how wrong it was. This is the loss function.

03
Adjust

Change the model's internal numbers slightly in the direction that reduces the error. This is gradient descent.

04
Repeat

Do this for every example in your training data. Then do it again. Thousands of times. The model converges.

💡 Note
Gradient descent is explained in full in the Linear Regression topic. For now just hold the mental model: the model makes guesses, measures how wrong they are, and nudges its numbers in the direction that makes the next guess less wrong. Repeat until it stops getting better.
The landscape

The 3 types of Machine Learning

Not all ML problems look the same. The type of data you have — specifically whether you have labelled outputs or not — determines which category of ML you are working in. There are three.

Supervised Learning
You have the answers. The model learns from them.

You provide labelled training examples — each input is paired with the correct output. The model learns the mapping from inputs to outputs by seeing thousands of these pairs.

Analogy

Teaching a child to identify animals by showing them 1,000 photos, each labelled with the animal's name. The child learns from your labels.

Real examples
DoorDash delivery time prediction — input: order details, label: actual delivery time (regression)
Stripe fraud detection — input: transaction features, label: fraud / not fraud (classification)
Gmail spam filter — input: email text + metadata, label: spam / not spam (classification)
Capital One loan approval — input: applicant financials, label: approved / rejected (classification)
Unsupervised Learning
No labels. Find the hidden structure yourself.

You have data but no labels — no correct answers to learn from. The model looks for patterns, groupings, or structure that exists in the data on its own terms.

Analogy

A librarian given 10,000 books with no categories. They group them by content similarity — biography, fiction, technical — without being told what the categories should be.

Real examples
Amazon customer segmentation — group 300M users by behaviour without predefined segments
Anomaly detection in payment networks — find unusual patterns without labelling what fraud looks like
Product catalogue clustering — group similar products without human-defined category trees
User journey analysis — discover common navigation paths without labelling intent
Reinforcement Learning
Learn by trying. Get rewarded for good decisions.

An agent takes actions in an environment, receives a reward or penalty after each action, and learns over time which sequence of actions maximises total reward. No labelled data — just feedback from consequences.

Analogy

Teaching a dog to fetch. You do not explain fetching. You give treats when the dog picks up the ball and brings it back. The dog learns the behaviour through trial, error, and rewards.

Real examples
Google DeepMind cooling data centres — RL agent reduced cooling energy by 40%
Instacart delivery route optimisation — agent learns which routes minimise time across all riders simultaneously
Algorithmic trading — agent learns when to buy and sell by receiving profit/loss as reward signal
AlphaGo — agent learned to play Go by playing millions of games against itself
💡 Note
This section — Classical ML — focuses entirely on Supervised Learning. It is the most common type in production, the foundation for everything else, and what you will encounter most in your first few years as an ML practitioner. Unsupervised and Reinforcement Learning are covered later in the track.
How it actually works

The ML workflow — start to finish

Every ML project at every company — from a two-person startup to Amazon's 400-person data team — follows the same seven steps. The tools change. The algorithms change. The steps do not.

01
Define the problem

Before touching data, be precise: what are you predicting? What inputs will you have at prediction time? What does "good enough" look like in numbers?

DOORDASHPredicting: delivery_time_min. Inputs available at order time: distance, restaurant_id, time_of_day, day_of_week, weather_code, rider_count_nearby. Good enough: mean absolute error ≤ 5 minutes on 85% of orders.
02
Collect and understand your data

Pull your historical data and look at it. What are the distributions? Are there missing values? Outliers? Surprising correlations? You cannot build a good model on data you do not understand.

DOORDASHPull 12 months of completed orders: 500,000 rows. Find: 2% have missing restaurant_prep_time. Outliers: 0.3% with delivery_time > 120 min (likely cancelled/reordered). Correlation check: distance is strong but not dominant — prep time is equally predictive.
03
Prepare the data

Handle missing values. Encode categorical variables. Scale numerical features. Split into training and test sets. The model will only be as good as the data you feed it.

DOORDASHFill missing prep times with restaurant median. Encode time_of_day as 4 buckets (morning/lunch/afternoon/evening). Scale distance to 0–1 range. Split: 80% training (400K orders), 20% test (100K orders, never touched during training).
04
Choose and train a model

Pick an algorithm appropriate for your problem type and data. Feed it your training data. The algorithm adjusts its internal parameters until it fits the training patterns.

DOORDASHStart simple: Linear Regression. Feed 400K training orders. Training takes under 1 second. The model learns coefficients for each feature — distance contributes +8.3 min/km, rush hour adds 9.7 min, and so on.
05
Evaluate on the test set

Run your trained model on the 20% of data it has never seen. Measure performance metrics. This is your honest estimate of how it will behave in production.

DOORDASHRun on 100K test orders. Mean Absolute Error: 4.2 minutes. 79% of predictions within ±5 minutes. Not quite the 85% target. Time to improve.
06
Improve and iterate

Add more or better features. Try a more powerful algorithm. Tune hyperparameters. Each iteration goes back to the training data — the test set must stay untouched until you think you are done.

DOORDASHSwitch to XGBoost. Add 3 new features: restaurant_avg_prep_last_7d, rider_avg_speed_last_hour, order_item_count. MAE drops to 2.8 minutes. 91% within ±5 minutes. Target exceeded.
07
Deploy and monitor

Wrap your model in an API. Serve predictions in production. Monitor performance over time — data distributions shift, and a model that was accurate in January may degrade by July.

DOORDASH3 million predictions per day. Real-time MAE monitoring dashboard. Alert triggers if 1-hour rolling MAE exceeds 5 minutes. Automated weekly retraining on the latest 30 days of data.
This workflow is the backbone of this entire track. Steps 1–3 are what the Data Engineering section covers in depth. Step 4 is every algorithm in this Classical ML section. Step 5 is the Evaluation & Optimisation section. Steps 6–7 are Hyperparameter Tuning and MLOps. Every section of this track maps to a step in this workflow.
The vocabulary

Terms you will see on every ML page — defined once, clearly

ML has jargon. There is no avoiding it. But the jargon is not complicated — it is just precise language for specific ideas. Learn these 12 terms here and you will never need to pause on any later page.

Feature

An input variable used to make a prediction. One column in your data table. Also called a predictor or independent variable.

distance_km, time_of_day, restaurant_id, weather_code — each is one feature in the delivery time model.
Label / Target

The thing you are trying to predict. The correct answer in your training data. Also called the dependent variable or output.

delivery_time_min — the actual number of minutes each order took, recorded after delivery.
Model

A mathematical function that maps input features to a predicted output. After training, it is a set of numbers (parameters) that encode the learned patterns.

The trained delivery time predictor. Given features for a new order, it outputs a number like 28.4 minutes.
Training data

The labelled examples you feed to the algorithm during learning. The model sees these inputs and their correct outputs.

400,000 historical DoorDash orders with their actual delivery times — the 80% split used to train the model.
Test data

Held-out labelled examples the model never sees during training. Used only to evaluate final performance. Must not influence any training decision.

100,000 historical orders kept aside. Run through the trained model after training is complete to get an honest performance estimate.
Parameters / Weights

The internal numbers of a model that are adjusted during training. They are what the model "learns." A linear regression has one weight per feature.

The coefficient +8.3 (min/km) on distance, +9.7 (min) for rush hour — these are learned parameters.
Loss / Error

A number measuring how wrong the model's predictions are. Training aims to minimise this. Different problems use different loss functions.

Mean Absolute Error = average of |predicted_time − actual_time| across all predictions. Lower is better.
Overfitting

The model memorises the training data so well that it fails on new data. It learned noise instead of signal. Performs great on training set, poorly on test set.

A model that learns that one specific restaurant always takes 47 minutes because that was true in training data — but it's a coincidence, not a pattern.
Underfitting

The model is too simple to capture the real patterns. Performs poorly on both training and test data. Usually means the model or features need more complexity.

A model that always predicts 28 minutes regardless of inputs. It learned the average but nothing else.
Hyperparameter

Settings you choose before training that control how the model learns — not learned from data. Tuning these is an optimisation problem of its own.

In XGBoost: max_depth (how deep each tree grows), learning_rate (how fast parameters update), n_estimators (how many trees to build).
Inference

Using a trained model to make predictions on new data. Also called prediction or scoring. Inference is what happens in production.

A new order comes in at 7:43 PM on a Friday, 3.2 km away. The trained model runs inference and outputs 34.1 minutes.
Baseline

The simplest possible benchmark — often just predicting the mean. Your model must beat this to be worth deploying. The bar you need to clear.

Baseline: always predict 31 minutes (the training set mean). MAE = 8.3 min. If your model can't beat 8.3 MAE, it has learned nothing useful.
What this looks like at work

What ML engineers actually do day to day

Machine Learning is not a single job title. Three roles work with ML in different ways. Understanding the differences will help you decide which path you are on.

ML Engineer
Build and ship models into production
Write training pipelines that run on a schedule
Build and maintain the feature engineering code
Wrap models in FastAPI services, deploy to Kubernetes
Monitor prediction quality and trigger retraining
Debug why a model that worked in dev fails in prod
$135K–$185K
Data Scientist
Find insights and answer business questions with data
Explore data to find patterns and test hypotheses
Build models to answer specific business questions
Run A/B experiments and interpret results statistically
Communicate findings to non-technical stakeholders
Prototype quickly; hand production code to ML engineers
$120K–$155K
Applied Scientist
Research and apply advanced techniques at scale
Read and implement current ML research papers
Design novel model architectures for company-specific problems
Run large-scale offline experiments before production decisions
Collaborate with ML engineers on production deployment
Publish internally or externally on methods that work
$170K–$215K
Your first week ML task — what it really looks like: Your lead sends you a Slack message: "We're seeing high return rates on electronics. Can you build something that flags orders likely to be returned before we ship them?" You now know what this means: Supervised Learning classification problem. Features: product category, order value, customer history, payment method. Label: returned / not returned. Workflow: collect historical orders with return outcomes → engineer features → train a classifier → evaluate precision and recall → deploy if it beats baseline. That's the job.
Misconceptions

Five things people get wrong about Machine Learning

Myth: AI, Machine Learning, and Deep Learning are three separate technologies

They are nested, not parallel. AI is the broad goal — building systems that behave intelligently, by whatever means. ML is one strategy for reaching that goal: instead of a person writing the rules (the failed if distance < 2km / elif approach from the top of this page), the system learns them from labelled examples. Deep Learning is a specific family of ML models — multi-layer neural networks — that happens to dominate unstructured data like images and text. Every deep learning model is ML; not every ML model is deep learning; and plenty of genuinely useful AI (that original hand-coded rules engine included) has no learning in it at all.

Myth: More data always beats a better algorithm

More data helps only when it is relevant, correctly labelled, and representative of what the model will see in production — irrelevant or mislabelled rows dilute signal rather than adding it. Look at the seven-step DoorDash workflow above: the accuracy jump that actually mattered, from 79% to 91% of predictions within five minutes, came from switching algorithms (Linear Regression to XGBoost) and adding three specific engineered features in step 6 — not from gathering more historical orders. Past a certain point, a better algorithm and better features routinely move the needle more than raw data volume does.

Myth: Supervised, unsupervised, and reinforcement learning are three clean boxes and every project fits one

The three-way split earlier on this page is a teaching device based on what kind of feedback an algorithm consumes — it is not a rule that a whole production system must obey. Real systems blend all three routinely: a model can be pre-trained in an unsupervised or self-supervised way and then fine-tuned with supervised labels, and techniques like RLHF layer reinforcement learning on top of an already-supervised base model. Knowing the three types tells you what signal a given algorithm needs — it does not mean a project must commit to exactly one.

Myth: A trained ML model tells you what causes the outcome

The DoorDash predictor learns correlational patterns from historical orders, not causal ones. Its training data associates the "popular_restaurant" flag with longer delivery times, but that link could just as easily be caused by kitchens being understaffed during that restaurant's peak-popularity windows, not by popularity itself. Acting on the wrong causal read — for example, deprioritising popular restaurants' orders to "fix" the correlation — could make outcomes worse, not better. Establishing genuine causation needs a controlled experiment (an A/B test) or a dedicated causal-inference method; a supervised model alone cannot supply it.

Myth: Machine Learning is just statistics with extra steps

There is real overlap — both fields fit models to data — but the goals diverge. Classical statistics emphasises inference: confidence intervals, hypothesis tests, and explaining why a relationship holds. ML optimises overwhelmingly for predictive accuracy on data it has not seen, frequently using models like tree ensembles that make no distributional assumptions and offer little of the interpretability statisticians value. And the DoorDash example's final state — 3 million predictions served per day, a live monitoring dashboard, automated weekly retraining — points at an entire engineering discipline around deployment and drift detection that a statistics course never has to cover.

Interview prep

What is Machine Learning — 5 questions interviewers actually ask

Q1 — What's the actual difference between AI, Machine Learning, and Deep Learning?

They form a hierarchy, not three competing options: AI ⊃ ML ⊃ Deep Learning. AI is the overall goal of building systems that behave intelligently, by any method, including hand-written rules. ML is the approach of learning those rules from labelled examples instead of writing them by hand — exactly the shift this page opens with, from a hard coded DoorDash rules engine to a model trained on 500,000 completed orders. Deep Learning is the subset of ML that uses multi-layer neural networks, and it particularly excels on unstructured data like images and text — though for tabular data like the DoorDash order table, tree-based models such as XGBoost frequently beat it.

Q2 — Walk me through supervised, unsupervised, and reinforcement learning, each with a concrete example

The distinguishing factor is what feedback the algorithm gets. Supervised learning trains on labelled pairs — the DoorDash delivery time model, where every historical order comes with its actual delivery time as the label. Unsupervised learning has no labels and finds structure on its own — segmenting 300 million Amazon customers by behaviour with no predefined groups. Reinforcement learning has no static labelled dataset at all — an agent takes actions in an environment and learns from a reward signal over time, like a routing agent that learns which delivery routes minimise total time across all riders purely through trial, error, and reward. I would flag that real systems increasingly combine more than one of these rather than picking a single box.

Q3 — Why do we hold out a test set, and what breaks if we skip it?

Training data measures fit; test data measures generalisation. Without a held-out set, all you know is how well the model memorised data it has already seen — you have no honest read on how it will behave on a new order. A model with enough capacity can hit near-zero training error by memorising noise, like learning that one specific restaurant "always" takes 47 minutes purely because that happened to be true in the training window — a coincidence, not a pattern, and it will not hold up on new orders. The seven-step workflow on this page keeps 20% of the data untouched through training specifically so this gets caught at evaluation time rather than in production.

Q4 — What's the practical difference between overfitting and underfitting, and how do you tell them apart from metrics alone?

Look at train and test performance together, not in isolation. Overfitting shows a large gap: strong training score, materially worse test score — the model memorised noise instead of learning signal. Underfitting shows both scores bad and close together — the model was never complex enough to capture the real pattern in the first place, so there is no gap to reveal. The fixes point in opposite directions: underfitting needs more model capacity or better features, exactly what step 6 of the DoorDash workflow does by moving from Linear Regression to XGBoost and adding three new engineered features, dropping MAE from 4.2 to 2.8 minutes. Overfitting instead needs less capacity, more training data relative to capacity, or regularisation.

Q5 — How would you explain machine learning to a non-technical stakeholder who keeps asking 'but how does it actually decide?'

I would ground it in a concrete before-and-after rather than a definition. We first tried writing down every rule ourselves — if distance is under 2km, add this many minutes, if it's raining add this many more — and it failed because the real relationship between dozens of factors is too complex for a person to hand-enumerate. Instead we show the system hundreds of thousands of past examples, each one an order and how long it actually took, and let it find the pattern itself. It is not reasoning like a person and it is not magic — it is finding statistical regularities in what already happened and applying them to new, similar situations. I would also flag the honest limitation upfront: it will be wrong on genuinely novel situations unlike anything in its training history, which is exactly why we monitor it continuously after deployment.

What comes next

You're ready for the first algorithm

You now have the foundation. You know what Machine Learning is, how it differs from traditional programming, what the three types are, what the seven-step workflow looks like, and what the key vocabulary means.

The next page introduces the simplest possible supervised learning algorithm — Linear Regression — and uses it to build an actual delivery time predictor for DoorDash. You will see every concept from this page in working code.

Next up in Classical ML
Linear Regression — predicting DoorDash delivery time
Start →

🎯 Key Takeaways

  • ML = examples in, rules out. You provide labelled data; the algorithm finds the patterns and encodes them as a model.
  • Training = predict → measure error → adjust → repeat. The model iterates over the training data, nudging its parameters toward lower loss on each pass.
  • Three types: Supervised (labelled data, most common), Unsupervised (no labels, find structure), Reinforcement (learn from rewards). This section covers Supervised.
  • Every ML project follows the same 7-step workflow: define problem → collect data → prepare data → train → evaluate → improve → deploy.
  • Overfitting means memorising training data (good train score, bad test score). Underfitting means too simple (bad both). Both are diagnosable and fixable.
  • 12 key vocabulary terms — feature, label, model, training/test data, parameters, loss, overfitting, underfitting, hyperparameter, inference, baseline — are defined and will not be re-explained.
Share

Discussion

0

Have a better approach? Found something outdated? Share it — your knowledge helps everyone learning here.

Continue with GitHub
Loading...