0% found this document useful (0 votes)
9 views103 pages

AI Unit 1-1

The document discusses the fundamentals of Artificial Intelligence (AI), including its definition, types, advantages, and disadvantages. It highlights various applications of AI across different fields such as healthcare, finance, and transportation, while also addressing the structure and functioning of AI agents. Additionally, it covers problem-solving techniques in AI and the importance of learning agents in adapting to new environments.

Uploaded by

Dr M T L Gayatri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views103 pages

AI Unit 1-1

The document discusses the fundamentals of Artificial Intelligence (AI), including its definition, types, advantages, and disadvantages. It highlights various applications of AI across different fields such as healthcare, finance, and transportation, while also addressing the structure and functioning of AI agents. Additionally, it covers problem-solving techniques in AI and the importance of learning agents in adapting to new environments.

Uploaded by

Dr M T L Gayatri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 103

ARTIFICIAL INTELLIGENCE

LECTURE-01

Dr. M T L Gayatri
Associate Professor
EEE Department
Artificial Intelligence
• In today's world, technology is growing very fast, and we are getting in touch with
different new technologies day by day.
• Here, one of the booming technologies of computer science is Artificial
Intelligence which is ready to create a new revolution in the world by making
intelligent machines.
• The Artificial Intelligence is now all around us. It is currently working with a
variety of subfields, ranging from general to specific, such as self-driving cars,
playing chess, proving theorems, playing music, Painting, etc.
• AI is one of the fascinating and universal fields of Computer science which has a
great scope in future. AI holds a tendency to cause a machine to work as a
human.
Artificial Intelligence
• Artificial Intelligence is composed of two words Artificial and Intelligence, where Artificial

defines "man-made," and intelligence defines "thinking power", hence AI means "a man-made

thinking power.“

• So, we can define AI as:

"It is a branch of computer science by which we can create intelligent machines which can

behave like a human, think like humans, and able to make decisions."

• Artificial Intelligence exists when a machine can have human based skills such as learning,

reasoning, and solving problems

• With Artificial Intelligence you do not need to preprogram a machine to do some

work, despite that you can create a machine with programmed algorithms which can

work with own intelligence, and that is the awesomeness of AI .


WHAT ARE THE FOUR TYPES OF ARTIFICIAL INTELLIGENCE?

• Reactive Machines
• Limited Memory
• Theory of Mind
• Self-Awareness
Philosophy of AI
Advantages of Artificial Intelligence
• High Accuracy with less errors: AI machines or systems are prone to less

errors and high accuracy as it takes decisions as per pre-experience or

information.

• High-Speed: AI systems can be of very high-speed and fast-decision

making, because of that AI systems can beat a chess champion in the

Chess game.

• High reliability: AI machines are highly reliable and can perform the same

action multiple times with high accuracy.


Advantages of Artificial Intelligence
• Useful for risky areas: AI machines can be helpful in situations such as

defusing a bomb, exploring the ocean floor, where to employ a human can be

risky.

• Digital Assistant: AI can be very useful to provide digital assistant to the users

such as AI technology is currently used by various E-commerce websites to

show the products as per customer requirement.

• Useful as a public utility: AI can be very useful for public utilities such as a self-

driving car which can make our journey safer and hassle-free, facial recognition

for security purpose, Natural language processing to communicate with the

human in human-language, etc.


Disadvantages of Artificial Intelligence
• High Cost: The hardware and software requirement of AI is very costly as it

requires lots of maintenance to meet current world requirements.

• Can't think out of the box: Even we are making smarter machines with AI,

but still they cannot work out of the box, as the robot will only do that

work for which they are trained, or programmed.

• No feelings and emotions: AI machines can be an outstanding performer,

but still it does not have the feeling so it cannot make any kind of

emotional attachment with human, and may sometime be harmful for

users if the proper care is not taken.


Disadvantages of Artificial Intelligence

• Increase dependency on machines: With the increment of technology,

people are getting more dependent on devices and hence they are losing

their mental capabilities.

• No Original Creativity: As humans are so creative and can imagine some

