0.1 Introduction to Machine Learning: Definition, AI vs ML vs DL★★
PYQs5
- A machine learning algorithm builds a model based on sample data, known as ______. → Training data 2023-24 1M recent
- What is Artificial Intelligence and why do we need it? 2022-23 5M recent
- How is machine learning related to AI? 2022-23 4M recent
- Differentiate between Artificial Intelligence, Machine Learning and Deep Learning. 2022-23 6M recent
- Differentiate between Machine Learning and Deep Learning. 2023-24 5M recent
Who Wrote the Rules?
- Nobody wrote rules telling your phone what your face looks like.
- Yet it unlocks the moment it sees you.
- It learned your face from examples, the way a child learns.
- That's machine learning, and it changes what computers can do.
What Is Machine Learning PYQ 1M
Machine learning (ML) is the field in which computers learn patterns from data and improve at a task with experience, instead of following hand-written rules.
Classic definitions
- Arthur Samuel (1959): the field of study that gives computers the ability to learn without being explicitly programmed.
- Tom Mitchell (1997): "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."
Worked example: a spam filter
| Part | Spam filter |
|---|---|
| Task T | classify each e-mail as spam or not spam |
| Performance P | % of e-mails classified correctly |
| Experience E | thousands of e-mails already labelled spam / not spam |
Training data
- The sample data a model learns from is called training data. The learnt result is the model.
flowchart TD
A["<b>Traditional code</b><br>data + rules"]:::blue --> B["<b>Output</b>"]:::blue
C["<b>Machine learning</b><br>data + answers"]:::amber --> D["<b>Rules (model)</b><br>learnt"]:::green
classDef blue fill:#5b84d424,stroke:#5b84d480
classDef amber fill:#d6a24424,stroke:#d6a24480
classDef red fill:#d0707024,stroke:#d0707080
classDef green fill:#52a86e24,stroke:#52a86e80- In traditional programming, humans write the rules; in ML, the computer finds the rules from examples.
Artificial Intelligence PYQ 5M
Artificial intelligence (AI) is the science of making machines perform tasks that normally need human intelligence, such as reasoning, understanding language, seeing and deciding. The term was coined by John McCarthy in 1956.
Goals of AI
- Reasoning and problem-solving · knowledge representation · perception (vision, speech) · natural language understanding · decision-making and planning · learning.
Why we need AI
- Huge data: humans can't analyse billions of records; AI can.
- Automation of complex tasks: driving assistance, medical image screening, fraud checks.
- Speed and scale: decisions in milliseconds, 24×7.
- Accuracy and consistency: no fatigue or mood swings.
- Personalisation: recommendations, adaptive learning apps.
- Dangerous or repetitive work: robots in mines, space, factories.
- Why now: cheap computing power (GPUs, cloud), vast data from the internet and sensors, and better algorithms.
Narrow vs general AI
- Narrow (weak) AI: good at one task: chess engines, voice assistants, face unlock. All AI today is narrow.
- General (strong) AI: human-level intelligence across all tasks; still a research goal.
How ML Relates to AI PYQ 4M
- ML is a subset of AI: the data-driven way of achieving AI.
- Early AI was mostly rule-based (expert systems): humans wrote "if–then" rules. These broke when situations were too many to list.
- ML lets the system learn the rules from data, so it handles new cases and improves with more data.
- Most modern AI (speech recognition, recommendations, translation) is built with ML.
| Basis | Rule-based AI | Learning-based AI (ML) |
|---|---|---|
| Rules come from | human experts | data |
| New situations | fails if no rule exists | generalises from examples |
| Improves with data? | no | yes |
| Example | early medical expert systems | modern spam filters |
AI vs ML vs DL PYQ 6M
Deep learning (DL) is a subset of ML that uses neural networks with many layers to learn features directly from raw data (→ 4.4).
flowchart TD
subgraph AI["Artificial Intelligence"]
direction TB
a1["machines that act<br>intelligently"]:::blue
subgraph ML["Machine Learning"]
direction TB
m1["learns patterns from data"]:::amber
subgraph DL["Deep Learning"]
d1["many-layer neural networks"]:::green
end
end
end
a1 ~~~ m1
m1 ~~~ d1
classDef blue fill:#5b84d424,stroke:#5b84d480
classDef amber fill:#d6a24424,stroke:#d6a24480
classDef red fill:#d0707024,stroke:#d0707080
classDef green fill:#52a86e24,stroke:#52a86e80
style AI fill:#5b84d414,stroke:#5b84d480
style ML fill:#d6a24414,stroke:#d6a24480
style DL fill:#52a86e14,stroke:#52a86e80| Basis | AI | ML | DL |
|---|---|---|---|
| Scope | broadest field | subset of AI | subset of ML |
| Approach | rules, search, logic or learning | learns patterns from data | multi-layer neural networks |
| Data needed | can work with little | moderate | very large |
| Feature engineering | not applicable / manual rules | mostly manual | automatic |
| Hardware | varies | ordinary CPU often enough | GPUs / TPUs |
| Interpretability | high for rule systems | moderate | low ("black box") |
| Examples | chess engine, expert system | spam filter, loan approval | face recognition, speech, chatbots |
- Every DL system is ML, and every ML system is AI, but not the other way round.
- The detailed ML vs DL comparison → 4.4.
Applications of Machine Learning
- Healthcare: disease prediction from reports, cancer detection in scans.
- Finance: fraud detection on card transactions, credit scoring.
- E-commerce: product recommendations ("customers also bought").
- Computer vision: face unlock, number-plate reading, quality checks in factories.
- Speech and language: voice assistants, translation, chatbots.
- Autonomous vehicles: detecting lanes, signs and pedestrians.
- Spam and malware filtering in e-mail.
Steps to Develop an ML Application
flowchart TD
A["<b>1 · Define the problem</b><br>goal, success measure"]:::blue --> B["<b>2 · Collect data</b>"]:::blue
B --> C["<b>3 · Prepare data</b><br>clean, features"]:::amber
C --> D["<b>4 · Choose a model</b>"]:::amber
D --> E["<b>5 · Train</b>"]:::amber
E --> F["<b>6 · Evaluate and tune</b>"]:::amber
F -.->|"not good enough"| D
F --> G["<b>7 · Deploy and monitor</b>"]:::green
classDef blue fill:#5b84d424,stroke:#5b84d480
classDef amber fill:#d6a24424,stroke:#d6a24480
classDef red fill:#d0707024,stroke:#d0707080
classDef green fill:#52a86e24,stroke:#52a86e80- Problem definition: what to predict, and how success is measured (accuracy, error).
- Data collection: from databases, sensors, web, surveys.
- Pre-processing: handle missing values, remove noise, encode and scale features (→ 0.3).
- Feature engineering: choose or create the most useful inputs.
- Model selection: pick suitable algorithms (tree, regression, neural network…).
- Training: the algorithm learns from the training data.
- Evaluation: test on unseen data with suitable metrics (→ 3.1).
- Tuning: adjust hyperparameters, try other models (→ 3.4).
- Deployment and monitoring: put it into use; retrain when data changes.
- Example: predicting house prices → collect past sales → clean and encode location → try linear regression and random forest → choose the lower-error model → deploy on a property website.
Objectives, Design Issues and Approaches
Objectives of ML
- Predict outcomes for new data · automate decisions · discover hidden patterns · improve with experience · generalise from examples to unseen cases.
Designing a learning system (Mitchell's checkers example)
- Choose the training experience: what data the system learns from (games played against itself).
- Choose the target function: what exactly to learn (the value of a board position).
- Choose its representation: how to express it (a weighted sum of board features).
- Choose the learning algorithm: how to adjust it (update weights to reduce error).
Design issues
- Data quality and quantity: too little or noisy data gives poor models.
- Overfitting vs underfitting (→ 3.3).
- Bias and fairness: biased data gives biased decisions.
- Interpretability: can we explain the prediction?
- Computational cost: training time and memory.
- Choosing the algorithm and features.
Approaches
- By learning type: supervised, unsupervised, reinforcement (→ 0.2).
- By method: tree-based, instance-based (KNN), probabilistic (Naive Bayes), linear models, neural networks.
Can Every Problem Be Solved by ML?
No. ML fits only some problems.
When ML fits
- A pattern exists but is hard to write as rules (recognising faces).
- Enough data is available.
- Some error is acceptable.
- The situation changes over time and the system must adapt (spam).
When ML does not fit
- Exact rules already exist: tax calculation, sorting numbers, interest formulas.
- No or very little data: a brand-new product with no history.
- 100% accuracy or full explanation needed: legal judgements, safety-critical logic.
- Purely random events: predicting lottery numbers.
- Example: ML suits predicting which customers may leave a telecom company; it does not suit calculating their monthly bill.
⚡ Quick recall
- ML? → computers learn patterns from data, improving with experience · Samuel 1959 · Mitchell T, P, E
- Model built from sample data? → training data
- AI? → machines doing tasks needing human intelligence · McCarthy 1956 · narrow vs general
- Why AI? → huge data · automation · speed · accuracy · personalisation · dangerous work
- ML and AI? → ML is the data-driven subset of AI · learns rules instead of being given them
- AI vs ML vs DL? → nested: AI ⊃ ML ⊃ DL · DL = many-layer neural networks, big data, GPUs, automatic features
- Steps? → define → collect → prepare → features → choose model → train → evaluate → tune → deploy
- Design? → training experience · target function · representation · learning algorithm
- All problems by ML? → no: not for exact-rule, no-data, must-be-perfect or random problems