Compensatory Classes - Additional Optional Classes
Compensatory Classes - Additional Optional Classes
• Additional optional
classes
1
“Dream, Dream, Dream. Dreams transform into
thoughts and thoughts result in action.”
-APJ Abdul Kalam
2
Why to Study Machine Learning?
[Most of the content in the presentation are borrowed from the slides created by Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC
Berkeley. All materials available at http://ai.berkeley.edu.]
Character Recognition
Speech Recognition
Fingerprint Based Identity
Disease Diagnosis
Video based Surveillance
Object Recognition
Credit Screening
Natural Language Processing
Applications
Prediction
Medical disease
Price of a stock
Estimation
Risk factor of certain disease
Classification
Object in a scene
Recognition
Handwritten character
13
Artificial Intelligence and Robotics
Medical Robots
Manufacturing Robots
Domestic Robots
Mobile Robots
NAO Robot
Use cases of AI and Robotics in Agriculture
Sophia: The First Robot to Receive Citizenship of a Country
Automation with Generative AI & ChatGPT
How Explainable AI Works
Generative adversarial networks
“the most interesting
idea in the last 10
years in Machine
Learning”
24
AI History
The 7 Areas of AI:
1. Knowledge Representation.
(Understanding Form, shapes etc.. Recognition through partial Information)
3. Learning.
(Copying a human by watching and repeating the task).
What is a machine?
Is the computer a machine?
Ref: NPTEL course Artificial Intelligence Introduction by Prof Deepak Khemani, IIT Madras
Human vs Machine
Is human a machine HUMAN (~)
Free will
Operate on a broad variety Self-repair
low energy foods vs highly refined fuels They reproduce themselves
Self navigate through complex Not build or programmed
for specific purpose
environments.
No design
They spontaneously organize into Emotion
collectives for mutual defense Consciousness
Ethics
They communicate
Generalizability
They invent, they problem-solve, they
share solutions to common challenges.
No human operator/controller
The debate over Thinking Machines
Herbert Dreyfus: “Intelligence depends upon unconscious
instincts that can never be captured in formal rules”
https://en.wikipedia.org/wiki/Hubert_Dreyfus%27s_views_on_artificial_intelligence
Ref: NPTEL course Artificial Intelligence Introduction by Prof Deepak Khemani, IIT Madras
Intelligence and machine
Intelligence: the ability to acquire and apply knowledge and
skills.[Dictionary definition]
“The idea that thinking and computing are radically the same” John Haugeland in “AI:
The vary Idea”
Ref: NPTEL course Artificial Intelligence Introduction by Prof Deepak Khemani, IIT Madras
Defining AI
Computational Rationality
A (Short) History of AI
1940-1950: Early days
1943: McCulloch & Pitts: Boolean circuit model of brain
1950: Turing's “Computing Machinery and Intelligence”
1950—70: Excitement: Look, Ma, no hands!
1950s: Early AI programs, including Samuel's checkers
program, Newell & Simon's Logic Theorist, Gelernter's
Geometry Engine
1956: Dartmouth meeting: “Artificial Intelligence” adopted
1958: John McCarthy LISP, Program with common sense
1962: Frank Rosenblatt- perceptron’s convergence theorm
1964: Eliza- Chatbot created at MIT AI Lab
1965: Robinson's complete algorithm for logical reasoning
Failure:
Most early programs knew nothing of their subject matter
Intractactability of many of the problems
Basic structures being used to generate intelligent behaviour
A (Short) History of AI
1970—90: Knowledge-based approaches
1969—79: Early development of knowledge-based systems
DENDRAL(Buchanan et. al. 1969): inferring molecular structure
MYCIN(Feigenbaum et al. 1971): diagnose blood infection
SHRDLU(Winograd): understanding natural language
Image
Imageref: https://www.gpsmycity.com/tours/telegraph-avenue-shopping-in-berkeley-
Ref: https://www.flickr.com/photos/dalaimages/4980104346
5276.html
Branches of AI
Ref: https://medium.com/@chethankumargn/artificial-intelligence-definition-types-examples-technologies-962ea75c7b9b
Natural Language
Speech technologies (e.g. Siri)
Automatic speech recognition (ASR)
Text-to-speech synthesis (TTS)
Dialog systems
Web search
Text classification, spam filtering, etc…
Vision (Perception)
Object and face recognition
Scene segmentation
Image classification
Technologies
Vehicles
Rescue
Soccer!
Lots of automation…
Logical systems
Theorem provers
NASA fault diagnosis
Question answering
Methods:
Deduction systems
Constraint satisfaction
Satisfiability solvers (huge advances!)
Text from Bart Selman, image from IBM’s Deep Blue pages
Decision Making
Applied AI involves many kinds of automation
Scheduling, e.g. airline routing, military
Route planning, e.g. Google maps
Medical diagnosis
Web search engines
Spam classifiers
Automated help desks
Fraud detection
Product recommendations
… Lots more!
Recent AI news (Only few)
The Ministry of Commerce and Industry has set up the Task force on Artificial Intelligence to kick-
start the use of AI for India's economic transformation. https://www.aitf.org.in/
DABUS, a machine architecture, has been given credit for designing a ‘fractal container’
(pdf) which is easy for robots to grasp, as well as a ‘neural flame’ (pdf) which attracts enhanced
attention.
Elon Musk’s ambitious Neuralink project to link human brains with machines is part of the
entrepreneur’s crusade to “stop the AI apocalypse”. https://artificialintelligence-
news.com/2019/07/18/musk-link-human-brains-machines-stop-ai-apocalypse/
Source of references: https://artificialintelligence-news.com/
Main events in the history of AI
The birth of Artificial McCulloch and Pitts, A Logical Calculus of the Ideas
Intelligence Immanent in Nervous Activity, 1943
(1943–1956) Turing, Computing Machinery and Intelligence, 1950
The Electronic Numerical Integrator and Calculator
project (von Neumann)
Shannon, Programming a Computer for Playing Chess,
1950
The Dartmouth College summer workshop on machine
intelligence, artificial neural nets and automata theory,
1956
Main events in the history of AI
Used when:
Human expertise does not exist (navigating on Mars)
Humans are unable to explain their expertise (speech recognition)
Mimicking like human intelligence (unmanned system)
54
What is Machine Learning?
56
Training Set
Data+ Model
Pre-
Processing
Task
Feature f
Cost
Function
Sub-problems
Feature Extraction
Noise
Model Selection
Model Fitting
Prior Knowledge
Missing Features
Segmentation
Context
Invariances
Evidence Pooling
Costs and Risks
Computational Complexity
58
Learning and Adaptation
Supervised Learning
Unsupervised Learning
Reinforcement Learning
59
Supervised Learning
Supervision: The data (observations, measurements, etc.) are
labeled with pre-defined classes.
Regression, Classification
It is like that a “teacher” gives the classes (supervision).
60
Unsupervised Learning
Unsupervision: The goal is to describe the associations and
patterns among a set of input measures
Clustering
Learning Algorithm
Classification VS Clustering
61
Reinforcement Learning
Reinforcement: ‘Reward’/ ‘Penalty’ feedback to categorize data.
In reinforced learning, learning is based on a reward that
reinforces it is ‘correct’ or a penalty that reinforces it is ‘wrong’.
62
A Few Learning techniques
Unsupervised
Clustering
Supervised
Regression
Classification
63
Clustering: Unsupervised Learning
Patterns/Feature
Learning Algorithm
64
Training Set
Data+ Model
Pre-
Processing
Task
Feature f
Cost
Function
Model
Model does not generalize to unseen data
Fail to predict things that are not in training sample
Pick a model that has lower generalization error
How to evaluate generalization error?
Split your data into train, validation, and test set.
Use test set error as an estimator of generalization error
66
Model Selection
Procedure:
67
Best Model : Bias/Variance Trade-off?
Y
Y
Y
X X X
Underfit Just right Overfit
High bias High Variance
Too simple Too Complex
68
Low Variance High Variance
High Bias
Low Bias
69
Bias-Variance Trade Off Is Revealed Via Test Set Not
Training Set
MSEtest
MSEtrain
Artificial Intelligence
Search
[Most of the content in the presentation are borrowed from the slides created by Dan Klein and Pieter Abbeel for CS188
Intro to AI at UC Berkeley. All materials available at http://ai.berkeley.edu.]
Agent and Environment
An agent is an entity that perceives its environment through
sensors and acting upon that environment through actuators.
Environment
Agent Sensors Percepts
?
Actions
Actuators
Planning agents:
Ask “what if”
Decisions based on (hypothesized)
consequences of actions
Must have a model of how the world evolves in
response to actions (Model based agent)
Must formulate a goal (Goal based agent)
Consider how the world WOULD BE
Agent Environment
Sensors Percepts
?
Actuators Actions
Pac-Man is a registered trademark of Namco-Bandai Games, used here for educational purposes
Search Problems
Search Problems Are Models
Search Problems
A search problem consists of:
A state(environment) space
Possible actions
“N”,
A successor function 1.0
(Mapping of state to action
with costs) “E”, 1.0
states?
No of unique locations of tiles (9! )
actions?
move blank left, right, up, down
goal test? = goal state (given)
path cost? 1 per move
states?
No of unique locations of tiles (9! is the total number of possible configurations of the puzzle,
whereas 9!/2 (181440) is the total number of solvable configurations. 8-puzzle has a property that exactly
half (of all) permutations can be reached from any starting state.)
actions?
move blank left, right, up, down
goal test? = goal state (given)
path cost? 1 per move
Example: 8-queens problem
The goal of the 8-queens problem is to place
eight queens on a chessboard such that no queen
attacks any other
States: Any arrangement of 0 to 8 queens on the board is a state.
Initial state: No queens on the board.
Actions: Add a queen to any empty square.
Transition model: Returns the board with a queen added to the
specified square.
Goal test: 8 queens are on the board, none attacked. In this
formulation, we have 64 · 63 ··· 57 ≈ 1.8×10^14 possible
sequences to investigate.
Example: Pacman game
World state:
Agent positions: 120
Food count: 30
Ghost positions: 12
Agent facing: NSEW
How many
World states?
120x(230)x(122)x4
States for pathing?
120
States for eat-all-dots?
120x(230)
State Space Graphs and Search Trees
State Space Graphs
A search tree:
A “what if” tree of plans and their outcomes
The start state is the root node
Children correspond to successors
Nodes show states, but correspond to PLANS that achieve those states
For most problems, we can never actually build the whole tree
State Space Graphs vs. Search Trees
a G entire PATH in d e p
b c the state b c e h r q
d
e
f
space graph. h r p q f
a a
S h We construct
p q f q c G
p r
q both on a
q c G
demand – and
a
we construct
as little as
possible.
Problem Solving by Searching
Problem Formulation
Problem Formulation
A description of the actions we can take to transform one state of the world into another
(operators).
A description of the desired state of the world (goal state), this could be implicit or explicit.
101
Problem Formulation
8-Puzzle Problem
102
Problem Formulation
8-Puzzle Problem
Representing states:
3 by 3 array 5 6 7
5, 6, 7
8, 4, BLANK 8 4
3, 1, 2
3 1 2
A vector of length nine
5,6,7,8,4, BLANK,3,1,2
A list of facts
Upper_left = 5
Upper_middle = 6
Upper_right = 7
Middle_left = 8
103
Problem Formulation
8-Puzzle Problem
Specifying operators:
There are often many ways to specify the operators, some will be much easier to implement...
• Move 1 left
• Move 1 right
• Move 1 up
• Move 1 down • Move Blank left
• Move 2 left • Move Blank right
• Move 2 right 5 6 7
• Move Blank up
• Move 2 up • Move Blank down 8 4
• Move 2 down
• Move 3 left 3 1 2
• Move 3 right
• Move 3 up
• Move 3 down 104
• Move 4 left
Problem Formulation
8-Puzzle Problem
1 2 3 1 2 3
4 8 4 5 6
7 6 5 7 8
Operators: slide blank up, slide blank down, slide blank left, slide blank right
1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
4 8 4 8 5 4 8 5 4 5 4 5 4 5 6
7 6 5 7 6 7 6 7 8 6 7 8 6 7 8
Three missionaries and three cannibals are on the left bank of a river.
Find a way to get everyone to the right bank, without ever leaving a group of
missionaries in one place outnumbered by cannibals in that place.
Missionaries and Cannibals
Initial State
107
Missionaries and Cannibals
Goal State
108
Problem Solving by Searching
A toy problem:
Missionaries and Cannibals
Missionaries and cannibals
Three missionaries and three cannibals are on the left bank of a river.
Find a way to get everyone to the right bank, without ever leaving a group of
missionaries in one place outnumbered by cannibals in that place.
110
Missionaries and cannibals
111
(3,3,1): Initial State
112
A missionary and cannibal cross
113
(2,2,0)
114
One missionary returns
115
(3,2,1)
116
Two cannibals cross
117
(3,0,0)
118
A cannibal returns
119
(3,1,1)
120
Two missionaries cross
121
(1,1,0)
122
A missionary and cannibal return
123
(2,2,1)
124
Two Missionaries cross
125
(0,2,0)
126
A cannibal returns
127
(0,3,1)
128
Two cannibals cross
129
(0,1,0)
130
A cannibal returns
131
(0,2,1)
132
The last two cannibals cross
133
(0,0,0) : Goal State
134
Solution = the sequence of actions within the path : [
(3,3,1)→ (2,2,0)→(3,2,1) →(3,0,0) →(3,1,1) →(1,1,0) →(2,2,1) →(0,2,0)
→(0,3,1) →(0,1,0) → (0,2,1) →(0,0,0)]; Cost = 11 crossings
135
Tower of Hanoi
There are three towers
64 gold disks, with decreasing sizes, placed on the first tower
You need to move all of the disks from the first tower to the last tower
Larger disks can not be placed on top of smaller disks
The third tower can be used to temporarily hold disks
Tower of Hanoi
The disks must be moved within one week. Assume one disk can
be moved in 1 second. Is this possible?
Given a full 5-gallon jug and an empty 2-gallon jug, the goal is to fill the 2-gallon jug with exactly one
gallon of water.
Possible actions:
Empty the 5-gallon jug (pour contents down the drain)
Empty the 2-gallon jug
Pour the contents of the 2-gallon jug into the 5-gallon jug (only if there is enough room)
Fill the 2-gallon jug from the 5-gallon jug
Case 1: at least 2 gallons in the 5-gallon jug
Case 2: less than 2 gallons in the 5-gallon jug
Monkey & Bananas
A hungry monkey is in a room. Suspended from the roof, just out of his reach, is a bunch of bananas. In
the corner of the room is a box. The monkey desperately wants the bananas but he can’t reach them.
What shall he do?
Summary
Search: process of constructing sequences of actions that achieve a goal given a
problem.
Goal formulation is the first step in solving problems by searching. It facilitates problem
formulation.
Formulating a problem requires specifying five components: State representation,
Initial state, Goal state, Operators (actions), and Path cost function.
152
Quiz: State Space Graphs vs. Search Trees
Consider this 4-state graph: How big is its search tree (from S)?
S G
Tree
Traverse states multiple times in multiple paths
Loop identification is difficult
Tree Search
Searching with a Search Tree
Search:
Expand out potential plans (tree nodes)
Maintain a fringe of partial plans under consideration
Try to expand as few tree nodes as possible
General Tree Search
Important ideas:
Fringe: The set of all nodes at the end of all visited paths is
called the fringe, frontier or border.
Expansion
Exploration strategy
Fringe is a LIFO
stack S
d e p
b c e h r q
a a h r p q f
p q f q c G
q c G a
a
Depth-First Search (DFS) Properties
What nodes DFS expand?
Some left prefix of the tree. 1
Could process the whole tree! b
… b
node
If m is finite, takes time O(bm) nodes
b2
How much space does the fringe take? m tiers nodes
Only has siblings on path to root, so O(bm)
Is it complete? bm
m could be infinite, so only if we prevent nodes
cycles (more later)
Is it optimal?
No, it finds the “leftmost” solution,
regardless of depth or cost
Breadth-First Search
Breadth-First Search
Strategy: expand a G
b c
a shallowest
d e
node first f
S h
Implementation: p q r
Fringe is a FIFO
queue S
d e p
Sear q
b c e h r
ch
a a h r p q f
Tiers
p q f q c G
q c G a
a
Breadth-First Search (BFS) Properties
What nodes does BFS expand?
Processes all nodes above shallowest solution 1 node
b
Let depth of shallowest solution be s … b
Search takes time O(bs) s tiers nodes
b2
nodes
How much space does the fringe take? bs nodes
Has roughly the last tier, so O(bs)
Is it complete? bm nodes
s must be finite if a solution exists, so yes!
Is it optimal?
Only if costs are all 1 (more on costs later)
Quiz: DFS vs BFS
Quiz: DFS vs BFS
Used to train the model. Used to tune hyperparameters and Used to assess the final performance
select the best model. of the selected model on unseen
data.
Cross-validation