new ideas but still AI machines cannot beat this power of human

intelligence and cannot be creative and imaginative.


Typical Problems to which AI methods are
applied: (Applications of AI)
Application of AI
Application of AI
 AI in Astronomy Artificial Intelligence can be very useful to solve complex universe problems. AI

technology can be helpful for understanding the universe such as how it works, origin, etc.

 AI in Healthcare In the last, five to ten years, AI becoming more advantageous for the healthcare industry

and going to have a significant impact on this industry.

 Healthcare Industries are applying AI to make a better and faster diagnosis than humans. AI can help

doctors with diagnoses and can inform when patients are worsening so that medical help can reach to the

patient before hospitalization.

 AI in Gaming AI can be used for gaming purpose. The AI machines can play strategic games like chess,

where the machine needs to think of a large number of possible places.

 AI in Finance AI and finance industries are the best matches for each other. The finance industry is

implementing automation, Chabot, adaptive intelligence, algorithm trading, and machine learning into

financial processes.
Application of AI
 AI in Data Security The security of data is crucial for every company and cyber-attacks are growing very

rapidly in the digital world. AI can be used to make your data more safe and secure. Some examples such as

AEG bot, AI2 Platform, are used to determine software bug and cyber-attacks in a better way.

 AI in Social Media Social Media sites such as Facebook, Twitter, and Snapchat contain billions of user

profiles, which need to be stored and managed in a very efficient way. AI can organize and manage massive

amounts of data. AI can analyze lots of data to identify the latest trends, hashtag, and requirement of different

users.

 AI in Travel & Transport AI is becoming highly demanding for travel industries. AI is capable of doing

various travel related works such as from making travel arrangement to suggesting the hotels, flights, and best

routes to the customers. Travel industries are using AI-powered chat bots which can make human-like

interaction with customers for better and fast response.


Application of AI
• AI in Automotive Industry Some Automotive industries are using AI to provide virtual
assistant to their user for better performance. Such as Tesla has introduced TeslaBot, an

intelligent virtual assistant. Various Industries are currently working for developing self-driven

cars which can make your journey more safe and secure.

• AI in Robotics Artificial Intelligence has a remarkable role in Robotics. Usually, general

robots are programmed such that they can perform some repetitive task, but with the help of

AI, we can create intelligent robots which can perform tasks with their own experiences

without pre-programmed. Humanoid Robots are best examples for AI in robotics, recently the

intelligent Humanoid robot named as Erica and Sophia has been developed which can talk and

behave like humans.


Application of AI
• AI in Entertainment We are currently using some AI based applications in our daily life with some

entertainment services such as Netflix or Amazon. With the help of ML/AI algorithms, these services show

the recommendations for programs or shows.

• AI in Agriculture Agriculture is an area which requires various resources, labor, money, and time for best

result. Now a day's agriculture is becoming digital, and AI is emerging in this field. Agriculture is applying

AI as agriculture robotics, solid and crop monitoring, predictive analysis. AI in agriculture can be very

helpful for farmers.

• AI in E-commerce AI is providing a competitive edge to the e-commerce industry, and it is becoming

more demanding in the e-commerce business. AI is helping shoppers to discover associated products with

recommended size, color, or even brand.

• AI in education: AI can automate grading so that the tutor can have more time to teach. AI chatbot can

communicate with students as a teaching assistant. AI in the future can be work as a personal virtual tutor

for students, which will be accessible easily at any time and any place.
What is AI?-Various Definitions of AI-
History

Views of AI fall into four categories:


Thinking humanly Thinking rationally
Acting humanly Acting rationally

16
Acting humanly: Turing Test
• Turing (1950) "Computing machinery and intelligence":
• "Can machines think?"  "Can machines behave
intelligently?"
• Operational test for intelligent behavior: the Imitation
Game
• A Computer passes the test if a human interrogator,
after posing some written questions, cannot tell
whether the written responses come from a person or
from a computer.

