The Essentials of Machine Learning
Learn the difference between conventional programming and machine learning, the types of machine learning, and some of its applications.
From rules to data
Before directly jumping into machine learning, let’s figure out why we need it. A conventional program functions like a commander: the programmer provides specific inputs and a predefined set of instructions (rules). The computer then follows these rules to produce an output. For example:
- Input: An unsorted list of numbers.
- Algorithm (rules): Logic such as bubble sort or merge sort.
- Output: A sorted list.
This typical way of programming that uses a fixed set of rules won’t scale for many pattern identification problems.
From data to rules
Consider an example of identifying a human face. There’s a plethora of parameters that can describe a human face, including the width, shape, and height of the nose, color and depth of the eyes, gender of the person, type and color of facial hair, etc. It isn’t scalable to write a set of rules that correspond to each of these parameters. We can’t practically address so many combinations while programming conventionally. In contrast, a typical way of addressing this problem is to dynamically learn the rules (program) from the data (face images) itself. Therefore, machine learning comes to the rescue in all those scenarios where typical programming to define problem-specific rules might be impossible.
What is machine learning?
This brings us to the fundamental shift in how we solve problems. Since we cannot manually write millions of rules for complex tasks, we need a system that can derive those rules itself. Instead of coding the solution, we code a system that can find the solution.
According to Arthur Samuel, machine learning is the “field of study that gives computers the ability to learn without being explicitly programmed.”
But what does it actually mean for a machine to “learn”?
As illustrated below, the machine takes in raw data and the desired results (output labels). It analyzes the data, finds the hidden patterns, and outputs a model. Think of this model as a program that the machine wrote for itself—one that we can use to make predictions in the future.
To understand how this pattern finding works, think of a machine learning model like a new intern on their first day at a job (e.g., approving loan applications).
The task: Determine who qualifies for a loan.
The start: The intern knows nothing. They guess randomly.
The feedback: The supervisor corrects them: “No, this person has high debt, reject them,” or “Yes, this person has a steady income, approve them.”
The learning: Over time, the intern notices patterns (e.g., “High debt usually means risk”). They adjust their internal mental rules.
The result: Eventually, the intern can approve loans accurately without the help of a supervisor.
In machine learning, the model plays the role of the intern. The supervisor is a quantity called the loss function, which is a number that indicates how inaccurate the model’s predictions are. The experience comes from the training data, which is simply past examples that the model learns from.
The machine learning pipeline
Understanding what the intern does is only half the battle. As engineers, we need to create an office space where interns work.
Beginners often think machine learning is just a single line of code like model.train(). In reality, that is only about 10% of the work. The rest involves preparing the environment so the model can succeed. This structured process is called the machine learning pipeline.
To understand why we need a pipeline, imagine we are building a recommendation system like Netflix. We cannot simply “tell the AI to recommend movies.” We need a systematic flow:
Data: We first need to gather millions of logs of what users watched.
Processing: We must clean that data (removing testing accounts or corrupted logs).
Training: Only then does the model learn patterns (e.g., “People who watch Inception also watch Interstellar”).
Deployment: Finally, we have to deliver those predictions to the user’s TV screen in real-time.
If any step in this chain fails, e.g, if the data is dirty or the deployment is slow, the entire system fails, regardless of how sophisticated the model is. Let’s break down this standard pipeline, step-by-step.
Data collection
Every model starts with data. Without it, we have nothing to learn from. The main task of this step is to aggregate raw information from various sources, like SQL databases, log files, or APIs.
For our movie recommender, this means querying databases for user watch history, scraping movie metadata (genres, actors), or logging every time a user clicks “Play.”
Real-world data is rarely clean. It is often scattered, incomplete, or messy.
Preprocessing and feature engineering
Machines cannot read English titles or understand movie posters directly; they only understand numbers. This step transforms raw data into a format the model can digest. This step involves cleaning errors (like missing values) and converting data into features (numerical representations).
For example, the model doesn’t know what “Action Movie” means. We must convert that genre into a number. We also need to handle users who haven’t rated any movies yet.
Garbage in, garbage out. If you feed a model dirty data, no amount of advanced math will fix the result.
Model selection
Now we choose the mathematical architecture best suited for the problem. This step involves selecting an algorithm based on the complexity of the data and the available resources.
For example, if we want to predict a rating (1–5 stars), we might choose a simpler predictive model. In contrast, if we need to process complex user behavior sequences, we might rely on a more advanced model designed for sequential data.
Training
This is the heavy lifting where the model actually learns. The model processes the data iteratively. It makes a prediction, checks the error (or loss), and adjusts its internal parameters to minimize that error.
For example, the movie recommender model guesses that a user will like The Dark Knight. The historical data shows us actually rated it 5 stars. The model confirms it was right and strengthens the mathematical pattern linking us to “Crime Thrillers.”
Evaluation
Before we let the model make decisions for real users, we must audit it. We test the model on unseen data, data that was hidden during the training phase.
We hide the fact that you watched Toy Story. We ask the model, “What would this user watch next?” If it suggests Toy Story, the model has generalized well. If it suggests a Horror movie, the model fails the test.
Deployment
This is where engineering meets the user. Integrating the trained model into a production application so it can make predictions (Inference) in real-time.
When you log in to Netflix and see “Top Picks for You,” that is the deployed model running in the background, processing your profile and serving recommendations in milliseconds.
Applications of machine learning
Where is this pipeline actually running? It isn’t just theoretical. This exact workflow of collecting data, training a model, and deploying it powers the technologies we use every day. Let’s explore some key domains where machine learning is transforming industries.
Computer vision
Computer Vision enables machines to see and interpret visual data, including images and video, just as humans do, but with pixel-perfect precision and an infinite attention span. In autonomous vehicles like Tesla and Waymo, cameras capture 360-degree video, which is processed by Convolutional Neural Networks (CNNs) to identify lanes, pedestrians, and traffic lights. The system then calculates steering and braking logic in milliseconds, transforming transportation from a manual task into a safety-critical automated service.
In medical imaging, AI models analyze X-rays, CT scans, and MRIs to detect tumors or fractures that are invisible to the human eye. Tools such as Google Health’s mammography AI act as a “second opinion” for radiologists, reducing false negatives and saving lives. In retail, technologies like Amazon Go’s “Just Walk Out” stores utilize cameras to track customer movement and the items they select from the shelf, combining object detection with pose estimation to eliminate checkout lines entirely.
Natural language processing
While Computer Vision enables machines to see, Natural Language Processing (NLP) allows them to understand human communication, bridging the gap between computer code (numbers) and text or voice. NLP empowers applications to interpret context, sarcasm, and intent, making human-computer interaction more intuitive.
One major application is real-time language translation, as seen in Google Translate. They analyze entire sentence structures to preserve meaning and tone across more than 100 languages, instantly breaking down language barriers.
Sentiment analysis is another powerful application: companies like Nike or Apple scan millions of tweets and reviews daily, classifying posts as positive, negative, or neutral. When negative sentiment spikes, the PR team is alerted immediately, often before a human reads a single tweet.
3. Generative AI
While traditional machine learning predicts answers, such as determining whether an email is spam, Generative AI goes a step further by creating entirely new data. This technology represents the frontier of the 2020s, enabling machines to be creative in ways that were previously impossible.
In software development, tools like GitHub Copilot or Cursor act as “AI pair programmers.” When a developer writes a comment, such as # function to calculate tax, the model generates the corresponding Python code automatically, significantly increasing productivity by 30–50% through handling boilerplate code.
Generative AI also addresses critical challenges in autonomous vehicles. Training self-driving cars requires massive amounts of data, but testing in real-life scenarios, such as accidents, snowy roads, or pedestrians crossing unexpectedly, is costly and dangerous. GenAI solves this by creating photorealistic simulations that safely generate these rare but important situations for model training.
In drug discovery, Generative AI can propose novel molecular structures and simulate how they interact with proteins, allowing researchers to explore potential treatments before ever entering a laboratory. This accelerates the pace of innovation and opens new possibilities in medicine.
4. Deep learning
Deep Learning powers most advanced computer vision and natural language processing tasks, but its impact extends far beyond these domains into scientific and numerical fields. In scientific discovery, DeepMind’s AlphaFold solved a 50-year-old “grand challenge” in biology by accurately predicting the 3D structure of proteins, accelerating the path to new medicines and treatments.
In finance, deep learning enables high-frequency trading by analyzing millions of stock market data points, including prices, volumes, and news sentiment, every microsecond. These models can detect non-linear patterns in market chaos that traditional statistical approaches often miss, giving traders a critical edge.
Deep learning also drives predictive maintenance in manufacturing. Sensors on factory equipment, such as jet engines, detect subtle changes in vibration weeks before a failure occurs. Deep learning models can interpret these signals to predict failures in advance, preventing costly downtime and saving millions of dollars.
Conclusion
We’ve established the key difference between conventional programming and machine learning: instead of manually writing rules, the system learns the rules directly from the data. This learning process is orchestrated by the Machine Learning Pipeline, which powers everything from Computer Vision to Generative AI.
To build these applications effectively, it’s important to know the basic types of machine learning. In the next lesson, we will introduce the three foundational pillars: supervised, unsupervised, and reinforcement learning.