20ECE506T –IoT Sensor
Nodes with AI
Unit-1
Introduction to Artificial Intelligence
AI Vs Human Intelligence
Artificial Intelligence Machine learning
Artificial intelligence is a technology which enables a machine
to simulate human behavior.
Machine learning is a subset of AI which allows a machine to
automatically learn from past data without programming
explicitly.
The goal of AI is to make a smart computer system like humans
to solve complex problems.
The goal of ML is to allow machines to learn from data so that
they can give accurate output.
In AI, we make intelligent systems to perform any task like a
human.
In ML, we teach machines with data to perform a particular task
and give an accurate result.
Machine learning and deep learning are the two main subsets of
AI.
Deep learning is a main subset of machine learning.
AI has a very wide range of scope. Machine learning has a limited scope
AI is working to create an intelligent system which can perform
various complex tasks.
Machine learning is working to create machines that can
perform only those specific tasks for which they are trained.
On the basis of capabilities, AI can be divided into three types,
which are, Weak AI, General AI, and Strong AI.
Machine learning can also be divided into mainly three types
that are Supervised learning, Unsupervised learning,
and Reinforcement learning.
It includes learning, reasoning, and self-correction It includes learning and self-correction when introduced with
new data.
History of Artificial Intelligence
Maturation of Artificial Intelligence (1943-1952)
1943: The first work which is now recognized as AI was done by Warren McCulloch and Walter pits in 1943. They proposed a model of artificial neurons.
1949: Donald Hebb demonstrated an updating rule for modifying the connection strength between neurons. His rule is now called Hebbian learning.
1950: The Alan Turing who was an English mathematician and pioneered Machine learning in 1950. Alan Turing publishes "Computing Machinery and
Intelligence" in which he proposed a test. The test can check the machine's ability to exhibit intelligent behavior equivalent to human intelligence, called a Turing
test.
The birth of Artificial Intelligence (1952-1956)
1955: An Allen Newell and Herbert A. Simon created the "first artificial intelligence program"Which was named as "Logic Theorist". This program had proved 38 of
52 Mathematics theorems, and find new and more elegant proofs for some theorems.
1956: The word "Artificial Intelligence" first adopted by American Computer scientist John McCarthy at the Dartmouth Conference. For the first time, AI coined as
an academic field.
The golden years-Early enthusiasm (1956-1974)
1966: The researchers emphasized developing algorithms which can solve mathematical problems. Joseph Weizenbaum created the first chatbot in 1966, which was
named as ELIZA.
1972: The first intelligent humanoid robot was built in Japan which was named as WABOT-1
The first AI winter (1974-1980)
• The duration between years 1974 to 1980 was the first AI winter duration. AI winter refers to the time period where computer scientist dealt with a severe shortage
of funding from government for AI researches.
• During AI winters, an interest of publicity on artificial intelligence was decreased.
A boom of AI (1980-1987)
1980: After AI winter duration, AI came back with "Expert System". Expert systems were programmed that emulate the decision-making ability of a human expert.
In the Year 1980, the first national conference of the American Association of Artificial Intelligence was held at Stanford University.
The second AI winter (1987-1993)
The duration between the years 1987 to 1993 was the second AI Winter duration.
Again Investors and government stopped in funding for AI research as due to high cost but not efficient result. The expert system such as XCON was very cost
effective.
The emergence of intelligent agents (1993-2011)
1997: In the year 1997, IBM Deep Blue beats world chess champion, Gary Kasparov, and became the first computer to beat a world chess champion.
2002: for the first time, AI entered the home in the form of Roomba, a vacuum cleaner.
2006: AI came in the Business world till the year 2006. Companies like Facebook, Twitter, and Netflix also started using AI.
Deep learning, big data and artificial general intelligence (2011-present)
2011: In the year 2011, IBM's Watson won jeopardy, a quiz show, where it had to solve the complex questions as well as riddles. Watson had proved that it could
understand natural language and can solve tricky questions quickly.
2012: Google has launched an Android app feature "Google now", which was able to provide information to the user as a prediction.
2014: In the year 2014, Chatbot "Eugene Goostman" won a competition in the infamous "Turing test."
2018: The "Project Debater" from IBM debated on complex topics with two master debaters and also performed extremely well.
Google has demonstrated an AI program "Duplex" which was a virtual assistant and which had taken hairdresser appointment on call, and lady on other side didn't
notice that she was talking with the machine.
Advantages and Disadvantages
Advantages of Artificial Intelligence
• AI drives down the time taken to perform a task. It enables multi-tasking and eases the workload for existing resources.
• AI enables the execution of hitherto complex tasks without significant cost outlays.
• AI operates 24x7 without interruption or breaks and has no downtime
• AI augments the capabilities of differently abled individuals
• AI has mass market potential, it can be deployed across industries.
• AI facilitates decision-making by making the process faster and smarter.
Disadvantages of Artificial Intelligence
• High Costs of Creation
• Making Humans Lazy
• Unemployment
• No Emotions
• Lacking Out of Box Thinking
Turing Test
• Turing Test was introduced by Turing in his 1950 paper, "Computing Machinery and Intelligence
• The Turing test is based on a party game "Imitation game," with some modifications. This game involves three players in which one player is
Computer, another player is human responder, and the third player is a human Interrogator, who is isolated from other two players and his job is
to find that which player is machine among two of them.
Example:
• Consider, Player A is a computer, Player B is human, and Player C is an interrogator. Interrogator is aware that one of them is machine, but he
needs to identify this on the basis of questions and their responses.
• The conversation between all players is via keyboard and screen so the result would not depend on the machine's ability to convert words as
speech.
• The test result does not depend on each correct answer, but only how closely its responses like a human answer. The computer is permitted to do
everything possible to force a wrong identification by the interrogator.
• The questions and answers can be like:
• Interrogator: Are you a computer?
• PlayerA (Computer): No
• Interrogator: Multiply two large numbers such as (256896489*456725896)
• Player A: Long pause and give the wrong answer.
• In this game, if an interrogator would not be able to identify which is a machine and which is human, then the computer passes the test
successfully, and the machine is said to be intelligent and can think like a human.
• "In 1991, the New York businessman Hugh Loebner announces the prize competition, offering a $100,000 prize for the first computer to pass
the Turing test. However, no AI program to till date, come close to passing an undiluted Turing test"
Features required for a machine to pass the Turing test
• Natural language processing: NLP is required to communicate with Interrogator in general human language like English.
• Knowledge representation: To store and retrieve information during the test.
• Automated reasoning: To use the previously stored information for answering the questions.
• Machine learning: To adapt new changes and can detect generalized patterns.
• Vision (For total Turing test): To recognize the interrogator actions and other objects during a test.
• Motor Control (For total Turing test): To act upon objects if requested.
Physical Symbol Systems
• A physical symbol system (also called a formal system) takes physical patterns (symbols), combining them into structures
(expressions) and manipulating them (using processes) to produce new expressions.
Physical Patterns
(Symbols))Ph
Structures
(Expressions)
New
Expressions
An intelligent agent can be seen as manipulating symbols to produce action. Many of these symbols are used to refer to things
in the world. Other symbols may be useful concepts that may or may not have external meaning. Yet other symbols may refer
to internal states of the agent
Example: A delivery robot can model the environment at a high level of abstraction in terms of rooms, corridors, doors, and obstacles, ignoring
distances, its size, the steering angles needed, the slippage of the wheels, the weight of parcels, the details of obstacles, the political situation in
Canada, and virtually everything else. The robot could model the environment at lower levels of abstraction by taking some of these details into
account. Some of these details may be irrelevant for the successful implementation of the robot, but some may be crucial for the robot to succeed.
For example, in some situations the size of the robot and the steering angles may be crucial for not getting stuck around a particular corner. In other
situations, if the robot stays close to the center of the corridor, it may not need to model its width or the steering angles.
Choosing an appropriate level of abstraction is difficult because
• a high-level description is easier for a human to specify and understand.
• a low-level description can be more accurate and more predictive. Often high-level descriptions abstract away details that may be important for
actually solving the problem.
• the lower the level, the more difficult it is to reason with. This is because a solution at a lower level of detail involves more steps and many more
possible courses of action exist from which to choose.
• you may not know the information needed for a low-level description. For example, the delivery robot may not know what obstacles it will
encounter or how slippery the floor will be at the time that it must decide what to do.
Scope of Symbolic AI
• In the Symbolic approach, AI applications process strings of characters that represent real-world entities or concepts. Symbols can be arranged
in structures such as lists, hierarchies, or networks and these structures show how symbols relate to each other. An early body of work in AI is
purely focused on symbolic approaches with Symbolists pegged as the “prime movers of the field”
Applications of Symbolic AI
• A Symbolic approach offer good performances in reasoning, is able to give explanations and can manipulate complex data structures, but it has
generally serious difficulties in anchoring their symbols in the perceptive world.
• the Symbolic approach works best on well-defined problems, wherein the information is presented and the system has to crunch systematically
GOFAI
• Good-Old-Fashioned Artificial Intelligence (GOFAI) is more like a euphemism for Symbolic AI is characterized by an exclusive focus on
symbolic reasoning and logic. However, the approach soon lost fizzle since the researchers leveraging the GOFAI approach were tackling the
“Strong AI” problem, the problem of constructing autonomous intelligent software as intelligent as a human.
• The GOFAI approach works best with static problems and is not a natural fit for real-time dynamic issues. It focuses on a narrow definition of
intelligence as abstract reasoning, while artificial neural networks focus on the ability to recognize pattern. For example, NLP systems that use
grammars to parse language are based on Symbolic AI systems.
Scope of Agents
Types of AI Agents
Agents can be grouped into five classes based on their degree of perceived intelligence and capability. All these agents can improve their performance
and generate better action over the time. These are given below:
• Simple Reflex Agent
• Model-based reflex agent
• Goal-based agents
• Utility-based agent
• Learning agent
Simple Reflex agent:
• The Simple reflex agents are the simplest agents. These agents take decisions on the basis of the current percepts and ignore the rest of the percept
history.
• These agents only succeed in the fully observable environment.
• The Simple reflex agent does not consider any part of percepts history during their decision and action process.
• The Simple reflex agent works on Condition-action rule, which means it maps the current state to action. Such as a Room Cleaner agent, it works
only if there is dirt in the room.
• Problems for the simple reflex agent design approach:
• They have very limited intelligence
• They do not have knowledge of non-perceptual parts of the current state
• Mostly too big to generate and to store.
Model-based reflex agent
The Model-based agent can work in a partially observable environment, and track the situation.
• A model-based agent has two important factors:
• Model: It is knowledge about "how things happen in the world," so it is called a Model-based agent.
• Internal State: It is a representation of the current state based on percept history.
• These agents have the model, "which is knowledge of the world" and based on the model they perform actions.
• Updating the agent state requires information about:
• How the world evolves
• How the agent's action affects the world.
Goal-based agents
• The knowledge of the current state environment is not always sufficient to decide for an agent to what to do.
• The agent needs to know its goal which describes desirable situations.
• Goal-based agents expand the capabilities of the model-based agent by having the "goal" information.
• They choose an action, so that they can achieve the goal.
• These agents may have to consider a long sequence of possible actions before deciding whether the goal is achieved or not.
• Such considerations of different scenario are called searching and planning, which makes an agent proactive.
Utility-based agents
• These agents are similar to the goal-based agent but provide an extra component of utility measurement which makes them different by
providing a measure of success at a given state.
• Utility-based agent act based not only goals but also the best way to achieve the goal.
• The Utility-based agent is useful when there are multiple possible alternatives, and an agent has to choose in order to perform the best action.
• The utility function maps each state to a real number to check how efficiently each action achieves the goals.
Learning Agents
• A learning agent in AI is the type of agent which can learn from its past experiences, or it has learning capabilities.
• It starts to act with basic knowledge and then able to act and adapt automatically through learning.
• A learning agent has mainly four conceptual components, which are:
• Learning element: It is responsible for making improvements by learning from environment
• Critic: Learning element takes feedback from critic which describes that how well the agent is doing with respect to a fixed
performance standard.
• Performance element: It is responsible for selecting external action
• Problem generator: This component is responsible for suggesting actions that will lead to new and informative experiences.
• Hence, learning agents are able to learn, analyze performance, and look for new ways to improve the performance.
Utility-based agents Learning Agents
• In Artificial Intelligence, Search techniques are universal problem-solving methods. Rational agents or Problem-solving agents in AI mostly used these
search strategies or algorithms to solve a specific problem and provide the best result. Problem-solving agents are the goal-based agents and use atomic
representation.
Search Algorithm Terminologies:
• Search: Searching is a step by step procedure to solve a search-problem in a given search space. A search problem can have three main factors:
• Search Space: Search space represents a set of possible solutions, which a system may have.
• Start State: It is a state from where agent begins the search.
• Goal test: It is a function which observe the current state and returns whether the goal state is achieved or not.
• Search tree: A tree representation of search problem is called Search tree. The root of the search tree is the root node which is corresponding to the initial
state.
• Actions: It gives the description of all the available actions to the agent.
• Transition model: A description of what each action do, can be represented as a transition model.
• Path Cost: It is a function which assigns a numeric cost to each path.
• Solution: It is an action sequence which leads from the start node to the goal node.
• Optimal Solution: If a solution has the lowest cost among all solutions.
Types of search algorithms
Uninformed/Blind Search:
• The uninformed search does not contain any domain knowledge such as closeness, the location of the goal. It operates in a brute-force way as it
only includes information about how to traverse the tree and how to identify leaf and goal nodes. Uninformed search applies a way in which
search tree is searched without any information about the search space like initial state operators and test for the goal, so it is also called blind
search. It examines each node of the tree until it achieves the goal node.
It can be divided into five main types:
• Breadth-first search
• Uniform cost search
• Depth-first search
• Iterative deepening depth-first search
• Bidirectional Search
Informed Search
• Informed search algorithms use domain knowledge. In an informed search, problem information is available which can guide the search.
• Informed search strategies can find a solution more efficiently than an uninformed search strategy. Informed search is also called a Heuristic
search.
• A heuristic is a way which might not always be guaranteed for best solutions but guaranteed to find a good solution in reasonable time.
• Informed search can solve much complex problem which could not be solved in another way.
• An example of informed search algorithms is a traveling salesman problem.
Greedy Search, A* Search
Depth-first Search
• Depth-first search is a recursive algorithm for traversing a tree or graph data structure.
• It is called the depth-first search because it starts from the root node and follows each path to its greatest depth node before moving to the next
path.
• DFS uses a stack data structure for its implementation.
• The process of the DFS algorithm is similar to the BFS algorithm.
Example:
• In the below search tree, we have shown the flow of depth-first search, and it will follow the order as:
• Root node--->Left node ----> right node.
• It will start searching from root node S, and traverse A, then B, then D and E, after traversing E, it will backtrack the tree as E has no other
successor and still goal node is not found. After backtracking it will traverse node C and then G, and here it will terminate as it found goal node.
• Completeness: DFS search algorithm is complete within finite state space as it will expand every node within a limited search tree.
• Time Complexity: Time complexity of DFS will be equivalent to the node traversed by the algorithm. It is given by:
• T(n)= 1+ n2
+ n3
+.........+ nm
=O(nm
)
• Where, m= maximum depth of any node and this can be much larger than d (Shallowest solution depth)
• Space Complexity: DFS algorithm needs to store only single path from the root node, hence space complexity of DFS is equivalent to the size
of the fringe set, which is O(bm).
• Optimal: DFS search algorithm is non-optimal, as it may generate a large number of steps or high cost to reach to the goal node.
Advantage:
• DFS requires very less memory as it only needs to store a stack of the nodes on the path from root node to the current node.
• It takes less time to reach to the goal node than BFS algorithm (if it traverses in the right path).
Disadvantage:
• There is the possibility that many states keep re-occurring, and there is no guarantee of finding the solution.
• DFS algorithm goes for deep down searching and sometime it may go to the infinite loop.
Heuristic search
• So far we have talked about the uninformed search algorithms which looked through search space for all possible solutions of the problem without having
any additional knowledge about search space. But informed search algorithm contains an array of knowledge such as how far we are from the goal, path
cost, how to reach to goal node, etc. This knowledge help agents to explore less to the search space and find more efficiently the goal node.
• The informed search algorithm is more useful for large search space. Informed search algorithm uses the idea of heuristic, so it is also called Heuristic
search.
• Heuristics function: Heuristic is a function which is used in Informed Search, and it finds the most promising path. It takes the current state of the agent as
its input and produces the estimation of how close agent is from the goal. The heuristic method, however, might not always give the best solution, but it
guaranteed to find a good solution in reasonable time. Heuristic function estimates how close a state is to the goal. It is represented by h(n), and it calculates
the cost of an optimal path between the pair of states. The value of the heuristic function is always positive.
Admissibility of the heuristic function is given as:
h(n) <= h*(n)
• Here h(n) is heuristic cost, and h*(n) is the estimated cost. Hence heuristic cost should be less than or equal to the estimated cost.
Pure Heuristic Search
• Pure heuristic search is the simplest form of heuristic search algorithms. It expands nodes based on their heuristic value h(n). It maintains two lists, OPEN
and CLOSED list. In the CLOSED list, it places those nodes which have already expanded and in the OPEN list, it places nodes which have yet not been
expanded.
• On each iteration, each node n with the lowest heuristic value is expanded and generates all its successors and n is placed to the closed list. The algorithm
continues unit a goal state is found.
• In the informed search we will discuss two main algorithms which are given below:
• Best First Search Algorithm(Greedy search)
• A* Search Algorithm
Best-first Search Algorithm (Greedy Search)
Greedy best-first search algorithm always selects the path which appears best at that moment. It is the combination of depth-first search
and breadth-first search algorithms. It uses the heuristic function and search. Best-first search allows us to take the advantages of both algorithms.
With the help of best-first search, at each step, we can choose the most promising node. In the best first search algorithm, we expand the node
which is closest to the goal node and the closest cost is estimated by heuristic function,
f(n)= g(n)
Were, h(n)= estimated cost from node n to the goal.
The greedy best first algorithm is implemented by the priority queue.
Best first search algorithm:
Step 1: Place the starting node into the OPEN list.
Step 2: If the OPEN list is empty, Stop and return failure.
Step 3: Remove the node n, from the OPEN list which has the lowest value of h(n), and places it in the CLOSED list.
Step 4: Expand the node n, and generate the successors of node n.
Step 5: Check each successor of node n, and find whether any node is a goal node or not. If any successor node is goal node, then return success
and terminate the search, else proceed to Step 6.
Step 6: For each successor node, algorithm checks for evaluation function f(n), and then check if the node has been in either OPEN or CLOSED
list. If the node has not been in both list, then add it to the OPEN list.
Step 7: Return to Step 2.
Example:
• Consider the below search problem, and we will traverse it using greedy best-first search. At each iteration, each node is expanded using evaluation
function f(n)=h(n) , which is given in the below table.
In this search example, we are using two lists which are OPEN and CLOSED Lists. Following are the iteration for traversing the above example.
Expand the nodes of S and put in the CLOSED list
Initialization: Open [A, B], Closed [S]
Iteration 1: Open [A], Closed [S, B]
Iteration 2: Open [E, F, A], Closed [S, B]
: Open [E, A], Closed [S, B, F]
Iteration 3: Open [I, G, E, A], Closed [S, B, F]
: Open [I, E, A], Closed [S, B, F, G]
Hence the final solution path will be: S----> B----->F----> G
• Time Complexity: The worst case time complexity of Greedy best first search is O(bm
).
• Space Complexity: The worst case space complexity of Greedy best first search is O(bm
). Where, m is the maximum depth of the search
space.
• Complete: Greedy best-first search is also incomplete, even if the given state space is finite.
• Optimal: Greedy best first search algorithm is not optimal.
Advantages:
• Best first search can switch between BFS and DFS by gaining the advantages of both the algorithms.
• This algorithm is more efficient than BFS and DFS algorithms.
Disadvantages:
• It can behave as an unguided depth-first search in the worst case scenario.
• It can get stuck in a loop as DFS.
• This algorithm is not optimal.
A* Search Algorithm
• A* search is the most commonly known form of best-first search. It uses heuristic function h(n), and cost to reach the node n from the
start state g(n). It has combined features of UCS and greedy best-first search, by which it solve the problem efficiently. A* search
algorithm finds the shortest path through the search space using the heuristic function. This search algorithm expands less search tree
and provides optimal result faster. A* algorithm is similar to UCS except that it uses g(n)+h(n) instead of g(n).
• In A* search algorithm, we use search heuristic as well as the cost to reach the node. Hence we can combine both costs as following,
and this sum is called as a fitness number.
Algorithm of A* search:
Step1: Place the starting node in the OPEN list.
Step 2: Check if the OPEN list is empty or not, if the list is empty then return failure and stops.
Step 3: Select the node from the OPEN list which has the smallest value of evaluation function (g+h), if node n is goal node then return
success and stop, otherwise
Step 4: Expand node n and generate all of its successors, and put n into the closed list. For each successor n', check whether n' is already
in the OPEN or CLOSED list, if not then compute evaluation function for n' and place into Open list.
Step 5: Else if node n' is already in OPEN and CLOSED, then it should be attached to the back pointer which reflects the lowest g(n')
value.
Step 6: Return to Step 2.
Example:
In this example, we will traverse the given graph using the A* algorithm. The heuristic value of all states is given in the below table so we will
calculate the f(n) of each state using the formula f(n)= g(n) + h(n), where g(n) is the cost to reach any node from start state.
• Here we will use OPEN and CLOSED list.
Solution:
• Initialization: {(S, 5)}
• Iteration1: {(S--> A, 4), (S-->G, 10)}
• Iteration2: {(S--> A-->C, 4), (S--> A-->B, 7), (S-->G, 10)}
• Iteration3: {(S--> A-->C--->G, 6), (S--> A-->C--->D, 11), (S--> A-->B, 7), (S-->G, 10)}
• Iteration 4 will give the final result, as S--->A--->C--->G it provides the optimal path with cost 6.
Points to remember:
• A* algorithm returns the path which occurred first, and it does not search for all remaining paths.
• The efficiency of A* algorithm depends on the quality of heuristic.
• A* algorithm expands all nodes which satisfy the condition f(n)
Complete: A* algorithm is complete as long as:
• Branching factor is finite.
• Cost at every action is fixed.
• Optimal: A* search algorithm is optimal if it follows below two conditions:
• Admissible: the first condition requires for optimality is that h(n) should be an admissible heuristic for A* tree search. An admissible heuristic
is optimistic in nature.
• Consistency: Second required condition is consistency for only A* graph-search.
• If the heuristic function is admissible, then A* tree search will always find the least cost path.
• Time Complexity: The time complexity of A* search algorithm depends on heuristic function, and the number of nodes expanded is
exponential to the depth of solution d. So the time complexity is O(b^d), where b is the branching factor.
• Space Complexity: The space complexity of A* search algorithm is O(b^d)
Advantages:
• A* search algorithm is the best algorithm than other search algorithms.
• A* search algorithm is optimal and complete.
• This algorithm can solve very complex problems.
Disadvantages:
• It does not always produce the shortest path as it mostly based on heuristics and approximation.
• A* search algorithm has some complexity issues.
• The main drawback of A* is memory requirement as it keeps all generated nodes in the memory, so it is not practical for various large-scale
problems.
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.
• Hill climbing algorithm is a technique which is used for optimizing the mathematical problems. One of the widely discussed examples of Hill
climbing algorithm is Traveling-salesman Problem in which we need to minimize the distance traveled by the salesman.
• It is also called greedy local search as it only looks to its good immediate neighbor state and not beyond that.
• A node of hill climbing algorithm has two components which are state and value.
• Hill Climbing is mostly used when a good heuristic is available.
• In this algorithm, we don't need to maintain and handle the search tree or graph as it only keeps a single current state.
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.
State-space Diagram for Hill Climbing
• The state-space landscape is a graphical representation of the hill-climbing algorithm which is showing a graph between various states of algorithm
and Objective function/Cost.
• On Y-axis we have taken the function which can be an objective function or cost function, and state-space on the x-axis. If the function on Y-axis is
cost then, the goal of search is to find the global minimum and local minimum. If the function of Y-axis is Objective function, then the goal of the
search is to find the global maximum and local maximum
Different regions in the state space landscape:
• Local Maximum: Local maximum is a state which is better than its neighbor states, but there is also another state which is higher than it.
• Global Maximum: Global maximum is the best possible state of state space landscape. It has the highest value of objective function.
• Current state: It is a state in a landscape diagram where an agent is currently present.
• Flat local maximum: It is a flat space in the landscape where all the neighbor states of current states have the same value.
• Shoulder: It is a plateau region which has an uphill edge.
Types of Hill Climbing Algorithm:
• Simple hill Climbing
• Steepest-Ascent hill-climbing
• Stochastic hill Climbing
Simple Hill Climbing:
• Simple hill climbing is the simplest way to implement a hill climbing algorithm. It only evaluates the neighbor node state at a time and selects
the first one which optimizes current cost and set it as a current state. It only checks it's one successor state, and if it finds better than the current
state, then move else be in the same state. This algorithm has the following features:
• Less time consuming
• Less optimal solution and the solution is not guaranteed
Algorithm for Simple Hill Climbing:
Step 1: Evaluate the initial state, if it is goal state then return success and Stop.
Step 2: Loop Until a solution is found or there is no new operator left to apply.
Step 3: Select and apply an operator to the current state.
Step 4: Check new state:
• If it is goal state, then return success and quit.
• Else if it is better than the current state then assign new state as a current state.
• Else if not better than the current state, then return to step2.
Step 5: Exit.
Steepest-Ascent hill climbing:
The steepest-Ascent algorithm is a variation of simple hill climbing algorithm. This algorithm examines all the neighboring nodes of
the current state and selects one neighbor node which is closest to the goal state. This algorithm consumes more time as it searches for multiple
neighbors
Algorithm for Steepest-Ascent hill climbing:
Step 1: Evaluate the initial state, if it is goal state then return success and stop, else make current state as initial state.
Step 2: Loop until a solution is found or the current state does not change.
• Let SUCC be a state such that any successor of the current state will be better than it.
• For each operator that applies to the current state:
• Apply the new operator and generate a new state.
• Evaluate the new state.
• If it is goal state, then return it and quit, else compare it to the SUCC.
• If it is better than SUCC, then set new state as SUCC.
• If the SUCC is better than the current state, then set current state to SUCC.
Step 3: Exit.
Stochastic hill climbing:
Stochastic hill climbing does not examine for all its neighbor before moving. Rather, this search algorithm selects one neighbor node at
random and decides whether to choose it as a current state or examine another state.
Problems in Hill Climbing Algorithm
1. Local Maximum: A local maximum is a peak state in the landscape which is better than each of its neighboring states, but there is another state
also present which is higher than the local maximum.
Solution: Backtracking technique can be a solution of the local maximum in state space landscape. Create a list of the promising path so that the
algorithm can backtrack the search space and explore other paths as well.
2. Plateau: A plateau is the flat area of the search space in which all the neighbor states of the current state contains the same value, because of this
algorithm does not find any best direction to move. A hill-climbing search might be lost in the plateau area.
Solution: The solution for the plateau is to take big steps or very little steps while searching, to solve the problem. Randomly select a state which is
far away from the current state so it is possible that the algorithm could find non-plateau region.
3. Ridges: A ridge is a special form of the local maximum. It has an area which is higher than its surrounding areas, but itself has a slope, and
cannot be reached in a single move.
Solution: With the use of bidirectional search, or by moving in different directions, we can improve this problem.
• Is heuristic approach where only the most promising ß nodes (instead of all nodes) at each step of the search are retained for further branching.
• ß is called Beam Width.
• Beam search is an optimization of best-first search that reduces its memory requirements.
Algorithm
OPEN = {initial state}
while OPEN is not empty do
1. Remove the best node from OPEN, call it n.
2. If n is the goal state, back trace path to n (through recorded parents) and return path.
3. Create n's successors.
4. Evaluate each successor, add it to OPEN, and record its parent.
5. If |OPEN| > ß , take the best ß nodes (according to heuristic) and remove the others from the OPEN.
done
Examples
ß=2
Features of Beam Search
Optimality
• Just as the Algorithm is not complete, it is also not guaranteed to be optimal.
• This can happen because the beam width and an inaccurate heuristic function may cause the algorithm to miss expanding the shortest path.
• A more precise heuristic function and a larger beam width can make Beam Search more likely to find the optimal path to the goal
Time Complexity
• Depends on the accuracy of the heuristic function.
• In the worst case, the heuristic function leads Beam Search all the way to the deepest level in the search tree.
• The worst case time = O(B*m)
where B is the beam width and m is the maximum depth of any path in the search tree.
Space Complexity
• Beam Search's memory consumption is its most desirable trait.
• Since the algorithm only stores B nodes at each level in the search tree,
the worst-case space complexity = O(B*m)
where B is the beam width, and m is the maximum depth of any path in the search tree.
• This linear memory consumption allows Beam Search to probe very deeply into large search spaces and potentially find solutions that other
algorithms cannot reach.
Expert System
• The expert system is a part of AI, and the first ES was developed in the year 1970, which was the first successful approach of artificial
intelligence. It solves the most complex issue as an expert by extracting the knowledge stored in its knowledge base. The system helps in
decision making for compsex problems using both facts and heuristics like a human expert. It is called so because it contains the expert
knowledge of a specific domain and can solve any complex problem of that particular domain. These systems are designed for a specific
domain, such as medicine, science, etc.
• The performance of an expert system is based on the expert's knowledge stored in its knowledge base. The more knowledge stored in the KB,
the more that system improves its performance. One of the common examples of an ES is a suggestion of spelling errors while typing in the
Google search box.
Examples
• DENDRAL: It was an artificial intelligence project that was made as a chemical analysis expert system. It was used in organic chemistry to
detect unknown organic molecules with the help of their mass spectra and knowledge base of chemistry.
• MYCIN: It was one of the earliest backward chaining expert systems that was designed to find the bacteria causing infections like bacteraemia
and meningitis. It was also used for the recommendation of antibiotics and the diagnosis of blood clotting diseases.
• PXDES: It is an expert system that is used to determine the type and level of lung cancer. To determine the disease, it takes a picture from the
upper body, which looks like the shadow. This shadow identifies the type and degree of harm.
• CaDeT: The CaDet expert system is a diagnostic support system that can detect cancer at early stages.
Characteristics of Expert System
• High Performance: The expert system provides high performance for solving any type of complex problem of a specific domain with high
efficiency and accuracy.
• Understandable: It responds in a way that can be easily understandable by the user. It can take input in human language and provides the
output in the same way.
• Reliable: It is much reliable for generating an efficient and accurate output.
• Highly responsive: ES provides the result for any complex query within a very short period of time.
Components of Expert System
An expert system mainly consists of three components:
• User Interface
• Inference Engine
• Knowledge Base
User Interface
• With the help of a user interface, the expert system interacts with the user, takes queries as an input in a readable format, and passes it to the
inference engine. After getting the response from the inference engine, it displays the output to the user. In other words, it is an interface that
helps a non-expert user to communicate with the expert system to find a solution.
Inference Engine(Rules of Engine)
• The inference engine is known as the brain of the expert system as it is the main processing unit of the system. It applies inference rules to the
knowledge base to derive a conclusion or deduce new information. It helps in deriving an error-free solution of queries asked by the user.
• With the help of an inference engine, the system extracts the knowledge from the knowledge base.
There are two types of inference engine:
• Deterministic Inference engine: The conclusions drawn from this type of inference engine are assumed to be true. It is based
on facts and rules.
• Probabilistic Inference engine: This type of inference engine contains uncertainty in conclusions, and based on the probability.
Inference engine uses the below modes to derive the solutions:
• Forward Chaining: It starts from the known facts and rules, and applies the inference rules to add their conclusion to the known facts.
• Backward Chaining: It is a backward reasoning method that starts from the goal and works backward to prove the known facts.
Knowledge Base
• The knowledgebase is a type of storage that stores knowledge acquired from the different experts of the particular domain. It is considered as big
storage of knowledge. The more the knowledge base, the more precise will be the Expert System.
• It is similar to a database that contains information and rules of a particular domain or subject.
• One can also view the knowledge base as collections of objects and their attributes. Such as a Lion is an object and its attributes are it is a
mammal, it is not a domestic animal, etc.
Components of Knowledge Base
• Factual Knowledge: The knowledge which is based on facts and accepted by knowledge engineers comes under factual knowledge.
• Heuristic Knowledge: This knowledge is based on practice, the ability to guess, evaluation, and experiences.
• Knowledge Representation: It is used to formalize the knowledge stored in the knowledge base using the If-else rules.
• Knowledge Acquisitions: It is the process of extracting, organizing, and structuring the domain knowledge, specifying the rules to acquire the
knowledge from various experts, and store that knowledge into the knowledge base.
Need for Expert Systems
• Before using any technology, we must have an idea about why to use that technology and hence the same for the ES. Although we have human experts in
every field, then what is the need to develop a computer-based system. So below are the points that are describing the need of the ES:
1. No memory Limitations: It can store as much data as required and can memorize it at the time of its application. But for human experts, there are some
limitations to memorize all things at every time.
2. High Efficiency: If the knowledge base is updated with the correct knowledge, then it provides a highly efficient output, which may not be possible for a
human.
3. Expertise in a domain: There are lots of human experts in each domain, and they all have different skills, different experiences, and different skills, so it is
not easy to get a final output for the query. But if we put the knowledge gained from human experts into the expert system, then it provides an efficient
output by mixing all the facts and knowledge
4. Not affected by emotions: These systems are not affected by human emotions such as fatigue, anger, depression, anxiety, etc.. Hence the performance
remains constant.
5. High security: These systems provide high security to resolve any query.
6. Considers all the facts: To respond to any query, it checks and considers all the available facts and provides the result accordingly. But it is possible that a
human expert may not consider some facts due to any reason.
7. Regular updates improve the performance: If there is an issue in the result provided by the expert systems, we can improve the performance of the
system by updating the knowledge base.
Capabilities of the Expert System
Below are some capabilities of an Expert System:
• Advising: It is capable of advising the human being for the query of any domain from the particular ES.
• Provide decision-making capabilities: It provides the capability of decision making in any domain, such as for making any financial decision, decisions in
medical science, etc.
• Demonstrate a device: It is capable of demonstrating any new products such as its features, specifications, how to use that product, etc.
• Problem-solving: It has problem-solving capabilities.
• Explaining a problem: It is also capable of providing a detailed description of an input problem.
• Interpreting the input: It is capable of interpreting the input given by the user.
• Predicting results: It can be used for the prediction of a result.
• Diagnosis: An ES designed for the medical field is capable of diagnosing a disease without using multiple components as it already contains various inbuilt
medical tools.
Applications of Expert System
• In designing and manufacturing domain
It can be broadly used for designing and manufacturing physical devices such as camera lenses and automobiles.
• In the knowledge domain
These systems are primarily used for publishing the relevant knowledge to the users. The two popular ES used for this domain is an advisor and a tax
advisor.
• In the finance domain
In the finance industries, it is used to detect any type of possible fraud, suspicious activity, and advise bankers that if they should provide loans for
business or not.
• In the diagnosis and troubleshooting of devices
In medical diagnosis, the ES system is used, and it was the first area where these systems were used.
• Planning and Scheduling
The expert systems can also be used for planning and scheduling some particular tasks for achieving the goal of that task.
Advantages of Expert System
• These systems are highly reproducible.
• They can be used for risky places where the human presence is not safe.
• Error possibilities are less if the KB contains correct knowledge.
• The performance of these systems remains steady as it is not affected by emotions, tension, or fatigue.
• They provide a very high speed to respond to a particular query.
Limitations of Expert System
• The response of the expert system may get wrong if the knowledge base contains the wrong information.
• Like a human being, it cannot produce a creative output for different scenarios.
• Its maintenance and development costs are very high.
• Knowledge acquisition for designing is much difficult.
• For each domain, we require a specific ES, which is one of the big limitations.
• It cannot learn from itself and hence requires manual updates.
Rete Algorithm
• The Rete algorithm provides a generalized logical description of an implementation of functionality responsible for matching data tuples ("facts")
against productions ("rules") in a pattern-matching production system (a category of rule engine).
Characteristics
• It reduces or eliminates certain types of redundancy through the use of node sharing.
• It stores partial matches when performing joins between different fact types. This, in turn, allows production systems to avoid complete re-
evaluation of all facts each time changes are made to the production system's working memory. Instead, the production system needs only to
evaluate the changes (deltas) to working memory.
• It allows for efficient removal of memory elements when facts are retracted from working memory.
Features
• The Rete algorithm is widely used to implement matching functionality within pattern-matching engines that exploit a match-resolve-act cycle to
support forward chaining and inferencing
• It provides a means for many-many matching, an important feature when many or all possible solutions in a search network must be found.
• Retes are directed acyclic graphs that represent higher-level rule sets. They are generally represented at run-time using a network of in-memory
objects. These networks match rule conditions (patterns) to facts (relational data tuples). Rete networks act as a type of relational query processor,
performing projections, selections and joins conditionally on arbitrary numbers of data tuples.
• Productions (rules) are typically captured and defined by analysts and developers using some high-level rules language. They are collected into
rule sets which are then translated, often at run time, into an executable Rete.
• When facts are "asserted" to working memory, the engine creates working memory elements (WMEs) for each fact. Facts are n-tuples, and may
therefore contain an arbitrary number of data items. Each WME may hold an entire n-tuple, or, alternatively, each fact may be represented by a set
of WMEs where each WME contains a fixed-length tuple. In this case, tuples are typically triplets (3-tuples).
• Each WME enters the Rete network at a single root node. The root node passes each WME on to its child nodes, and each WME may then be
propagated through the network, possibly being stored in intermediate memories, until it arrives at a terminal node.
Plan Space Planning
• In state-space planning, a program searches through a space of world states, seeking to find a path or paths that will take it from its initial state to
a goal state.
State-space planning is too inflexible, because:
• It creates plans that are total orderings of a set of steps, and
• It assembles these plans in exactly the same order
• In plan-space planning, a program searches through a space of plans, seeking a plan that will take it from its initial state to a goal state.
In this approach, we redefine some of the terms of our search:
• A plan is a set of steps and a set of constraints on the ordering of the steps.
• A state is a plan.
• The goal state is a plan that achieves all specified goals.
• An operator creates a new plan from an old plan.
A plan whether partial or complete consists of
• A specification of its precondition state and its postcondition state
• A set of actions, or “steps”, Si
• A set of orderings on steps, { (Si < Sj), ... }
An example of a partial plan:
Precondition
armEmpty and clear( A ) and on( A, B ) and on( B, TABLE )
Postcondition
armEmpty and clear( B ) and on( B, A ) and on( A, TABLE )
• S = { S1 , S2 } S1 = stack( B, A ) S2 = stack( A, TABLE )
• ORDER = { (S2 < S1), ... }
Algorithm
1. P := empty-plan(I, G)
2. Loop:
a. If P is a solution, return P.
b. Choose F := find-flaw( P )
c. Choose M := find-method( P, F )
d. If there is no such method, return failure.
e. P := fix-flaw(P, F, M)
This algorithm introduces some new concepts...
• An empty plan is a plan with no steps and no constraints. This plan says, “Yeah, I plan to get from A to B,” but does not contain actions to do it.
• A solution is any plan that achieves the I -> G.
So, Step2a is where we do our goal test in this algorithm
Flaws and Methods
3. P := empty-plan(I, G)
4. Loop:
a. If P is a solution, return P.
b. Choose F := find-flaw( P )
c. Choose M := find-method( P, F )
d. If there is no such method, return failure.
e. P := fix-flaw(P, F, M) A flaw is anything wrong with a plan.
• A flaw is anything wrong with a plan.
• It might be something that is undone, such as “no action achieves this part of the goal” or “no action achieves this precondition of a step in the
plan”.
• However, this algorithm can construct a partial plan that is internally inconsistent.
In such a case, a flaw can be an inconsistency, such as executing one step might undo a precondition for another step.
A method is a way to fix a flaw. Usually, a flaw is a something undone, and so a method might add a step or a constraint to the plan.
Partial-Order Planning
This style of planning is called partial-order planning (POP), because it enables a planner to construct plans that are only partially ordered and thus
only complete enough to accomplish its goal
The POP algorithm that uses the MTC and causal links is the culmination of a progression of increasingly more sophisticated planning algorithms.
POP satisfies our three key ideas
• States and operators are decomposable.
• It can add an action to the plan at any place.
• It decomposes a problem into sub-tasks, solves them separately, and re-assemble the solutions.
Graph Planning
• Planning graphs consists of a seq of levels that correspond to time steps in the plan.
• Level 0 is the initial state.
• Each level consists of a set of literals and a set of actions that represent what might be possible at that step in the plan
• Might be is the key to efficiency
• Records only a restricted subset of possible negative interactions among actions.
• Each level consists of
• Literals= all those that could be true at that time step, depending upon the actions executed at preceding time steps.
• Actions= all those actions that could have their preconditions satisfied at that time step, depending on which of the literals
actually hold.
Example
Init(Have(Cake))
Goal(Have(Cake) ^Eaten(Cake))
Action(Eat(Cake), PRECOND: Have(Cake)
EFFECT: ¬Have(Cake) ^Eaten(Cake))
Action(Bake(Cake), PRECOND: ¬ Have(Cake)
EFFECT: Have(Cake))
Graph Plan Algorithm
• Extract a solution directly from the PG
• Function GRAPHPLAN(problem) return solutionor failure
• Graph INITIAL-PLANNING-GRAPH(problem)
• Goals GOALS[problem]
• loop do
• if goals all non-mutex in last level of graph then do
• Solution EXTRACT-SOLUTION(graph, goals, LENGTH(graph))
• If solution= failure then return solution
• else if NO-SOLUTION-POSSIBLE(graph) then return failure
• Graph EXPAND-GRAPH(graph, problem)
Example
• Initially the plan consist of 5 literals from the initial state and the CWA literals (S0).
• Add actions whose preconditions are satisfied by EXPAND-GRAPH (A0)
• Also add persistence actions and mutex relations.
• Add the effects at level S1
• Repeat until goal is in level Si
EXPAND-GRAPH Example
EXPAND-GRAPH also looks for mutex relations
Inconsistent effects
• E.g. Remove(Spare, Trunk) and Leave Overnight due to At(Spare, Ground) and not At(Spare, Ground)
Interference
• E.g. Remove(Flat, Axle) and Leave Overnight At(Flat, Axle) as PRECOND and not At(Flat, Axle) as EFFECT
Competing needs
• E.g. PutOn(Spare, Axle) and Remove(Flat, Axle) due to At(Flat. Axle) and not At(Flat, Axle)
Inconsistent support
• E.g. in S2, At(Spare, Axle) and At(Flat, Axle)