17
AI Agent
AGENT
• An agent can be anything that perceive its environment through sensors
and act upon that environment through actuators. An Agent runs in the
cycle of perceiving, thinking, and acting. An agent can be:
 Human-Agent: A human agent has eyes, ears, and other organs which
work for sensors and hand, legs, vocal tract work for actuators.
 Robotic Agent: A robotic agent can have cameras, infrared range
finder, NLP for sensors and various motors for actuators.
 Software Agent: Software agent can have keystrokes, file contents as
sensory input and act on those inputs and display output on the screen.
• Hence the world around us is full of agents such as thermostat, cell phone,
camera, and even we are also agents.
AGENT
• Sensor: Sensor is a device which detects the change in the environment
and sends the information to other electronic devices. An agent observes its
environment through sensors.
• Actuators: Actuators are the component of machines that converts energy
into motion. The actuators are only responsible for moving and controlling
a system. An actuator can be an electric motor, gears, rails, etc.
• Effectors: Effectors are the devices which affect the environment.
Effectors can be legs, wheels, arms, fingers, wings, fins, and display
screen.
INTELLIGENT AGENTS
• AGENTS AND ENVIRONMENTS
• An Agent is anything that can be ENVIRONMENT viewed
as perceiving its environment through sensors and
SENSOR acting upon that environment through
actuators.

24
• A Human Agent has eyes, ears, and other organs for
sensors and hands, legs, vocal tract, and so on for
actuators.
• A Robotic Agent might have cameras and infrared range
finders for sensors and various motors for actuators.
• Agent’s behavior is described by the agent function that
maps any given percept (interpret) sequence to an action

25
Intelligent Agent
• An intelligent agent is an autonomous entity which act upon an environment using sensors and

actuators for achieving goals. An intelligent agent may learn from the environment to achieve

their goals. A thermostat is an example of an intelligent agent.

• Following are the main four rules for an AI agent:

• Rule 1: An AI agent must have the ability to perceive the environment.

• Rule 2: The observation must be used to make decisions.

• Rule 3: Decision should result in an action.

• Rule 4: The action taken by an AI agent must be a rational action.


• Tabulating the Agent Function describes any given
agent, construct this table by trying out all possible
percept sequences and recording which actions the
agent does in response.
• Table is an external characterization of the agent and
Internally, agent function for an artificial agent will be
implemented by an agent program.
• Agent function is an abstract mathematical description
• Ex: vacuum-cleaner Agent world shown in Figure 2.2.
This world is so simple that we can describe everything
that happens; world has just two locations: squares A
and B.

27
Figure 2.2 A vacuum-cleaner world with just two locations.

