Introduction to Machine Learning, ML Workflow & Problem Formulation
Comprehensive foundation covering classical rules vs pattern learning, real-life analogies, ML types, Amazon enterprise use cases, problem formulation & feature space.
What is Machine Learning?
Machine Learning (ML) is a branch of Artificial Intelligence (AI) where computers learn patterns from data instead of being explicitly programmed with rules.
Instead of writing every rule manually, we provide examples (data), and the computer learns how to make predictions or decisions.
Arthur Samuel (1959) Definition"A field of study that gives computers the ability to learn without being explicitly programmed."
Even today, this is one of the most accepted definitions.
Traditional Programming vs Machine Learning
Traditional Programming
In traditional programming, we write all the rules ourselves.
Example:
if (email.contains("Win Money")) {
return Spam;
} else {
return Not Spam;
}Problems:
- Impossible to write every rule.
- Rules become very complex.
- Hard to maintain.
Machine Learning
Instead of writing rules, we provide many examples.
Example:
Email 1 → Spam
Email 2 → Spam
Email 3 → Not Spam
...
The model automatically learns what makes an email spam.Real-Life Analogy: Teaching a Child to Recognize Cats
You tell the child explicitly:
- Cats have two ears.
- Cats have whiskers.
- Cats have four legs.
- Cats have a tail.
Instead, you simply show thousands of cat images and say "This is a cat."
Eventually, the child learns the pattern automatically. Machine learning works in the same way.
Why Do We Need Machine Learning?
Many real-world problems are too complicated for manually written rules.
| Problem | Why ML is Needed |
|---|---|
| Face Recognition | Millions of different faces |
| Speech Recognition | Different accents and voices |
| Fraud Detection | Fraudsters constantly change strategies |
| Product Recommendation | Every customer behaves differently |
| Self Driving Cars | Infinite driving situations |
Machine Learning allows computers to continuously improve as more data becomes available.
Types of Machine Learning
Machine Learning is mainly divided into three categories.
1. Supervised Learning
This is the most commonly used type of Machine Learning. Here, every training example has:
- Input (Features)
- Correct Output (Label)
The model learns the relationship between input and output:
Input: Area = 1500 sq ft, Bedrooms = 3, Bathrooms = 2
Output: Price = ₹80 Lakhs
The model learns how house features affect the price.
Email → Model → Spam / Not Spam
House Price Prediction, Disease Prediction, Stock Prediction, Spam Detection, Image Classification, Sentiment Analysis
2. Unsupervised Learning
In Unsupervised Learning, data has no labels. The model tries to discover hidden patterns or structures.
E-Commerce Customer Example:
Customer A, B, C, D. Nobody tells the model which customers are similar. The algorithm automatically groups customers:
Group 1: High spenders | Group 2: Occasional buyers | Group 3: New customers
Real-Life ApplicationsSpotify groups users with similar music tastes.
Netflix groups users with similar watching behavior.
Amazon groups customers with similar shopping habits.
3. Reinforcement Learning
Reinforcement Learning is inspired by how humans learn through rewards and punishments. Instead of labeled data, the agent interacts with an environment.
Correct action (Sit) → Reward. Wrong action → No Reward. Eventually, the dog learns. Machine Learning agents learn similarly.
Self Driving Cars, Robotics, Chess AI, AlphaGo, Game Playing, Recommendation Optimization
Comparison of ML Types
| Supervised | Unsupervised | Reinforcement |
|---|---|---|
| Labeled Data | No Labels | Rewards |
| Predict Output | Find Patterns | Learn Actions |
| Spam Detection | Customer Segmentation | Robot Navigation |
| Classification | Clustering | Decision Making |
Machine Learning in Amazon
Machine Learning powers many Amazon products.
Product Recommendation
When Amazon recommends products, it predicts:
Users with similar interests → Likely Product → Recommendation
Example: You bought Laptop → Amazon recommends Laptop Bag, Wireless Mouse, Keyboard.
Fraud Detection
Every transaction is classified as Fraud or Safe. This is a classification problem.
Alexa
Alexa understands speech using Natural Language Processing, Speech Recognition, and Machine Learning.
Delivery Optimization & Demand Forecasting
Predicts best delivery route, delivery time, traffic conditions, and how many products customers will buy next week to manage inventory efficiently.
Machine Learning Workflow
Every ML project follows a structured workflow.
Ask: What problem are we solving? Is it Classification or Regression? What is expected output?
Important InsightMachine Learning is iterative, not linear. A typical cycle is:
Train → Evaluate → Improve Features → Retrain → Evaluate AgainImproving features or collecting better data often gives larger gains than switching algorithms.
Problem Formulation
Problem formulation is one of the most critical steps in any ML project. A poorly defined problem can lead to poor results, even with advanced algorithms.
Features (X)
Features are the input variables provided to the model. Also called Independent Variables, Predictors, or Inputs.
Good features should be Relevant, Informative, Available at prediction time, and Free from leakage.
Label (Y)
The label is the value the model tries to predict. Also called Target Variable, Output, or Dependent Variable.
The choice of label determines whether the task is classification or regression.
Hypothesis Space
The hypothesis space is the set of all possible functions that a model can learn.
| Model | Can Learn |
|---|---|
| Linear Regression | Linear relationships |
| Decision Tree | Rule-based partitions |
| Neural Network | Complex non-linear relationships |
Key Takeaways
- Machine Learning learns patterns from data instead of manually written rules.
- The three main types are Supervised, Unsupervised, and Reinforcement Learning.
- Every ML project follows an iterative workflow: define problem, collect data, engineer features, select model, train, evaluate, deploy, and monitor.
- Feature engineering converts raw data into numerical representations that models can understand.
- Clearly defining Features (X), Label (Y), and Model Family is essential for a successful ML project.
- Better data and better features often improve performance more than simply using a more complex algorithm.