IoT Sensor Nodes with AI - Lecture Notes

  • 1.
    20ECE506T –IoT Sensor Nodeswith AI Unit-1 Introduction to Artificial Intelligence
  • 2.
    AI Vs HumanIntelligence Artificial Intelligence Machine learning Artificial intelligence is a technology which enables a machine to simulate human behavior. Machine learning is a subset of AI which allows a machine to automatically learn from past data without programming explicitly. The goal of AI is to make a smart computer system like humans to solve complex problems. The goal of ML is to allow machines to learn from data so that they can give accurate output. In AI, we make intelligent systems to perform any task like a human. In ML, we teach machines with data to perform a particular task and give an accurate result. Machine learning and deep learning are the two main subsets of AI. Deep learning is a main subset of machine learning. AI has a very wide range of scope. Machine learning has a limited scope AI is working to create an intelligent system which can perform various complex tasks. Machine learning is working to create machines that can perform only those specific tasks for which they are trained. On the basis of capabilities, AI can be divided into three types, which are, Weak AI, General AI, and Strong AI. Machine learning can also be divided into mainly three types that are Supervised learning, Unsupervised learning, and Reinforcement learning. It includes learning, reasoning, and self-correction It includes learning and self-correction when introduced with new data.
  • 3.
    History of ArtificialIntelligence Maturation of Artificial Intelligence (1943-1952) 1943: The first work which is now recognized as AI was done by Warren McCulloch and Walter pits in 1943. They proposed a model of artificial neurons. 1949: Donald Hebb demonstrated an updating rule for modifying the connection strength between neurons. His rule is now called Hebbian learning. 1950: The Alan Turing who was an English mathematician and pioneered Machine learning in 1950. Alan Turing publishes "Computing Machinery and Intelligence" in which he proposed a test. The test can check the machine's ability to exhibit intelligent behavior equivalent to human intelligence, called a Turing test. The birth of Artificial Intelligence (1952-1956) 1955: An Allen Newell and Herbert A. Simon created the "first artificial intelligence program"Which was named as "Logic Theorist". This program had proved 38 of 52 Mathematics theorems, and find new and more elegant proofs for some theorems. 1956: The word "Artificial Intelligence" first adopted by American Computer scientist John McCarthy at the Dartmouth Conference. For the first time, AI coined as an academic field. The golden years-Early enthusiasm (1956-1974) 1966: The researchers emphasized developing algorithms which can solve mathematical problems. Joseph Weizenbaum created the first chatbot in 1966, which was named as ELIZA. 1972: The first intelligent humanoid robot was built in Japan which was named as WABOT-1 The first AI winter (1974-1980) • The duration between years 1974 to 1980 was the first AI winter duration. AI winter refers to the time period where computer scientist dealt with a severe shortage of funding from government for AI researches. • During AI winters, an interest of publicity on artificial intelligence was decreased.
  • 4.
    A boom ofAI (1980-1987) 1980: After AI winter duration, AI came back with "Expert System". Expert systems were programmed that emulate the decision-making ability of a human expert. In the Year 1980, the first national conference of the American Association of Artificial Intelligence was held at Stanford University. The second AI winter (1987-1993) The duration between the years 1987 to 1993 was the second AI Winter duration. Again Investors and government stopped in funding for AI research as due to high cost but not efficient result. The expert system such as XCON was very cost effective. The emergence of intelligent agents (1993-2011) 1997: In the year 1997, IBM Deep Blue beats world chess champion, Gary Kasparov, and became the first computer to beat a world chess champion. 2002: for the first time, AI entered the home in the form of Roomba, a vacuum cleaner. 2006: AI came in the Business world till the year 2006. Companies like Facebook, Twitter, and Netflix also started using AI. Deep learning, big data and artificial general intelligence (2011-present) 2011: In the year 2011, IBM's Watson won jeopardy, a quiz show, where it had to solve the complex questions as well as riddles. Watson had proved that it could understand natural language and can solve tricky questions quickly. 2012: Google has launched an Android app feature "Google now", which was able to provide information to the user as a prediction. 2014: In the year 2014, Chatbot "Eugene Goostman" won a competition in the infamous "Turing test." 2018: The "Project Debater" from IBM debated on complex topics with two master debaters and also performed extremely well. Google has demonstrated an AI program "Duplex" which was a virtual assistant and which had taken hairdresser appointment on call, and lady on other side didn't notice that she was talking with the machine.
  • 5.
    Advantages and Disadvantages Advantagesof Artificial Intelligence • AI drives down the time taken to perform a task. It enables multi-tasking and eases the workload for existing resources. • AI enables the execution of hitherto complex tasks without significant cost outlays. • AI operates 24x7 without interruption or breaks and has no downtime • AI augments the capabilities of differently abled individuals • AI has mass market potential, it can be deployed across industries. • AI facilitates decision-making by making the process faster and smarter. Disadvantages of Artificial Intelligence • High Costs of Creation • Making Humans Lazy • Unemployment • No Emotions • Lacking Out of Box Thinking
  • 6.
    Turing Test • TuringTest was introduced by Turing in his 1950 paper, "Computing Machinery and Intelligence • The Turing test is based on a party game "Imitation game," with some modifications. This game involves three players in which one player is Computer, another player is human responder, and the third player is a human Interrogator, who is isolated from other two players and his job is to find that which player is machine among two of them. Example: • Consider, Player A is a computer, Player B is human, and Player C is an interrogator. Interrogator is aware that one of them is machine, but he needs to identify this on the basis of questions and their responses. • The conversation between all players is via keyboard and screen so the result would not depend on the machine's ability to convert words as speech. • The test result does not depend on each correct answer, but only how closely its responses like a human answer. The computer is permitted to do everything possible to force a wrong identification by the interrogator. • The questions and answers can be like: • Interrogator: Are you a computer? • PlayerA (Computer): No • Interrogator: Multiply two large numbers such as (256896489*456725896) • Player A: Long pause and give the wrong answer. • In this game, if an interrogator would not be able to identify which is a machine and which is human, then the computer passes the test successfully, and the machine is said to be intelligent and can think like a human. • "In 1991, the New York businessman Hugh Loebner announces the prize competition, offering a $100,000 prize for the first computer to pass the Turing test. However, no AI program to till date, come close to passing an undiluted Turing test"
  • 7.
    Features required fora machine to pass the Turing test • Natural language processing: NLP is required to communicate with Interrogator in general human language like English. • Knowledge representation: To store and retrieve information during the test. • Automated reasoning: To use the previously stored information for answering the questions. • Machine learning: To adapt new changes and can detect generalized patterns. • Vision (For total Turing test): To recognize the interrogator actions and other objects during a test. • Motor Control (For total Turing test): To act upon objects if requested.
  • 8.
    Physical Symbol Systems •A physical symbol system (also called a formal system) takes physical patterns (symbols), combining them into structures (expressions) and manipulating them (using processes) to produce new expressions. Physical Patterns (Symbols))Ph Structures (Expressions) New Expressions An intelligent agent can be seen as manipulating symbols to produce action. Many of these symbols are used to refer to things in the world. Other symbols may be useful concepts that may or may not have external meaning. Yet other symbols may refer to internal states of the agent
  • 9.
    Example: A deliveryrobot can model the environment at a high level of abstraction in terms of rooms, corridors, doors, and obstacles, ignoring distances, its size, the steering angles needed, the slippage of the wheels, the weight of parcels, the details of obstacles, the political situation in Canada, and virtually everything else. The robot could model the environment at lower levels of abstraction by taking some of these details into account. Some of these details may be irrelevant for the successful implementation of the robot, but some may be crucial for the robot to succeed. For example, in some situations the size of the robot and the steering angles may be crucial for not getting stuck around a particular corner. In other situations, if the robot stays close to the center of the corridor, it may not need to model its width or the steering angles. Choosing an appropriate level of abstraction is difficult because • a high-level description is easier for a human to specify and understand. • a low-level description can be more accurate and more predictive. Often high-level descriptions abstract away details that may be important for actually solving the problem. • the lower the level, the more difficult it is to reason with. This is because a solution at a lower level of detail involves more steps and many more possible courses of action exist from which to choose. • you may not know the information needed for a low-level description. For example, the delivery robot may not know what obstacles it will encounter or how slippery the floor will be at the time that it must decide what to do.
  • 10.
    Scope of SymbolicAI • In the Symbolic approach, AI applications process strings of characters that represent real-world entities or concepts. Symbols can be arranged in structures such as lists, hierarchies, or networks and these structures show how symbols relate to each other. An early body of work in AI is purely focused on symbolic approaches with Symbolists pegged as the “prime movers of the field” Applications of Symbolic AI • A Symbolic approach offer good performances in reasoning, is able to give explanations and can manipulate complex data structures, but it has generally serious difficulties in anchoring their symbols in the perceptive world. • the Symbolic approach works best on well-defined problems, wherein the information is presented and the system has to crunch systematically GOFAI • Good-Old-Fashioned Artificial Intelligence (GOFAI) is more like a euphemism for Symbolic AI is characterized by an exclusive focus on symbolic reasoning and logic. However, the approach soon lost fizzle since the researchers leveraging the GOFAI approach were tackling the “Strong AI” problem, the problem of constructing autonomous intelligent software as intelligent as a human. • The GOFAI approach works best with static problems and is not a natural fit for real-time dynamic issues. It focuses on a narrow definition of intelligence as abstract reasoning, while artificial neural networks focus on the ability to recognize pattern. For example, NLP systems that use grammars to parse language are based on Symbolic AI systems.
  • 11.
    Scope of Agents Typesof AI Agents Agents can be grouped into five classes based on their degree of perceived intelligence and capability. All these agents can improve their performance and generate better action over the time. These are given below: • Simple Reflex Agent • Model-based reflex agent • Goal-based agents • Utility-based agent • Learning agent Simple Reflex agent: • The Simple reflex agents are the simplest agents. These agents take decisions on the basis of the current percepts and ignore the rest of the percept history. • These agents only succeed in the fully observable environment. • The Simple reflex agent does not consider any part of percepts history during their decision and action process. • The Simple reflex agent works on Condition-action rule, which means it maps the current state to action. Such as a Room Cleaner agent, it works only if there is dirt in the room. • Problems for the simple reflex agent design approach: • They have very limited intelligence • They do not have knowledge of non-perceptual parts of the current state • Mostly too big to generate and to store.
  • 12.
    Model-based reflex agent TheModel-based agent can work in a partially observable environment, and track the situation. • A model-based agent has two important factors: • Model: It is knowledge about "how things happen in the world," so it is called a Model-based agent. • Internal State: It is a representation of the current state based on percept history. • These agents have the model, "which is knowledge of the world" and based on the model they perform actions. • Updating the agent state requires information about: • How the world evolves • How the agent's action affects the world. Goal-based agents • The knowledge of the current state environment is not always sufficient to decide for an agent to what to do. • The agent needs to know its goal which describes desirable situations. • Goal-based agents expand the capabilities of the model-based agent by having the "goal" information. • They choose an action, so that they can achieve the goal. • These agents may have to consider a long sequence of possible actions before deciding whether the goal is achieved or not. • Such considerations of different scenario are called searching and planning, which makes an agent proactive.
  • 13.
    Utility-based agents • Theseagents are similar to the goal-based agent but provide an extra component of utility measurement which makes them different by providing a measure of success at a given state. • Utility-based agent act based not only goals but also the best way to achieve the goal. • The Utility-based agent is useful when there are multiple possible alternatives, and an agent has to choose in order to perform the best action. • The utility function maps each state to a real number to check how efficiently each action achieves the goals. Learning Agents • A learning agent in AI is the type of agent which can learn from its past experiences, or it has learning capabilities. • It starts to act with basic knowledge and then able to act and adapt automatically through learning. • A learning agent has mainly four conceptual components, which are: • Learning element: It is responsible for making improvements by learning from environment • Critic: Learning element takes feedback from critic which describes that how well the agent is doing with respect to a fixed performance standard. • Performance element: It is responsible for selecting external action • Problem generator: This component is responsible for suggesting actions that will lead to new and informative experiences. • Hence, learning agents are able to learn, analyze performance, and look for new ways to improve the performance. Utility-based agents Learning Agents
  • 14.
    • In ArtificialIntelligence, Search techniques are universal problem-solving methods. Rational agents or Problem-solving agents in AI mostly used these search strategies or algorithms to solve a specific problem and provide the best result. Problem-solving agents are the goal-based agents and use atomic representation. Search Algorithm Terminologies: • Search: Searching is a step by step procedure to solve a search-problem in a given search space. A search problem can have three main factors: • Search Space: Search space represents a set of possible solutions, which a system may have. • Start State: It is a state from where agent begins the search. • Goal test: It is a function which observe the current state and returns whether the goal state is achieved or not. • Search tree: A tree representation of search problem is called Search tree. The root of the search tree is the root node which is corresponding to the initial state. • Actions: It gives the description of all the available actions to the agent. • Transition model: A description of what each action do, can be represented as a transition model. • Path Cost: It is a function which assigns a numeric cost to each path. • Solution: It is an action sequence which leads from the start node to the goal node. • Optimal Solution: If a solution has the lowest cost among all solutions.
  • 15.
    Types of searchalgorithms Uninformed/Blind Search: • The uninformed search does not contain any domain knowledge such as closeness, the location of the goal. It operates in a brute-force way as it only includes information about how to traverse the tree and how to identify leaf and goal nodes. Uninformed search applies a way in which search tree is searched without any information about the search space like initial state operators and test for the goal, so it is also called blind search. It examines each node of the tree until it achieves the goal node. It can be divided into five main types: • Breadth-first search • Uniform cost search • Depth-first search • Iterative deepening depth-first search • Bidirectional Search Informed Search • Informed search algorithms use domain knowledge. In an informed search, problem information is available which can guide the search. • Informed search strategies can find a solution more efficiently than an uninformed search strategy. Informed search is also called a Heuristic search. • A heuristic is a way which might not always be guaranteed for best solutions but guaranteed to find a good solution in reasonable time. • Informed search can solve much complex problem which could not be solved in another way. • An example of informed search algorithms is a traveling salesman problem. Greedy Search, A* Search
  • 16.
    Depth-first Search • Depth-firstsearch is a recursive algorithm for traversing a tree or graph data structure. • It is called the depth-first search because it starts from the root node and follows each path to its greatest depth node before moving to the next path. • DFS uses a stack data structure for its implementation. • The process of the DFS algorithm is similar to the BFS algorithm. Example: • In the below search tree, we have shown the flow of depth-first search, and it will follow the order as: • Root node--->Left node ----> right node. • It will start searching from root node S, and traverse A, then B, then D and E, after traversing E, it will backtrack the tree as E has no other successor and still goal node is not found. After backtracking it will traverse node C and then G, and here it will terminate as it found goal node.
  • 17.
    • Completeness: DFSsearch algorithm is complete within finite state space as it will expand every node within a limited search tree. • Time Complexity: Time complexity of DFS will be equivalent to the node traversed by the algorithm. It is given by: • T(n)= 1+ n2 + n3 +.........+ nm =O(nm ) • Where, m= maximum depth of any node and this can be much larger than d (Shallowest solution depth) • Space Complexity: DFS algorithm needs to store only single path from the root node, hence space complexity of DFS is equivalent to the size of the fringe set, which is O(bm). • Optimal: DFS search algorithm is non-optimal, as it may generate a large number of steps or high cost to reach to the goal node. Advantage: • DFS requires very less memory as it only needs to store a stack of the nodes on the path from root node to the current node. • It takes less time to reach to the goal node than BFS algorithm (if it traverses in the right path). Disadvantage: • There is the possibility that many states keep re-occurring, and there is no guarantee of finding the solution. • DFS algorithm goes for deep down searching and sometime it may go to the infinite loop.
  • 18.
    Heuristic search • Sofar we have talked about the uninformed search algorithms which looked through search space for all possible solutions of the problem without having any additional knowledge about search space. But informed search algorithm contains an array of knowledge such as how far we are from the goal, path cost, how to reach to goal node, etc. This knowledge help agents to explore less to the search space and find more efficiently the goal node. • The informed search algorithm is more useful for large search space. Informed search algorithm uses the idea of heuristic, so it is also called Heuristic search. • Heuristics function: Heuristic is a function which is used in Informed Search, and it finds the most promising path. It takes the current state of the agent as its input and produces the estimation of how close agent is from the goal. The heuristic method, however, might not always give the best solution, but it guaranteed to find a good solution in reasonable time. Heuristic function estimates how close a state is to the goal. It is represented by h(n), and it calculates the cost of an optimal path between the pair of states. The value of the heuristic function is always positive. Admissibility of the heuristic function is given as: h(n) <= h*(n) • Here h(n) is heuristic cost, and h*(n) is the estimated cost. Hence heuristic cost should be less than or equal to the estimated cost. Pure Heuristic Search • Pure heuristic search is the simplest form of heuristic search algorithms. It expands nodes based on their heuristic value h(n). It maintains two lists, OPEN and CLOSED list. In the CLOSED list, it places those nodes which have already expanded and in the OPEN list, it places nodes which have yet not been expanded. • On each iteration, each node n with the lowest heuristic value is expanded and generates all its successors and n is placed to the closed list. The algorithm continues unit a goal state is found. • In the informed search we will discuss two main algorithms which are given below: • Best First Search Algorithm(Greedy search) • A* Search Algorithm
  • 19.
    Best-first Search Algorithm(Greedy Search) Greedy best-first search algorithm always selects the path which appears best at that moment. It is the combination of depth-first search and breadth-first search algorithms. It uses the heuristic function and search. Best-first search allows us to take the advantages of both algorithms. With the help of best-first search, at each step, we can choose the most promising node. In the best first search algorithm, we expand the node which is closest to the goal node and the closest cost is estimated by heuristic function, f(n)= g(n) Were, h(n)= estimated cost from node n to the goal. The greedy best first algorithm is implemented by the priority queue. Best first search algorithm: Step 1: Place the starting node into the OPEN list. Step 2: If the OPEN list is empty, Stop and return failure. Step 3: Remove the node n, from the OPEN list which has the lowest value of h(n), and places it in the CLOSED list. Step 4: Expand the node n, and generate the successors of node n. Step 5: Check each successor of node n, and find whether any node is a goal node or not. If any successor node is goal node, then return success and terminate the search, else proceed to Step 6. Step 6: For each successor node, algorithm checks for evaluation function f(n), and then check if the node has been in either OPEN or CLOSED list. If the node has not been in both list, then add it to the OPEN list. Step 7: Return to Step 2.
  • 20.
    Example: • Consider thebelow search problem, and we will traverse it using greedy best-first search. At each iteration, each node is expanded using evaluation function f(n)=h(n) , which is given in the below table. In this search example, we are using two lists which are OPEN and CLOSED Lists. Following are the iteration for traversing the above example. Expand the nodes of S and put in the CLOSED list Initialization: Open [A, B], Closed [S] Iteration 1: Open [A], Closed [S, B] Iteration 2: Open [E, F, A], Closed [S, B] : Open [E, A], Closed [S, B, F] Iteration 3: Open [I, G, E, A], Closed [S, B, F] : Open [I, E, A], Closed [S, B, F, G] Hence the final solution path will be: S----> B----->F----> G
  • 21.
    • Time Complexity:The worst case time complexity of Greedy best first search is O(bm ). • Space Complexity: The worst case space complexity of Greedy best first search is O(bm ). Where, m is the maximum depth of the search space. • Complete: Greedy best-first search is also incomplete, even if the given state space is finite. • Optimal: Greedy best first search algorithm is not optimal. Advantages: • Best first search can switch between BFS and DFS by gaining the advantages of both the algorithms. • This algorithm is more efficient than BFS and DFS algorithms. Disadvantages: • It can behave as an unguided depth-first search in the worst case scenario. • It can get stuck in a loop as DFS. • This algorithm is not optimal.
  • 22.
    A* Search Algorithm •A* search is the most commonly known form of best-first search. It uses heuristic function h(n), and cost to reach the node n from the start state g(n). It has combined features of UCS and greedy best-first search, by which it solve the problem efficiently. A* search algorithm finds the shortest path through the search space using the heuristic function. This search algorithm expands less search tree and provides optimal result faster. A* algorithm is similar to UCS except that it uses g(n)+h(n) instead of g(n). • In A* search algorithm, we use search heuristic as well as the cost to reach the node. Hence we can combine both costs as following, and this sum is called as a fitness number. Algorithm of A* search: Step1: Place the starting node in the OPEN list. Step 2: Check if the OPEN list is empty or not, if the list is empty then return failure and stops. Step 3: Select the node from the OPEN list which has the smallest value of evaluation function (g+h), if node n is goal node then return success and stop, otherwise Step 4: Expand node n and generate all of its successors, and put n into the closed list. For each successor n', check whether n' is already in the OPEN or CLOSED list, if not then compute evaluation function for n' and place into Open list. Step 5: Else if node n' is already in OPEN and CLOSED, then it should be attached to the back pointer which reflects the lowest g(n') value. Step 6: Return to Step 2.
  • 23.
    Example: In this example,we will traverse the given graph using the A* algorithm. The heuristic value of all states is given in the below table so we will calculate the f(n) of each state using the formula f(n)= g(n) + h(n), where g(n) is the cost to reach any node from start state. • Here we will use OPEN and CLOSED list. Solution: • Initialization: {(S, 5)} • Iteration1: {(S--> A, 4), (S-->G, 10)} • Iteration2: {(S--> A-->C, 4), (S--> A-->B, 7), (S-->G, 10)} • Iteration3: {(S--> A-->C--->G, 6), (S--> A-->C--->D, 11), (S--> A-->B, 7), (S-->G, 10)} • Iteration 4 will give the final result, as S--->A--->C--->G it provides the optimal path with cost 6. Points to remember: • A* algorithm returns the path which occurred first, and it does not search for all remaining paths. • The efficiency of A* algorithm depends on the quality of heuristic. • A* algorithm expands all nodes which satisfy the condition f(n)
  • 24.
    Complete: A* algorithmis complete as long as: • Branching factor is finite. • Cost at every action is fixed. • Optimal: A* search algorithm is optimal if it follows below two conditions: • Admissible: the first condition requires for optimality is that h(n) should be an admissible heuristic for A* tree search. An admissible heuristic is optimistic in nature. • Consistency: Second required condition is consistency for only A* graph-search. • If the heuristic function is admissible, then A* tree search will always find the least cost path. • Time Complexity: The time complexity of A* search algorithm depends on heuristic function, and the number of nodes expanded is exponential to the depth of solution d. So the time complexity is O(b^d), where b is the branching factor. • Space Complexity: The space complexity of A* search algorithm is O(b^d) Advantages: • A* search algorithm is the best algorithm than other search algorithms. • A* search algorithm is optimal and complete. • This algorithm can solve very complex problems. Disadvantages: • It does not always produce the shortest path as it mostly based on heuristics and approximation. • A* search algorithm has some complexity issues. • The main drawback of A* is memory requirement as it keeps all generated nodes in the memory, so it is not practical for various large-scale problems.
  • 25.
    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. • Hill climbing algorithm is a technique which is used for optimizing the mathematical problems. One of the widely discussed examples of Hill climbing algorithm is Traveling-salesman Problem in which we need to minimize the distance traveled by the salesman. • It is also called greedy local search as it only looks to its good immediate neighbor state and not beyond that. • A node of hill climbing algorithm has two components which are state and value. • Hill Climbing is mostly used when a good heuristic is available. • In this algorithm, we don't need to maintain and handle the search tree or graph as it only keeps a single current state. 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.
  • 26.
    State-space Diagram forHill Climbing • The state-space landscape is a graphical representation of the hill-climbing algorithm which is showing a graph between various states of algorithm and Objective function/Cost. • On Y-axis we have taken the function which can be an objective function or cost function, and state-space on the x-axis. If the function on Y-axis is cost then, the goal of search is to find the global minimum and local minimum. If the function of Y-axis is Objective function, then the goal of the search is to find the global maximum and local maximum Different regions in the state space landscape: • Local Maximum: Local maximum is a state which is better than its neighbor states, but there is also another state which is higher than it. • Global Maximum: Global maximum is the best possible state of state space landscape. It has the highest value of objective function. • Current state: It is a state in a landscape diagram where an agent is currently present. • Flat local maximum: It is a flat space in the landscape where all the neighbor states of current states have the same value. • Shoulder: It is a plateau region which has an uphill edge.
  • 27.
    Types of HillClimbing Algorithm: • Simple hill Climbing • Steepest-Ascent hill-climbing • Stochastic hill Climbing Simple Hill Climbing: • Simple hill climbing is the simplest way to implement a hill climbing algorithm. It only evaluates the neighbor node state at a time and selects the first one which optimizes current cost and set it as a current state. It only checks it's one successor state, and if it finds better than the current state, then move else be in the same state. This algorithm has the following features: • Less time consuming • Less optimal solution and the solution is not guaranteed Algorithm for Simple Hill Climbing: Step 1: Evaluate the initial state, if it is goal state then return success and Stop. Step 2: Loop Until a solution is found or there is no new operator left to apply. Step 3: Select and apply an operator to the current state. Step 4: Check new state: • If it is goal state, then return success and quit. • Else if it is better than the current state then assign new state as a current state. • Else if not better than the current state, then return to step2. Step 5: Exit.
  • 28.
    Steepest-Ascent hill climbing: Thesteepest-Ascent algorithm is a variation of simple hill climbing algorithm. This algorithm examines all the neighboring nodes of the current state and selects one neighbor node which is closest to the goal state. This algorithm consumes more time as it searches for multiple neighbors Algorithm for Steepest-Ascent hill climbing: Step 1: Evaluate the initial state, if it is goal state then return success and stop, else make current state as initial state. Step 2: Loop until a solution is found or the current state does not change. • Let SUCC be a state such that any successor of the current state will be better than it. • For each operator that applies to the current state: • Apply the new operator and generate a new state. • Evaluate the new state. • If it is goal state, then return it and quit, else compare it to the SUCC. • If it is better than SUCC, then set new state as SUCC. • If the SUCC is better than the current state, then set current state to SUCC. Step 3: Exit. Stochastic hill climbing: Stochastic hill climbing does not examine for all its neighbor before moving. Rather, this search algorithm selects one neighbor node at random and decides whether to choose it as a current state or examine another state.
  • 29.
    Problems in HillClimbing Algorithm 1. Local Maximum: A local maximum is a peak state in the landscape which is better than each of its neighboring states, but there is another state also present which is higher than the local maximum. Solution: Backtracking technique can be a solution of the local maximum in state space landscape. Create a list of the promising path so that the algorithm can backtrack the search space and explore other paths as well. 2. Plateau: A plateau is the flat area of the search space in which all the neighbor states of the current state contains the same value, because of this algorithm does not find any best direction to move. A hill-climbing search might be lost in the plateau area. Solution: The solution for the plateau is to take big steps or very little steps while searching, to solve the problem. Randomly select a state which is far away from the current state so it is possible that the algorithm could find non-plateau region. 3. Ridges: A ridge is a special form of the local maximum. It has an area which is higher than its surrounding areas, but itself has a slope, and cannot be reached in a single move. Solution: With the use of bidirectional search, or by moving in different directions, we can improve this problem.
  • 30.
    • Is heuristicapproach where only the most promising ß nodes (instead of all nodes) at each step of the search are retained for further branching. • ß is called Beam Width. • Beam search is an optimization of best-first search that reduces its memory requirements. Algorithm OPEN = {initial state} while OPEN is not empty do 1. Remove the best node from OPEN, call it n. 2. If n is the goal state, back trace path to n (through recorded parents) and return path. 3. Create n's successors. 4. Evaluate each successor, add it to OPEN, and record its parent. 5. If |OPEN| > ß , take the best ß nodes (according to heuristic) and remove the others from the OPEN. done
  • 31.
  • 32.
    Features of BeamSearch Optimality • Just as the Algorithm is not complete, it is also not guaranteed to be optimal. • This can happen because the beam width and an inaccurate heuristic function may cause the algorithm to miss expanding the shortest path. • A more precise heuristic function and a larger beam width can make Beam Search more likely to find the optimal path to the goal Time Complexity • Depends on the accuracy of the heuristic function. • In the worst case, the heuristic function leads Beam Search all the way to the deepest level in the search tree. • The worst case time = O(B*m) where B is the beam width and m is the maximum depth of any path in the search tree. Space Complexity • Beam Search's memory consumption is its most desirable trait. • Since the algorithm only stores B nodes at each level in the search tree, the worst-case space complexity = O(B*m) where B is the beam width, and m is the maximum depth of any path in the search tree. • This linear memory consumption allows Beam Search to probe very deeply into large search spaces and potentially find solutions that other algorithms cannot reach.
  • 33.
    Expert System • Theexpert system is a part of AI, and the first ES was developed in the year 1970, which was the first successful approach of artificial intelligence. It solves the most complex issue as an expert by extracting the knowledge stored in its knowledge base. The system helps in decision making for compsex problems using both facts and heuristics like a human expert. It is called so because it contains the expert knowledge of a specific domain and can solve any complex problem of that particular domain. These systems are designed for a specific domain, such as medicine, science, etc. • The performance of an expert system is based on the expert's knowledge stored in its knowledge base. The more knowledge stored in the KB, the more that system improves its performance. One of the common examples of an ES is a suggestion of spelling errors while typing in the Google search box.
  • 34.
    Examples • DENDRAL: Itwas an artificial intelligence project that was made as a chemical analysis expert system. It was used in organic chemistry to detect unknown organic molecules with the help of their mass spectra and knowledge base of chemistry. • MYCIN: It was one of the earliest backward chaining expert systems that was designed to find the bacteria causing infections like bacteraemia and meningitis. It was also used for the recommendation of antibiotics and the diagnosis of blood clotting diseases. • PXDES: It is an expert system that is used to determine the type and level of lung cancer. To determine the disease, it takes a picture from the upper body, which looks like the shadow. This shadow identifies the type and degree of harm. • CaDeT: The CaDet expert system is a diagnostic support system that can detect cancer at early stages. Characteristics of Expert System • High Performance: The expert system provides high performance for solving any type of complex problem of a specific domain with high efficiency and accuracy. • Understandable: It responds in a way that can be easily understandable by the user. It can take input in human language and provides the output in the same way. • Reliable: It is much reliable for generating an efficient and accurate output. • Highly responsive: ES provides the result for any complex query within a very short period of time.
  • 35.
    Components of ExpertSystem An expert system mainly consists of three components: • User Interface • Inference Engine • Knowledge Base User Interface • With the help of a user interface, the expert system interacts with the user, takes queries as an input in a readable format, and passes it to the inference engine. After getting the response from the inference engine, it displays the output to the user. In other words, it is an interface that helps a non-expert user to communicate with the expert system to find a solution. Inference Engine(Rules of Engine) • The inference engine is known as the brain of the expert system as it is the main processing unit of the system. It applies inference rules to the knowledge base to derive a conclusion or deduce new information. It helps in deriving an error-free solution of queries asked by the user. • With the help of an inference engine, the system extracts the knowledge from the knowledge base. There are two types of inference engine: • Deterministic Inference engine: The conclusions drawn from this type of inference engine are assumed to be true. It is based on facts and rules. • Probabilistic Inference engine: This type of inference engine contains uncertainty in conclusions, and based on the probability. Inference engine uses the below modes to derive the solutions: • Forward Chaining: It starts from the known facts and rules, and applies the inference rules to add their conclusion to the known facts. • Backward Chaining: It is a backward reasoning method that starts from the goal and works backward to prove the known facts.
  • 36.
    Knowledge Base • Theknowledgebase is a type of storage that stores knowledge acquired from the different experts of the particular domain. It is considered as big storage of knowledge. The more the knowledge base, the more precise will be the Expert System. • It is similar to a database that contains information and rules of a particular domain or subject. • One can also view the knowledge base as collections of objects and their attributes. Such as a Lion is an object and its attributes are it is a mammal, it is not a domestic animal, etc. Components of Knowledge Base • Factual Knowledge: The knowledge which is based on facts and accepted by knowledge engineers comes under factual knowledge. • Heuristic Knowledge: This knowledge is based on practice, the ability to guess, evaluation, and experiences. • Knowledge Representation: It is used to formalize the knowledge stored in the knowledge base using the If-else rules. • Knowledge Acquisitions: It is the process of extracting, organizing, and structuring the domain knowledge, specifying the rules to acquire the knowledge from various experts, and store that knowledge into the knowledge base.
  • 37.
    Need for ExpertSystems • Before using any technology, we must have an idea about why to use that technology and hence the same for the ES. Although we have human experts in every field, then what is the need to develop a computer-based system. So below are the points that are describing the need of the ES: 1. No memory Limitations: It can store as much data as required and can memorize it at the time of its application. But for human experts, there are some limitations to memorize all things at every time. 2. High Efficiency: If the knowledge base is updated with the correct knowledge, then it provides a highly efficient output, which may not be possible for a human. 3. Expertise in a domain: There are lots of human experts in each domain, and they all have different skills, different experiences, and different skills, so it is not easy to get a final output for the query. But if we put the knowledge gained from human experts into the expert system, then it provides an efficient output by mixing all the facts and knowledge 4. Not affected by emotions: These systems are not affected by human emotions such as fatigue, anger, depression, anxiety, etc.. Hence the performance remains constant. 5. High security: These systems provide high security to resolve any query. 6. Considers all the facts: To respond to any query, it checks and considers all the available facts and provides the result accordingly. But it is possible that a human expert may not consider some facts due to any reason. 7. Regular updates improve the performance: If there is an issue in the result provided by the expert systems, we can improve the performance of the system by updating the knowledge base.
  • 38.
    Capabilities of theExpert System Below are some capabilities of an Expert System: • Advising: It is capable of advising the human being for the query of any domain from the particular ES. • Provide decision-making capabilities: It provides the capability of decision making in any domain, such as for making any financial decision, decisions in medical science, etc. • Demonstrate a device: It is capable of demonstrating any new products such as its features, specifications, how to use that product, etc. • Problem-solving: It has problem-solving capabilities. • Explaining a problem: It is also capable of providing a detailed description of an input problem. • Interpreting the input: It is capable of interpreting the input given by the user. • Predicting results: It can be used for the prediction of a result. • Diagnosis: An ES designed for the medical field is capable of diagnosing a disease without using multiple components as it already contains various inbuilt medical tools. Applications of Expert System • In designing and manufacturing domain It can be broadly used for designing and manufacturing physical devices such as camera lenses and automobiles. • In the knowledge domain These systems are primarily used for publishing the relevant knowledge to the users. The two popular ES used for this domain is an advisor and a tax advisor. • In the finance domain In the finance industries, it is used to detect any type of possible fraud, suspicious activity, and advise bankers that if they should provide loans for business or not. • In the diagnosis and troubleshooting of devices In medical diagnosis, the ES system is used, and it was the first area where these systems were used. • Planning and Scheduling The expert systems can also be used for planning and scheduling some particular tasks for achieving the goal of that task.
  • 39.
    Advantages of ExpertSystem • These systems are highly reproducible. • They can be used for risky places where the human presence is not safe. • Error possibilities are less if the KB contains correct knowledge. • The performance of these systems remains steady as it is not affected by emotions, tension, or fatigue. • They provide a very high speed to respond to a particular query. Limitations of Expert System • The response of the expert system may get wrong if the knowledge base contains the wrong information. • Like a human being, it cannot produce a creative output for different scenarios. • Its maintenance and development costs are very high. • Knowledge acquisition for designing is much difficult. • For each domain, we require a specific ES, which is one of the big limitations. • It cannot learn from itself and hence requires manual updates.
  • 40.
    Rete Algorithm • TheRete algorithm provides a generalized logical description of an implementation of functionality responsible for matching data tuples ("facts") against productions ("rules") in a pattern-matching production system (a category of rule engine). Characteristics • It reduces or eliminates certain types of redundancy through the use of node sharing. • It stores partial matches when performing joins between different fact types. This, in turn, allows production systems to avoid complete re- evaluation of all facts each time changes are made to the production system's working memory. Instead, the production system needs only to evaluate the changes (deltas) to working memory. • It allows for efficient removal of memory elements when facts are retracted from working memory. Features • The Rete algorithm is widely used to implement matching functionality within pattern-matching engines that exploit a match-resolve-act cycle to support forward chaining and inferencing • It provides a means for many-many matching, an important feature when many or all possible solutions in a search network must be found. • Retes are directed acyclic graphs that represent higher-level rule sets. They are generally represented at run-time using a network of in-memory objects. These networks match rule conditions (patterns) to facts (relational data tuples). Rete networks act as a type of relational query processor, performing projections, selections and joins conditionally on arbitrary numbers of data tuples. • Productions (rules) are typically captured and defined by analysts and developers using some high-level rules language. They are collected into rule sets which are then translated, often at run time, into an executable Rete. • When facts are "asserted" to working memory, the engine creates working memory elements (WMEs) for each fact. Facts are n-tuples, and may therefore contain an arbitrary number of data items. Each WME may hold an entire n-tuple, or, alternatively, each fact may be represented by a set of WMEs where each WME contains a fixed-length tuple. In this case, tuples are typically triplets (3-tuples). • Each WME enters the Rete network at a single root node. The root node passes each WME on to its child nodes, and each WME may then be propagated through the network, possibly being stored in intermediate memories, until it arrives at a terminal node.
  • 41.
    Plan Space Planning •In state-space planning, a program searches through a space of world states, seeking to find a path or paths that will take it from its initial state to a goal state. State-space planning is too inflexible, because: • It creates plans that are total orderings of a set of steps, and • It assembles these plans in exactly the same order • In plan-space planning, a program searches through a space of plans, seeking a plan that will take it from its initial state to a goal state. In this approach, we redefine some of the terms of our search: • A plan is a set of steps and a set of constraints on the ordering of the steps. • A state is a plan. • The goal state is a plan that achieves all specified goals. • An operator creates a new plan from an old plan.
  • 42.
    A plan whetherpartial or complete consists of • A specification of its precondition state and its postcondition state • A set of actions, or “steps”, Si • A set of orderings on steps, { (Si < Sj), ... } An example of a partial plan: Precondition armEmpty and clear( A ) and on( A, B ) and on( B, TABLE ) Postcondition armEmpty and clear( B ) and on( B, A ) and on( A, TABLE ) • S = { S1 , S2 } S1 = stack( B, A ) S2 = stack( A, TABLE ) • ORDER = { (S2 < S1), ... }
  • 43.
    Algorithm 1. P :=empty-plan(I, G) 2. Loop: a. If P is a solution, return P. b. Choose F := find-flaw( P ) c. Choose M := find-method( P, F ) d. If there is no such method, return failure. e. P := fix-flaw(P, F, M) This algorithm introduces some new concepts... • An empty plan is a plan with no steps and no constraints. This plan says, “Yeah, I plan to get from A to B,” but does not contain actions to do it. • A solution is any plan that achieves the I -> G. So, Step2a is where we do our goal test in this algorithm Flaws and Methods 3. P := empty-plan(I, G) 4. Loop: a. If P is a solution, return P. b. Choose F := find-flaw( P ) c. Choose M := find-method( P, F ) d. If there is no such method, return failure. e. P := fix-flaw(P, F, M) A flaw is anything wrong with a plan.
  • 44.
    • A flawis anything wrong with a plan. • It might be something that is undone, such as “no action achieves this part of the goal” or “no action achieves this precondition of a step in the plan”. • However, this algorithm can construct a partial plan that is internally inconsistent. In such a case, a flaw can be an inconsistency, such as executing one step might undo a precondition for another step. A method is a way to fix a flaw. Usually, a flaw is a something undone, and so a method might add a step or a constraint to the plan. Partial-Order Planning This style of planning is called partial-order planning (POP), because it enables a planner to construct plans that are only partially ordered and thus only complete enough to accomplish its goal The POP algorithm that uses the MTC and causal links is the culmination of a progression of increasingly more sophisticated planning algorithms. POP satisfies our three key ideas • States and operators are decomposable. • It can add an action to the plan at any place. • It decomposes a problem into sub-tasks, solves them separately, and re-assemble the solutions.
  • 45.
    Graph Planning • Planninggraphs consists of a seq of levels that correspond to time steps in the plan. • Level 0 is the initial state. • Each level consists of a set of literals and a set of actions that represent what might be possible at that step in the plan • Might be is the key to efficiency • Records only a restricted subset of possible negative interactions among actions. • Each level consists of • Literals= all those that could be true at that time step, depending upon the actions executed at preceding time steps. • Actions= all those actions that could have their preconditions satisfied at that time step, depending on which of the literals actually hold. Example Init(Have(Cake)) Goal(Have(Cake) ^Eaten(Cake)) Action(Eat(Cake), PRECOND: Have(Cake) EFFECT: ¬Have(Cake) ^Eaten(Cake)) Action(Bake(Cake), PRECOND: ¬ Have(Cake) EFFECT: Have(Cake))
  • 46.
    Graph Plan Algorithm •Extract a solution directly from the PG • Function GRAPHPLAN(problem) return solutionor failure • Graph INITIAL-PLANNING-GRAPH(problem) • Goals GOALS[problem] • loop do • if goals all non-mutex in last level of graph then do • Solution EXTRACT-SOLUTION(graph, goals, LENGTH(graph)) • If solution= failure then return solution • else if NO-SOLUTION-POSSIBLE(graph) then return failure • Graph EXPAND-GRAPH(graph, problem) Example • Initially the plan consist of 5 literals from the initial state and the CWA literals (S0). • Add actions whose preconditions are satisfied by EXPAND-GRAPH (A0) • Also add persistence actions and mutex relations. • Add the effects at level S1 • Repeat until goal is in level Si
  • 47.
    EXPAND-GRAPH Example EXPAND-GRAPH alsolooks for mutex relations Inconsistent effects • E.g. Remove(Spare, Trunk) and Leave Overnight due to At(Spare, Ground) and not At(Spare, Ground) Interference • E.g. Remove(Flat, Axle) and Leave Overnight At(Flat, Axle) as PRECOND and not At(Flat, Axle) as EFFECT Competing needs • E.g. PutOn(Spare, Axle) and Remove(Flat, Axle) due to At(Flat. Axle) and not At(Flat, Axle) Inconsistent support • E.g. in S2, At(Spare, Axle) and At(Flat, Axle)