Figure 2.3 Partial tabulation of a simple agent function for the vacuum-cleaner world
shown in Figure 2.2. 28
Structure of an AI Agent
• The task of AI is to design an agent program which implements the
agent function. The structure of an intelligent agent is a combination of
architecture and agent program. It can be viewed as:
Agent = Architecture + Agent program
Following are the main three terms involved in the structure of an
AI agent:
• Architecture: Architecture is machinery that an AI agent executes on.
• Agent Function: Agent function is used to map a percept to an action.
• Agent program: Agent program is an implementation of agent
function. An agent program executes on the physical architecture to
produce function .
PEAS Representation
PEAS is a type of model on which an AI agent
works upon. When we define an AI agent or
rational agent, then we can group its
properties under PEAS representation model.
It is made up of four words:
• P: Performance measure
• E: Environment
• A: Actuators
• S: Sensors
PEAS for self-driving cars
Self-driving cars
Let's suppose a self-driving car then PEAS
representation will be:
– Performance: Safety, time, legal drive, comfort
– Environment: Roads, other vehicles, road signs
– Actuators: Steering, accelerator, brake, signal,
horn
– Sensors: Camera, GPS, speedometer, odometer,
accelerometer, sonar.
Example of Agents with their PEAS
representation
Learning agents
• Described agent programs with various methods for selecting
actions but not explained how the agent programs come into
being.
• Learning has another advantage: it allows the agent to operate in
initially unknown environments and to become more competent
than its initial knowledge alone might allow.
• A learning agent can be divided into four conceptual components,
as shown in Fig. 2.15.
• The most important distinction is between the learning element,
which is responsible for making improvements, and the
performance element, which is responsible for selecting external
actions.
• The performance element is considered to be the entire agent: it
takes in percepts and decides on actions.
39
Figure 2.15 A general learning agent.
The learning element uses feedback from the critic on how the agent is doing
and determines how the performance element should be modified to do
better in the future.
The design of the learning element depends very much on the design of the
performance element. 40
• Given an agent design, learning mechanisms can be constructed to
improve every part of the agent.
• Ex: A chess program could receive a percept indicating that it has
checkmated its opponent, but it needs a performance standard to
know that this is a good thing.
• The last component of the learning agent is the problem generator.
• The point is that if the performance element had its way, it would
keep doing the actions that are best, given what it knows.
• But if the agent is willing to explore a little and do some perhaps
suboptimal actions in the short run, it might discover much better
actions for the long run.
• The performance element consists of whatever collection of
knowledge and procedures the taxi has for selecting its driving
actions.
• Ex: After the taxi makes a quick left turn across three lanes of traffic,
the critic observes the shocking language used by other drivers.
41
• From this experience, the learning element is able to
formulate a rule saying this was a bad action, and the
performance element is modified by installation of the
new rule.
• The learning element can make changes to any of the
“knowledge” components shown in the agent diagrams.
• Ex: If the taxi exerts a certain braking pressure when
driving on a wet road, then it will soon find out how
much deceleration is actually achieved.
• The external performance standard must inform the
agent that the loss of tips is a negative contribution to
its overall performance; then the agent might be able to
learn that violent maneuvers do not contribute to its
own utility.
42
Problem Solving in AI
Problem Formulation
Problem solving-definition
Goal based agent/Problem Solving Agent
Goal formulation and Problem Formulation
Components of Formulating Problem
Initial state
Successor state
Goal Test and
Path cost
1. Initial state: {(2,1,6)(4,0,8), (7,5,3)}

2. Actions: Blank space can moe left, right, up, down.

3. Successor function: If we apply down operator to start state, the resultant state has
5 and the blank position switch.
Result: (S,a) –(State, action)Action that result into a state that creates another state.
Ex: Blank space creates the same black space state with its move.

4. Goal test: {{1,2,3), (8,0,4),(7,6,5)}

5. Path cost: Each step costs 1, so the path cost is number of steps in the path.
Problem solving agents….
• problem-solving agent is one kind of goal-based agent.
• Problem-solving agents use atomic representations
• Goal-based agents that use more advanced factored or
structured representations are usually called planning agents
• General-purpose search algorithms that can be used to solve
these problems
• Uninformed search algorithms—algorithms that are given no
information about the problem other than its definition.
• some of these algorithms can solve any solvable problem, none
of them can do so efficiently.
• Informed search algorithms, on the other hand, can do quite
well given some guidance on where to look for solutions.
• More general case—where the agent’s future actions may vary
depending on future percepts.
• It uses the concepts of asymptotic complexity (that is, O()
notation) and NP-completeness. 54
A
ABC
BCDE
CDEFG
Example of BFS algorithm
Example of BFS algorithm

Result: ABDCFEG
Uninformed/Blind Search -
Depth-First Search

66 Dr. Tapas Kumar Introduction to Artificial Intelligence and


Uninformed/Blind Search -
Depth-First Search

67 Dr. Tapas Kumar Introduction to Artificial Intelligence and


Uninformed/Blind Search -
Depth-First Search

68 Dr. Tapas Kumar Introduction to Artificial Intelligence and


Uninformed/Blind Search -
Depth-First Search

69 Dr. Tapas Kumar Introduction to Artificial Intelligence and


Uninformed/Blind Search -
Depth-First Search

70 Dr. Tapas Kumar Introduction to Artificial Intelligence and


Uninformed/Blind Search -
Depth-First Search

71 Dr. Tapas Kumar Introduction to Artificial Intelligence and


