AI Intro1
AI Intro1
CS-451
1 Assignments/Quizzes 20
3 Mid Term 20
4 Final 60
Google Class Room
AI-F14 A fcrylqu
AI-F14 B 9xbze2
What is Artificial Intelligence ?
Artificial:
Intelligence:
Finance
Intelligent Robotics
Gaming
Medicine
Web
Natural language processing
Expert systems
Vision systems
Speech recognition
Handwriting recognition
etc………
Artificial Intelligence Approach
Agents and Environments:
Sensors
Agent Enviroment
Effectors
Perception-Action Cycle
Intelligent Agent
An agent is anything that can be viewed as perceiving its
environment through sensors and acting upon that environment
through effectors
A rational agent is one that does the right action. The right action is
the one that will cause the agent to be the most successful.
P1 A1
P2 A2
P3 A3
Chess (deterministic)
Dice, poker, taxi driver (non deterministic)
Chess (static)
Taxi driving (dynamic)
Properties of Environments
Driving (continuous)
Properties of Environments
They are rational only if a correct decision is made only on the basis
of current precept.
Model − The knowledge about how the things happen in the world.
e.g. This time out mars Lander after picking up its first sample, it
stores this in the internal state of the world around it so when it come
across the second same sample it passes it by and saves space for
other samples.
Goal-based Reflex Agents
Goal-based agents further expand on the capabilities of the model-
based agents, by using "goal" information.
Just having goals isn’t good enough because often we may have
several actions which all satisfy our goal so we need some way of
working out the most efficient one.
A utility function maps each state after each action to a real number
representing how efficiently each action achieves the goal.
This is useful when we either have many actions all solving the same
goal
Utility-based Reflex Agents
Formulate problem:
states: various cities,
actions: drive between cities.
Initial state: The initial state that the agent knows itself in
Operator: The set of possible actions available to the agent. The term
operator is used to denote the description of an action in terms of
which state will be reached by carrying out the action in particular
State Space: State space is the set of all states reachable from the
initial state by any sequence of actions
Well Defined Problems and Solutions
Path: A Path in the state space is simply any sequence of actions
leading from one state to another
Goal Test: which the agent can apply to a single state description to
determine if it is a goal state
Performance Measure:
Consists of a 3x3 board with eight numbered tiles and a blank space.
A tile adjacent to the blank space can slide into the space.
Well Defined Problems and Solutions
Examples: The 8-Puzzle Formulation
States: a state description specifies the location of each of the eight tiles in one of
the nine squares. For efficiency, it is useful to include the location of the blank
Path cost: each step costs 1, so the path cost is just the length of the path.
Well Defined Problems and Solutions
Examples: The 8-Queen Formulation
The goal of the 8-queens problem is to place eight queens on a chessboard such
that no queen attacks any other. (A queen attacks any piece in the same row,
column or diagonal.)
Search Strategy:
The Leaf nodes of the tree correspond to states that do not have
successors in the tree, either because
1. They have not been expanded yet
2. Or they are expanded, but generated the empty set
Corresponding
2. Then all the nodes generated by root node are expanded next
and then their successors and so on
4. If there are several solutions, BFS always find the shallowest goal
state first
The root of the search tree generates b nodes at the first level, each of
which generates b more nodes, for a total of b² at the second level.
Now suppose that the solution for this problem has a path length of d.
³
Breadth-First Search
1. BFS finds the shallowest goal state, but it may not be the least-
cost solution
For very large input size, If DFS made wrong choice then it
is not complete neither optimal
DFS
S
G
Depth-First Search(DFS)
Adaptive websites,
Bioinformatics,
Computer vision,
Game playing,
Internet fraud detection,
Information retrieval,
Medical diagnosis,
Economics,
Natural language processing,
Online advertising,
Robotics,
Search engines,
………..…………….
Machine Learning
There are three types of Learning:
1. Supervised learning: The computer is presented with example inputs and their
desired outputs, and the goal is to learn a general rule or function
that maps inputs to outputs.
1. Classification: Inputs are divided into two or more classes, and the learner must
produce a model that assigns unseen inputs to these classes. This is typically
tackled in a supervised way e.g. spam filtering is an example of classification,
where the inputs are email (or other) messages and the classes are "spam" and
"not spam".
2. Regression: The outputs are continuous rather than discrete, e.g temperature,
currency rates, stock rates etc. Supervised learning
Training Set
Gender height (feet) weight (lbs) foot size(inches)
male 6 180 12
male 5.92 190 11
male 5.58 170 12
male 5.92 165 10
female 5 100 6
female 5.5 150 8
female 5.42 130 7
female 5.75 150 9
Machine Learning
Example: Supervised Learning based Classification using Naïve Bayes
Classifier:
In simple words
Machine Learning
Example: Supervised Learning based Classification using Naïve Bayes
Classifier:
Training:
Gender mean variance mean variance mean (foot variance
(height) (height) (weight) (weight) size) (foot size)
Male 5.855 0.0350 176.25 1.2292e+02 11.25 9.1667e-01
Female 5.4175 0.0972 132.5 5.5833e+02 7.5 1.6667e+00
Machine Learning
Example: Supervised Learning based Classification using Naïve Bayes
Classifier:
Testing:
Testing:
Male Posterior
Machine Learning
Example: Supervised Learning based Classification using Naïve Bayes
Classifier:
Testing:
Female Posterior
Machine Learning
Example: Supervised Learning based Classification using Naïve Bayes
Classifier:
Result:
Source : https://en.wikipedia.org/wiki/Naive_Bayes_classifier