Uninformed/Blind Search -
Depth-First Search

72 Dr. Tapas Kumar Introduction to Artificial Intelligence and


Uninformed/Blind Search -
Depth-First Search

73 Dr. Tapas Kumar Introduction to Artificial Intelligence and


Uninformed/Blind Search -
Depth-First Search

74 Dr. Tapas Kumar Introduction to Artificial Intelligence and


Uninformed/Blind Search -
Depth-First Search

75 Dr. Tapas Kumar Introduction to Artificial Intelligence and


Uninformed/Blind Search -
Depth-First Search

76 Dr. Tapas Kumar Introduction to Artificial Intelligence and


Uninformed/Blind Search -
Depth-First Search

77 Dr. Tapas Kumar Introduction to Artificial Intelligence and


Uninformed/Blind Search -
Depth-First Search

It can get stuck going down the wrong path.


Depth-first search should be avoided for search
trees with large or infinite maximum depths.

78 Dr. Tapas Kumar Introduction to Artificial Intelligence and


DFS (Depth First Search) algorithm

Step 1 -.
1.STACK: H
Step 2 -
1.Print: H
STACK: A
Step 3 -
2.Print: A
2.STACK: B, D
Step 4 -
3.Print: D
2.STACK: B, F
Step 5 -
3.Print: F
2.STACK: B
DFS (Depth First Search) algorithm
Step 6 -
1.Print: B
2.STACK: C
Step 7 -
3.Print: C
2.STACK: E, G
Step 8 -
3.Print: G
2.STACK: E
Step 9 -
3.Print: E
2.STACK:
Output: HADFBCGE
Satisfaction vs. Optimization
Goal Optimization
Satisfaction
reach the goal optimize(objective fn)
node Constraint Constraint
satisfaction Optimization

You can go back and forth between


the two problems typically
in the same complexity
class

© 6
Mausa
Local search and optimization
• Local search
– Keep track of single current state
– Move only to neighboring states
– Ignore paths

• Advantages:
– Use very little memory
– Can often find reasonable solutions in large or infinite (continuous)
state spaces.

• “Pure optimization” problems


– All states have an objective function
– Goal is to find state with max (or min) objective value
– Does not quite fit into path-cost/goal-state formulation
– Local search can do quite well on these problems.
7
Hill Climbing Algorithm
• Hill climbing algorithm is
a local search algorithm
which continuously
moves in the direction of
increasing
elevation/value to find
the peak of the mountain
or best solution to the
problem. It terminates
when it reaches a peak
value where no neighbor
has a higher value.
Features of Hill Climbing:
• Generate and Test variant: Hill Climbing is
the variant of Generate and Test method. The
Generate and Test method produce feedback
which helps to decide which direction to move
in the search space.
• Greedy approach: Hill-climbing algorithm
search moves in the direction which optimizes
the cost.
• No backtracking: It does not backtrack the
search space, as it does not remember the
previous states.
Hill-climbing (Greedy Local Search) max version
function HILL-CLIMBING( problem) return a state that is a local maximum
input: problem, a problem
local variables: current, a node.
neighbor, a node.

current  MAKE-NODE(INITIAL-STATE[problem])
loop do
neighbor  a highest valued successor of current
if VALUE [neighbor] ≤ VALUE[current] then return STATE[current]
current  neighbor

min version will reverse inequalities and look


for lowest valued successor
1
3
Hill-climbing search
• “a loop that continuously moves towards increasing value”
– terminates when a peak is reached
– Aka greedy local search
• Value can be either
– Objective function value
– Heuristic function value (minimized)

• Hill climbing does not look ahead of the immediate neighbors


• Can randomly choose among the set of best successors
– if multiple have the best value

• “climbing Mount Everest in a thick fog with amnesia”

1
4
“Landscape” of
search

Hill Climbing gets stuck in local


minima depending on?
1
5
Hill Climbing
Drawbacks
• Local
maxima

• Plateau
s

• Diagonal
ridges
1
7
Escaping Shoulders/local Optima
Enforced Hill Climbing
• Perform breadth first search from a local optima
– to find the next state with better h function

• Typically,
– prolonged periods of exhaustive search
– bridged by relatively quick periods of hill-climbing

• Middle ground b/w local and systematic search

© 2
Mausa 0
Hill-climbing: stochastic variations

• Stochastic hill-climbing
– Random selection among the uphill moves.
– The selection probability can vary with the steepness of
the uphill move.

• To avoid getting stuck in local minima


– Random-walk hill-climbing
– Random-restart hill-climbing
– Hill-climbing with both

2
1
Hill Climbing with random walk
When the state-space landscape has local minima, any search
that moves only in the greedy direction cannot be complete
Random walk, on the other hand, is asymptotically
complete

Idea: Put random walk into greedy hill-climbing


• At each step do one of the two
– Greedy: With prob p move to the neighbor with
largest value
– Random: With prob 1-p move to a random neighbor

2
2
Hill-climbing with random restarts
• If at first you don’t succeed, try, try again!
• Different variations
– For each restart: run until termination vs. run for a fixed time
– Run a fixed number of restarts or run indefinitely

• Analysis
– Say each search has probability p of success
• E.g., for 8-queens, p = 0.14 with no sideways moves

– Expected number of restarts?


– Expected number of steps taken?

• If you want to pick one local search algorithm, learn this one!!
2
3
Hill-climbing with both

• At each step do one of the three


– Greedy: move to the neighbor with largest
value
– Random Walk: move to a random neighbor
– Random Restart: Resample a new current
state

2
4
Simulated Annealing
• Simulated Annealing = physics inspired twist on
random walk
• Basic ideas:
– like hill-climbing identify the quality of the local improvements
– instead of picking the best move, pick one randomly
– say the change in objective function is 
– if  is positive, then move to that state
– otherwise:
• move to this state with probability proportional to 
• thus: worse moves (very large negative ) are executed less often
– however, there is always a chance of escaping from local maxima
– over time, make it less likely to accept locally bad moves
– (Can also make the size of the move random as well, i.e., allow “large” steps in
state space)
2
5
Simulated annealing
function SIMULATED-ANNEALING( problem, schedule) return a solution state
input: problem, a problem
schedule, a mapping from time to temperature
local variables: current, a node.
next, a node.
T, a “temperature” controlling the prob. of downward steps

current  MAKE-NODE(INITIAL-STATE[problem])
for t  1 to ∞ do
T  schedule[t]
if T = 0 then return current
next  a randomly selected successor of current
∆E  VALUE[next] - VALUE[current]
if ∆E > 0 then current  next
else current  next only with probability e∆E /T
2
6
Temperature T
• high T: probability of “locally bad” move is
higher
• low T: probability of “locally bad” move is
lower
• typically, T is decreased as the algorithm
runs longer
• i.e., there is a “temperature schedule”

2
7
Physical Interpretation of Simulated
Annealing
• A Physical Analogy:
• imagine letting a ball roll downhill on the function surface
– this is like hill-climbing (for minimization)
• now imagine shaking the surface, while the ball rolls,
gradually reducing the amount of shaking
– this is like simulated annealing

• Annealing = physical process of cooling a liquid or metal


until particles achieve a certain frozen crystal state
• simulated annealing:
– free variables are like particles
– seek “low energy” (high quality) configuration
– slowly reducing temp. T with particles moving around randomly
2
8
Simulated Annealing in Practice
– method proposed in 1983 by IBM researchers for
solving VLSI layout problems (Kirkpatrick et al,
Science, 220:671-680, 1983).
• theoretically will always find the global optimum

– Other applications: Traveling salesman, Graph


partitioning, Graph coloring, Scheduling, Facility
Layout, Image Processing, …

– useful for some problems, but can be very slow


• slowness comes about because T must be decreased
very gradually to retain optimality
2
9
Optimization of Continuous
Functions
• Discretization
– use hill-climbing

• Gradient descent
– make a move in the direction of the
gradient
• gradients: closed form or empirical

4
3

You might also like