AI notes
AI notes
AI notes
3 0 0 3
COURSE OBJECTIVES:
• To understand basic problem solving strategies.
• To outline game theory based search and constraint satisfaction
• To study knowledge representation techniques To explore reasoning and
planning associated with AI.
• To study the techniques of knowledge representation.
• To understand probabilistic and other types of reasoning
• To discuss ethical and safety issues associated with AI
UNIT I INTRODUCTION AND PROBLEM SOLVING 9
Artificial Intelligence -Introduction - Problem-solving -Solving Problems by Searching –
Uninformed Search Strategies -Informed (Heuristic) Search Strategies - Local Search - Search in
Partially Observable Environments
UNIT II ADVERSARIAL SEARCH AND CONSTRAINT SATISFACTION 9 PROBLEMS
Game Theory- Optimal Decisions in Games - Heuristic Alpha--Beta Tree Search- Monte Carlo Tree
Search - Stochastic Games - Partially Observable Games - Limitations of Game Search Algorithms
Constraint Satisfaction Problems (CSP)– Examples - Constraint Propagation- Backtracking Search
for CSPs - Local Search for CSPs
UNIT III KNOWLEDGE, REASONING AND PLANNING 9
First Order Logic – Inference in First Order Logic -Using Predicate Logic - Knowledge
Representation - Issues -Ontological Engineering - Categories and Objects – Reasoning Systems for
Categories - Planning -Definition -Algorithms -Heuristics for Planning -Hierarchical Planning
COURSE OUTCOMES:
CO1: Implement any three problem solving methods for a puzzle of your choice
CO2: Understand Game playing and implement a two player game using AI techniques
CO3: Design and Implement an example using predicate Logic
CO4: Implement a case based reasoning system
CO5:Discuss some methodologies to design ethical and explainable AI systems
REFERENCES:
1. Stuart Russell, Peter Norvig, “Artificial Intelligence: A Modern Approach”, Pearson, 4th
Edition, 2020. 2. Zhongzhi Shi “Advanced Artificial Intelligence”, World Scientific; 2019.
3. Kevin Knight, Elaine Rich, Shivashankar B. Nair, “Artificial Intelligence”, McGraw Hill
Education; 3rd edition, 2017
4. Richard E. Neapolitan, Xia Jiang, “Artificial Intelligence with an Introduction to Machine
Learning”, Chapman and Hall/CRC; 2nd edition, 2018
5. Dheepak Khemani, “A first course in Artificial Intelligence”, McGraw Hill Education Pvt Ltd.,
NewDelhi, 2013.
6. Nils J. Nilsson, “Artificial Intelligence: A New Synthesis”, Morgan Kaufmann Publishers Inc;
Second Edition, 2003.
Artificial Intelligence, often abbreviated as AI, is a branch of computer science that aims to create intelligent
machines capable of simulating human-like cognitive processes. It encompasses a wide range of techniques
and technologies designed to enable computers to perform tasks that typically require human intelligence,
such as learning from experience, recognizing patterns, understanding natural language, and making
decisions.
The field of AI traces its origins back to the mid-20th century when researchers began exploring the concept
of creating machines that could exhibit intelligence. Over the decades, AI has evolved significantly, driven
by advancements in computing power, algorithms, and data availability.
1. Machine Learning: Machine learning is a subset of AI that focuses on developing algorithms and
techniques that allow computers to learn from data and improve their performance over time without being
explicitly programmed. It encompasses various approaches, including supervised learning, unsupervised
learning, and reinforcement learning.
2. Deep Learning: Deep learning is a subfield of machine learning that utilizes neural networks with multiple
layers to extract hierarchical representations of data. Deep learning algorithms have demonstrated
remarkable success in tasks such as image recognition, natural language processing, and speech recognition.
3. Natural Language Processing (NLP): NLP is a branch of AI concerned with enabling computers to
understand, interpret, and generate human language in a way that is both meaningful and contextually
appropriate. NLP techniques power applications such as chatbots, language translation, sentiment analysis,
and text summarization.
4. Computer Vision: Computer vision is an area of AI focused on enabling computers to interpret and analyze
visual information from the world around them. It involves tasks such as object detection, image
classification, image segmentation, and scene understanding. Computer vision finds applications in fields
such as autonomous vehicles, surveillance systems, and medical imaging.
5. Robotics: Robotics combines AI with mechanical engineering to create autonomous or semi-autonomous
machines capable of interacting with the physical world. AI-powered robots can perform tasks such as
navigation, manipulation, and decision-making in various environments, including manufacturing,
healthcare, and exploration.
Applications of AI:
AI technologies are being applied across a wide range of domains, transforming industries and
revolutionizing how tasks are performed. Some notable applications of AI include:
Despite its transformative potential, AI also presents challenges and raises ethical considerations. These
include concerns about job displacement due to automation, biases in AI algorithms, privacy issues related to
data collection and surveillance, and the potential for AI to be used for malicious purposes.
In conclusion, Artificial Intelligence represents a rapidly evolving field with the potential to revolutionize
numerous aspects of society, from healthcare and transportation to education and entertainment. As AI
technologies continue to advance, it is essential to consider the ethical implications and ensure that they are
developed and deployed responsibly for the benefit of humanity.
Artificial Intelligence can be divided in various types, there are mainly two types of main categorization
which are based on capabilities and based on functionally of AI. Following is flow diagram which explain
the types of AI.
o Narrow AI is a type of AI which is able to perform a dedicated task with intelligence.The most
common and currently available AI is Narrow AI in the world of Artificial Intelligence.
o Narrow AI cannot perform beyond its field or limitations, as it is only trained for one specific task.
Hence it is also termed as weak AI. Narrow AI can fail in unpredictable ways if it goes beyond its
limits.
o Apple Siriis a good example of Narrow AI, but it operates with a limited pre-defined range of
functions.
o IBM's Watson supercomputer also comes under Narrow AI, as it uses an Expert system approach
combined with Machine learning and natural language processing.
o Some Examples of Narrow AI are playing chess, purchasing suggestions on e-commerce site, self-
driving cars, speech recognition, and image recognition.
2. General AI:
o General AI is a type of intelligence which could perform any intellectual task with efficiency like a
human.
o The idea behind the general AI to make such a system which could be smarter and think like a human
by its own.
o Currently, there is no such system exist which could come under general AI and can perform any task
as perfect as a human.
o The worldwide researchers are now focused on developing machines with General AI.
o As systems with general AI are still under research, and it will take lots of efforts and time to develop
such systems.
3. Super AI:
o Super AI is a level of Intelligence of Systems at which machines could surpass human intelligence,
and can perform any task better than human with cognitive properties. It is an outcome of general AI.
o Some key characteristics of strong AI include capability include the ability to think, to reason,solve
the puzzle, make judgments, plan, learn, and communicate by its own.
o Super AI is still a hypothetical concept of Artificial Intelligence. Development of such systems in
real is still world changing task.
1. Reactive Machines
o Purely reactive machines are the most basic types of Artificial Intelligence.
o Such AI systems do not store memories or past experiences for future actions.
o These machines only focus on current scenarios and react on it as per possible best action.
o IBM's Deep Blue system is an example of reactive machines.
o Google's AlphaGo is also an example of reactive machines.
2. Limited Memory
o Limited memory machines can store past experiences or some data for a short period of time.
o These machines can use stored data for a limited time period only.
o Self-driving cars are one of the best examples of Limited Memory systems. These cars can store
recent speed of nearby cars, the distance of other cars, speed limit, and other information to navigate
the road.
3. Theory of Mind
o Theory of Mind AI should understand the human emotions, people, beliefs, and be able to interact
socially like humans.
o This type of AI machines are still not developed, but researchers are making lots of efforts and
improvement for developing such AI machines.
4. Self-Awareness
o Self-awareness AI is the future of Artificial Intelligence. These machines will be super intelligent,
and will have their own consciousness, sentiments, and self-awareness.
o These machines will be smarter than human mind.
o Self-Awareness AI does not exist in reality still and it is a hypothetical concept.
Types of AI Agents
o 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.
o These agents only succeed in the fully observable environment.
o The Simple reflex agent does not consider any part of percepts history during their decision and
action process.
o 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.
o Problems for the simple reflex agent design approach:
o They have very limited intelligence
o They do not have knowledge of non-perceptual parts of the current state
o Mostly too big to generate and to store.
o Not adaptive to changes in the environment.
o The Model-based agent can work in a partially observable environment, and track the situation.
o A model-based agent has two important factors:
o Model: It is knowledge about "how things happen in the world," so it is called a Model-based
agent.
o Internal State: It is a representation of the current state based on percept history.
o These agents have the model, "which is knowledge of the world" and based on the model they
perform actions.
o Updating the agent state requires information about:
o The knowledge of the current state environment is not always sufficient to decide for an agent to
what to do.
o The agent needs to know its goal which describes desirable situations.
o Goal-based agents expand the capabilities of the model-based agent by having the "goal"
information.
o They choose an action, so that they can achieve the goal.
o 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.
o 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.
o Utility-based agent act based not only goals but also the best way to achieve the goal.
o 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.
o The utility function maps each state to a real number to check how efficiently each action achieves
the goals.
o A learning agent in AI is the type of agent which can learn from its past experiences, or it has
learning capabilities.
o It starts to act with basic knowledge and then able to act and adapt automatically through learning.
o A learning agent has mainly four conceptual components, which are:
An AI system can be defined as the study of the rational agent and its environment. The agents sense the
environment through sensors and act on their environment through actuators. An AI agent can have mental
properties such as knowledge, belief, intention, etc.
What is an Agent?
An agent can be anything that perceiveits environment through sensors and act upon that environment
through actuators. An Agent runs in the cycle of perceiving, thinking, and acting. An agent can be:
o Human-Agent: A human agent has eyes, ears, and other organs which work for sensors and hand,
legs, vocal tract work for actuators.
o Robotic Agent: A robotic agent can have cameras, infrared range finder, NLP for sensors and
various motors for actuators.
o Software Agent: Software agent can have keystrokes, file contents as sensory input and act on those
inputs and display output on the screen.
Hence the world around us is full of agents such as thermostat, cellphone, camera, and even we are also
agents.
Search algorithms are one of the most important areas of Artificial Intelligence. This topic will explain all
about the search algorithms in AI.
Problem-solving agents:
o Search: Searchingis a step by step procedure to solve a search-problem in a given search space. A
search problem can have three main factors:
a. Search Space: Search space represents a set of possible solutions, which a system may have.
b. Start State: It is a state from where agent begins the search.
c. Goal test: It is a function which observe the current state and returns whether the goal state is
achieved or not.
o 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.
o Actions: It gives the description of all the available actions to the agent.
o Transition model: A description of what each action do, can be represented as a transition model.
o Path Cost: It is a function which assigns a numeric cost to each path.
o Solution: It is an action sequence which leads from the start node to the goal node.
o Optimal Solution: If a solution has the lowest cost among all solutions.
Following are the four essential properties of search algorithms to compare the efficiency of these
algorithms:
Completeness: A search algorithm is said to be complete if it guarantees to return a solution if at least any
solution exists for any random input.
Time Complexity: Time complexity is a measure of time for an algorithm to complete its task.
Space Complexity: It is the maximum storage space required at any point during the search, as the
complexity of the problem.
Based on the search problems we can classify the search algorithms into uninformed (Blind search)
search and informed search (Heuristic 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
o Breadth-first search
o Uniform cost search
o Depth-first search
o Iterative deepening depth-first search
o 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.
1. Greedy Search
2. A* Search
Uninformed search is a class of general-purpose search algorithms which operates in brute force-way.
Uninformed search algorithms do not have additional information about state or search space other than how
to traverse the tree, so it is also called blind search.
1. Breadth-first Search
2. Depth-first Search
3. Depth-limited Search
1. Breadth-first Search:
o Breadth-first search is the most common search strategy for traversing a tree or graph. This algorithm
searches breadthwise in a tree or graph, so it is called breadth-first search.
o BFS algorithm starts searching from the root node of the tree and expands all successor node at the
current level before moving to nodes of next level.
o The breadth-first search algorithm is an example of a general-graph search algorithm.
o Breadth-first search implemented using FIFO queue data structure.
Advantages:
Disadvantages:
o t requires lots of memory since each level of the tree must be saved into memory to expand the next
level.
o BFS needs lots of time if the solution is far away from the root node.
Example:
In the below tree structure, we have shown the traversing of the tree using BFS algorithm from the root node
S to goal node K. BFS search algorithm traverse in layers, so it will follow the path which is shown by the
dotted arrow, and the traversed path will be:
1. S---> A--->B---->C--->D---->G--->H--->E---->F---->I---->K
Space Complexity: Space complexity of BFS algorithm is given by the Memory size of frontier which is
O(bd).
Completeness: BFS is complete, which means if the shallowest goal node is at some finite depth, then BFS
will find a solution.
Optimality: BFS is optimal if path cost is a non-decreasing function of the depth of the node.
2. Depth-first Search
o Depth-first search isa recursive algorithm for traversing a tree or graph data structure.
o 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.
o DFS uses a stack data structure for its implementation.
Note: Backtracking is an algorithm technique for finding all possible solutions using recursion.
Advantage:
o 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.
o It takes less time to reach to the goal node than BFS algorithm (if it traverses in the right path).
Disadvantage:
o There is the possibility that many states keep re-occurring, and there is no guarantee of finding the
solution.
o DFS algorithm goes for deep down searching and sometime it may go to the infinite loop.
Example:
In the below search tree, we have shown the flow of depth-first search, and it will follow the order as:
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.
Time Complexity: Time complexity of DFS will be equivalent to the node traversed by the algorithm. It is
given by:
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.
A depth-limited search algorithm is similar to depth-first search with a predetermined limit. Depth-limited
search can solve the drawback of the infinite path in the Depth-first search. In this algorithm, the node at the
depth limit will treat as it has no successor nodes further.
o Standard failure value: It indicates that problem does not have any solution.
o Cutoff failure value: It defines no solution for the problem within a given depth limit.
Advantages:
Disadvantages:
Example:
ADVERTISEMENT
Optimal: Depth-limited search can be viewed as a special case of DFS, and it is also not optimal even if
ℓ>d.
Uniform-cost search is a searching algorithm used for traversing a weighted tree or graph. This algorithm
comes into play when a different cost is available for each edge. The primary goal of the uniform-cost search
is to find a path to the goal node which has the lowest cumulative cost. Uniform-cost search expands nodes
according to their path costs form the root node. It can be used to solve any graph/tree where the optimal
cost is in demand. A uniform-cost search algorithm is implemented by the priority queue. It gives maximum
priority to the lowest cumulative cost. Uniform cost search is equivalent to BFS algorithm if the path cost of
all edges is the same.
Advantages:
Disadvantages:
o It does not care about the number of steps involve in searching and only concerned about path cost.
Due to which this algorithm may be stuck in an infinite loop.
Example:
Completeness:
Uniform-cost search is complete, such as if there is a solution, UCS will find it.
Time Complexity:
Let C* is Cost of the optimal solution, and ε is each step to get closer to the goal node. Then the number of
steps is = C*/ε+1. Here we have taken +1, as we start from state 0 and end to C*/ε.
Space Complexity:
Optimal:
Uniform-cost search is always optimal as it only selects a path with the lowest path cost.
The iterative deepening algorithm is a combination of DFS and BFS algorithms. This search algorithm finds
out the best depth limit and does it by gradually increasing the limit until a goal is found.
This algorithm performs depth-first search up to a certain "depth limit", and it keeps increasing the depth
limit after each iteration until the goal node is found.
This Search algorithm combines the benefits of Breadth-first search's fast search and depth-first search's
memory efficiency.
The iterative search algorithm is useful uninformed search when search space is large, and depth of goal
node is unknown.
Advantages:
o Itcombines the benefits of BFS and DFS search algorithm in terms of fast search and memory
efficiency.
Disadvantages:
o The main drawback of IDDFS is that it repeats all the work of the previous phase.
Example:
Following tree structure is showing the iterative deepening depth-first search. IDDFS algorithm performs
various iterations until it does not find the goal node. The iteration performed by the algorithm is given as:
2'nd Iteration----> A, B, C
3'rd Iteration------>A, B, D, E, C, F, G
4'th Iteration------>A, B, D, H, I, E, C, F, K, G
In the fourth iteration, the algorithm will find the goal node.Completeness:
Time Complexity:
Let's suppose b is the branching factor and depth is d then the worst-case time complexity is O(bd).
Space Complexity:
Optimal:
Bidirectional search algorithm runs two simultaneous searches, one form initial state called as forward-
search and other from goal node called as backward-search, to find the goal node. Bidirectional search
replaces one single search graph with two small subgraphs in which one starts the search from an initial
vertex and other starts from goal vertex. The search stops when these two graphs intersect each other.
Bidirectional search can use search techniques such as BFS, DFS, DLS, etc.
Advantages:
Disadvantages:
Example:
In the below search tree, bidirectional search algorithm is applied. This algorithm divides one graph/tree into
two sub-graphs. It starts traversing from node 1 in the forward direction and starts from goal node 16 in the
backward direction.
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
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 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:
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, i.e.
1. f(n)= g(n).
Advantages:
o Best first search can switch between BFS and DFS by gaining the advantages of both the algorithms.
o This algorithm is more efficient than BFS and DFS algorithms.
Disadvantages:
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.
Hence the final solution path will be: S----> B----->F----> GTime 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(b m). 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.
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:
Step 2: Check if the OPEN list is empty or not, if the list is empty then return failure and stops.
tep 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.
Advantages:
Disadvantages:
o It does not always produce the shortest path as it mostly based on heuristics and approximation.
o A* search algorithm has some complexity issues.
o 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.
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.
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:
o A* algorithm returns the path which occurred first, and it does not search for all remaining paths.
o The efficiency of A* algorithm depends on the quality of heuristic.
o A* algorithm expands all nodes which satisfy the condition f(n)<="" li="">
o 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.
o 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.
o 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.
o 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.
o It is also called greedy local search as it only looks to its good immediate neighbor state and not
beyond that.
o A node of hill climbing algorithm has two components which are state and value.
o Hill Climbing is mostly used when a good heuristic is available.
o In this algorithm, we don't need to maintain and handle the search tree or graph as it only keeps a
single current state.
o 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.
o Greedy approach: Hill-climbing algorithm search moves in the direction which optimizes the cost.
o No backtracking: It does not backtrack the search space, as it does not remember the previous
states.
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.
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.
Flat local maximum: It is a flat space in the landscape where all the neighbor states of current states have
the same value.
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:
o Step 1: Evaluate the initial state, if it is goal state then return success and Stop.
o Step 2: Loop Until a solution is found or there is no new operator left to apply.
o Step 3: Select and apply an operator to the current state.
o Step 4: Check new state:
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
o Step 1: Evaluate the initial state, if it is goal state then return success and stop, else make current
state as initial state.
o Step 2: Loop until a solution is found or the current state does not change.
a. Let SUCC be a state such that any successor of the current state will be better than it.
b. For each operator that applies to the current state:
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.
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.
Solution: With the use of bidirectional search, or by moving in different directions, we can improve this
problem.
Simulated Annealing:
A hill-climbing algorithm which never makes a move towards a lower value guaranteed to be incomplete
because it can get stuck on a local maximum. And if algorithm applies a random walk, by moving a
successor, then it may complete but not efficient. Simulated Annealing is an algorithm which yields both
efficiency and completeness.
In mechanical term Annealing is a process of hardening a metal or glass to a high temperature then cooling
gradually, so this allows the metal to reach a low-energy crystalline state. The same process is used in
simulated annealing in which the algorithm picks a random move, instead of picking the best move. If the
random move improves the state, then it follows the same path. Otherwise, the algorithm follows the path
which has a probability of less than 1 or it moves downhill and chooses another path.
1. Belief-State Planning:
Belief-state planning treats the agent's uncertainty about the environment as a probability distribution
over possible states, known as the belief state.
Instead of planning in the space of individual states, the agent plans in the space of belief states,
where each belief state represents a probability distribution over possible states given the agent's
observations and actions.
Planning algorithms such as partially observable Markov decision processes (POMDPs) and its
variants are commonly used for belief-state planning in partially observable environments.
2. Online Search Algorithms:
Online search algorithms, such as real-time heuristic search algorithms, are designed to handle partial
observability by incrementally exploring the search space while updating beliefs based on
observations.
These algorithms use heuristic evaluation functions to guide the search process and prioritize actions
that are likely to lead to informative observations or reduce uncertainty.
Examples of online search algorithms include Real-Time Dynamic Programming (RTDP), Monte
Carlo Tree Search (MCTS), and Online POMDP Solvers.
3. Particle Filtering:
Particle filtering, also known as Sequential Monte Carlo (SMC) methods, is a technique for
approximating the belief state by representing it as a set of weighted particles or samples.
Particle filtering algorithms propagate particles through the state space based on the agent's actions
and observations, updating their weights to reflect the likelihood of each particle given the
observations.
By maintaining a set of particles that represent the belief state, particle filtering enables efficient
approximation of the true belief state in partially observable environments.
4. Information-Gathering Strategies:
In partially observable environments, it is crucial for the agent to gather information that reduces
uncertainty and improves its understanding of the environment.
Information-gathering strategies aim to select actions that maximize the expected information gain or
reduce the entropy of the belief state.
Techniques such as information-theoretic planning, active learning, and Bayesian experimental
design can be used to design effective information-gathering policies.
5. Memory and State Estimation:
In some cases, the agent may use memory or internal state estimation to maintain a history of past
observations and actions, which can be used to infer the current state of the environment.
Techniques such as Kalman filtering, Hidden Markov Models (HMMs), and Recurrent Neural
Networks (RNNs) can be employed to estimate the current state based on past observations and
actions.
Searching in partially observable environments requires sophisticated techniques that can handle uncertainty
and ambiguity in the agent's observations and beliefs. By employing methods such as belief-state planning,
online search algorithms, particle filtering, information-gathering strategies, and memory-based approaches,
agents can effectively navigate and make decisions in partially observable environments.
UNIT II
Adversarial Search
Adversarial search is a search, where we examine the problem which arises when we try to plan ahead
of the world and other agents are planning against us.
o In previous topics, we have studied the search strategies which are only associated with a single
agent that aims to find the solution which often expressed in the form of a sequence of actions.
o But, there might be some situations where more than one agent is searching for the solution in the
same search space, and this situation usually occurs in game playing.
o The environment with more than one agent is termed as multi-agent environment, in which each
agent is an opponent of other agent and playing against each other. Each agent needs to consider the
action of other agent and effect of that action on their performance.
o So, Searches in which two or more players with conflicting goals are trying to explore the same
search space for the solution, are called adversarial searches, often known as Games.
o Games are modeled as a Search problem and heuristic evaluation function, and these are the two
main factors which help to model and solve games in AI.
Imperfect information Battleships, blind, tic-tac-toe Bridge, poker, scrabble, nuclear war
o Perfect information: A game with the perfect information is that in which agents can look into the
complete board. Agents have all the information about the game, and they can see each other moves
also. Examples are Chess, Checkers, Go, etc.
o Imperfect information: If in a game agents do not have all information about the game and not
aware with what's going on, such type of games are called the game with imperfect information, such
as tic-tac-toe, Battleship, blind, Bridge, etc.
o Deterministic games: Deterministic games are those games which follow a strict pattern and set of
rules for the games, and there is no randomness associated with them. Examples are chess, Checkers,
Go, tic-tac-toe, etc.
o Non-deterministic games: Non-deterministic are those games which have various unpredictable
events and has a factor of chance or luck. This factor of chance or luck is introduced by either dice or
cards. These are random, and each action response is not fixed. Such games are also called as
stochastic games.
Example: Backgammon, Monopoly, Poker, etc.
Note: In this topic, we will discuss deterministic games, fully observable environment, zero-sum, and where
each agent acts alternatively.
Zero-Sum Game
o What to do.
o How to decide the move
o Needs to think about his opponent as well
o The opponent also thinks what to do
Each of the players is trying to find out the response of his opponent to their actions. This requires embedded
thinking or backward reasoning to solve the game problems in AI.
A game can be defined as a type of search in AI which can be formalized of the following elements:
Game tree:
A game tree is a tree where nodes of the tree are the game states and Edges of the tree are the moves by
players. Game tree involves initial state, actions function, and result Function.
The following figure is showing part of the game-tree for tic-tac-toe game. Following are some key points of
the game:
Example Explanation:
o From the initial state, MAX has 9 possible moves as he starts first. MAX place x and MIN place o,
and both player plays alternatively until we reach a leaf node where one player has three in a row or
all squares are filled.
o Both players will compute each node, minimax, the minimax value which is the best achievable
utility against an optimal adversary.
o Suppose both the players are well aware of the tic-tac-toe and playing the best play. Each player is
doing his best to prevent another one from winning. MIN is acting against Max in the game.
o It aims to find the optimal strategy for MAX to win the game.
o It follows the approach of Depth-first search.
o In the game tree, optimal leaf node could appear at any depth of the tree.
o Propagate the minimax values up to the tree until the terminal node discovered.
In a given game tree, the optimal strategy can be determined from the minimax value of each node, which
can be written as MINIMAX(n). MAX prefer to move to a state of maximum value and MIN prefer to move
to a state of minimum value then:
Initial call:
Minimax(node, 3, true)
Step-1: In the first step, the algorithm generates the entire game-tree and apply the utility function to get the
utility values for the terminal states. In the below tree diagram, let's take A is the initial state of the tree.
Suppose maximizer takes first turn which has worst-case initial value =- infinity, and minimizer will take
next turn which has worst-case initial value = +infinity.
Step 2: Now, first we find the utilities value for the Maximizer, its initial value is -∞, so we will compare
each value in terminal state with initial value of Maximizer and determines the higher nodes values. It will
find the maximum among the all.
Step 3: In the next step, it's a turn for minimizer, so it will compare all nodes value with +∞, and will find
the 3rd layer node values.
o Complete- Min-Max algorithm is Complete. It will definitely find a solution (if exist), in the finite
search tree.
o Optimal- Min-Max algorithm is optimal if both opponents are playing optimally.
o Time complexity- As it performs DFS for the game-tree, so the time complexity of Min-Max
algorithm is O(bm), where b is branching factor of the game-tree, and m is the maximum depth of the
tree.
o Space Complexity- Space complexity of Mini-max algorithm is also similar to DFS which
is O(bm).
The main drawback of the minimax algorithm is that it gets really slow for complex games such as Chess,
go, etc. This type of games has a huge branching factor, and the player has lots of choices to decide.
Alpha-Beta Pruning
a. Alpha: The best (highest-value) choice we have found so far at any point along the path of
Maximizer. The initial value of alpha is -∞.
Note: To better understand this topic, kindly study the minimax algorithm.
1. α>=β
Let's take an example of two-player search tree to understand the working of Alpha-beta pruning
Step 1: At the first step the, Max player will start first move from node A where α= -∞ and β= +∞, these
value of alpha and beta passed down to node B where again α= -∞ and β= +∞, and Node B passes the same
value to its child D.
Step 2: At Node D, the value of α will be calculated as its turn for Max. The value of α is compared with
firstly 2 and then 3, and the max (2, 3) = 3 will be the value of α at node D and node value will also 3.
ADVERTISEMENT
In the next step, algorithm traverse the next successor of Node B which is node E, and the values of α= -∞,
and β= 3 will also be passed.
Step 4: At node E, Max will take its turn, and the value of alpha will change. The current value of alpha will
be compared with 5, so max (-∞, 5) = 5, hence at node E α= 5 and β= 3, where α>=β, so the right successor
of E will be pruned, and algorithm will not traverse it, and the value at node E will be 5.
At node C, α=3 and β= +∞, and the same values will be passed on to node F.
Step 6: At node F, again the value of α will be compared with left child which is 0, and max(3,0)= 3, and
then compared with right child which is 1, and max(3,1)= 3 still α remains 3, but the node value of F will
become 1.
Step 7: Node F returns the node value 1 to node C, at C α= 3 and β= +∞, here the value of beta will be
changed, it will compare with 1 so min (∞, 1) = 1. Now at C, α=3 and β= 1, and again it satisfies the
condition α>=β, so the next child of C which is G will be pruned, and the algorithm will not compute the
entire sub-tree G.
The effectiveness of alpha-beta pruning is highly dependent on the order in which each node is examined.
Move order is an important aspect of alpha-beta pruning.
o Worst ordering: In some cases, alpha-beta pruning algorithm does not prune any of the leaves of the
tree, and works exactly as minimax algorithm. In this case, it also consumes more time because of
alpha-beta factors, such a move of pruning is called worst ordering. In this case, the best move occurs
on the right side of the tree. The time complexity for such an order is O(bm).
o Ideal ordering: The ideal ordering for alpha-beta pruning occurs when lots of pruning happens in
the tree, and best moves occur at the left side of the tree. We apply DFS hence it first search left of
the tree and go deep twice as minimax algorithm in the same amount of time. Complexity in ideal
ordering is O(bm/2).
o
o We have encountered a wide variety of methods, including adversarial search and instant search, to
address various issues. Every method for issue has a single purpose in mind: to locate a remedy that
will enable that achievement of the objective. However there were no restrictions just on bots'
capability to resolve issues as well as arrive at responses in adversarial search and local search,
respectively.
o These section examines the constraint optimization methodology, another form or real concern
method. By its name, constraints fulfilment implies that such an issue must be solved while adhering
to a set of restrictions or guidelines.
o Whenever a problem is actually variables comply with stringent conditions of principles, it is said to
have been addressed using the solving multi - objective method. Wow what a method results in a
study sought to achieve of the intricacy and organization of both the issue.
In constraint satisfaction, domains are the areas wherein parameters were located after the restrictions that
are particular to the task. Those three components make up a constraint satisfaction technique in its entirety.
The pair "scope, rel" makes up the number of something like the requirement. The scope is a tuple of
variables that contribute to the restriction, as well as rel is indeed a relationship that contains a list of
possible solutions for the parameters should assume in order to meet the restrictions of something like the
issue.
o States area
o fundamental idea while behind remedy.
The definition of a state in phase space involves giving values to any or all of the parameters, like as
1. Consistent or Legal Assignment: A task is referred to as consistent or legal if it complies with all
laws and regulations.
2. Complete Assignment: An assignment in which each variable has a number associated to it and that
the CSP solution is continuous. One such task is referred to as a completed task.
3. A partial assignment is one that just gives some of the variables values. Projects of this nature are
referred to as incomplete assignment.
The parameters utilize one of the two types of domains listed below:
o Discrete Domain: This limitless area allows for the existence of a single state with numerous
variables. For instance, every parameter may receive a endless number of beginning states.
o It is a finite domain with continous phases that really can describe just one area for just one particular
variable. Another name for it is constant area.
Basically, there are three different categories of limitations in regard towards the parameters:
o Unary restrictions are the easiest kind of restrictions because they only limit the value of one
variable.
o Binary resource limits: These restrictions connect two parameters. A value between x1 and x3 can be
found in a variable named x2.
o Global Resource limits: This kind of restriction includes a unrestricted amount of variables.
o In linear programming, when every parameter carrying an integer value only occurs in linear
equation, linear constraints are frequently utilised.
o Non-linear Constraints: With non-linear programming, when each variable (an integer value) exists
in a non-linear form, several types of restrictions were utilised.
Note: The preferences restriction is a unique restriction that operates in the actual world.
Think of a Sudoku puzzle where some of the squares have initial fills of certain integers.
You must complete the empty squares with numbers between 1 and 9, making sure that no rows, columns, or
blocks contains a recurring integer of any kind. This solving multi - objective issue is pretty elementary. A
problem must be solved while taking certain limitations into consideration.
The integer range (1-9) that really can occupy the other spaces is referred to as a domain, while the empty
spaces themselves were referred as variables. The values of the variables are drawn first from realm.
Constraints are the rules that determine how a variable will select the scope.
Backtracking search is a fundamental algorithm used to solve Constraint Satisfaction Problems (CSPs),
where the goal is to find a solution that satisfies a set of constraints. CSPs are typically represented by a set
of variables, each with a domain of possible values, and a set of constraints that specify allowable
combinations of values for the variables.
1. Variable Assignment: The algorithm begins by selecting an unassigned variable from the set of variables in
the CSP. This variable will be assigned a value from its domain.
2. Value Selection: Once a variable is selected, the algorithm chooses a value from its domain to assign to that
variable. The value selection can be done in various ways, such as selecting the least-constrained value (the
value that rules out the fewest options for other variables) or using heuristics like the Minimum Remaining
Values (MRV) heuristic.
3. Consistency Checking: After selecting a value for the variable, the algorithm checks whether this
assignment violates any constraints. If the assignment is consistent with the constraints, the algorithm
proceeds to the next variable. Otherwise, it backtracks and tries a different value for the current variable.
4. Backtracking: If the assignment leads to a dead-end (i.e., it violates a constraint and no consistent value can
be found for the variable), the algorithm backtracks to the most recent variable that still has untried values. It
then selects a different value for that variable and continues the search.
5. Termination: The algorithm continues this process of variable assignment, value selection, consistency
checking, and backtracking until either a solution is found (i.e., all variables are assigned values that satisfy
all constraints) or it exhausts all possible assignments without finding a solution.
Despite its simplicity, backtracking search is a powerful and widely used algorithm for solving CSPs and is
the basis for more sophisticated search algorithms used in AI and constraint programming. However, it can
suffer from inefficiency when dealing with large or complex problem instances, especially if the search
space is vast or heavily constrained.
1. Initial Solution: Local search starts with an initial assignment of values to variables, which may be
generated randomly or through some heuristic initialization.
2. Objective Function: Unlike backtracking, local search doesn't necessarily rely on checking constraints
explicitly. Instead, it uses an objective function (also called a cost function or evaluation function) that
quantifies the quality of a solution. This function measures how well the current assignment satisfies the
constraints or achieves the desired goal.
3. Neighborhood Exploration: Local search iteratively explores neighboring solutions by making small
modifications to the current solution. These modifications typically involve changing the value of one or
more variables. The neighborhood of a solution comprises all possible solutions that can be obtained by
making one such modification.
4. Move Selection: At each iteration, local search selects a move that improves the objective function the most
among the neighboring solutions. This move is chosen based on a heuristic strategy, such as selecting the
first improving move encountered or selecting the move that results in the largest improvement.
5. Termination Criteria: Local search continues iterating through the neighborhood, making moves that
improve the objective function, until a termination criterion is met. Common termination criteria include
reaching a maximum number of iterations, reaching a predefined threshold for the objective function, or
running out of time.
6. Result Analysis: Once the algorithm terminates, the final solution or the best solution encountered during
the search is returned. Depending on the problem and the specific local search algorithm used, this solution
may not be optimal, but it is typically acceptable if it meets the desired criteria within the given constraints.
Examples of local search algorithms for CSPs include Hill Climbing, Simulated Annealing, Genetic
Algorithms, and Tabu Search. Each of these algorithms employs different strategies for exploring the
solution space and selecting moves, making them suitable for different types of problems and objectives.
First-Order logic:
a. Syntax
b. Semantics
The syntax of FOL determines which collection of symbols is a logical expression in first-order logic. The
basic syntactic elements of first-order logic are symbols. We write statements in short-hand notation in FOL.
Variables x, y, z, a, b,....
Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==
Quantifier ∀, ∃
Atomic sentences:
o Atomic sentences are the most basic sentences of first-order logic. These sentences are formed from a
predicate symbol followed by a parenthesis with a sequence of terms.
o We can represent atomic sentences as Predicate (term1, term2, ......, term n).
Complex Sentences:
Consider the statement: "x is an integer.", it consists of two parts, the first part x is the subject of the
statement and second part "is an integer," is known as a predicate.
o A quantifier is a language element which generates quantification, and quantification specifies the
quantity of specimen in the universe of discourse.
o These are the symbols that permit to determine or identify the range and scope of the variable in the
logical expression. There are two types of quantifier:
Universal Quantifier:
Universal quantifier is a symbol of logical representation, which specifies that the statement within its range
is true for everything or every instance of a particular thing.
o For all x
o For each x
o For every x.
Example:
Let a variable x which refers to a cat so all x can be represented in UOD as below:
It will be read as: There are all x where x is a man who drink coffee.
Existential Quantifier:
Existential quantifiers are the type of quantifiers, which express that the statement within its scope is true for
at least one instance of something.
It is denoted by the logical operator ∃, which resembles as inverted E. When it is used with a predicate
variable then it is called as an existential quantifier.
If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:
Example:
It will be read as: There are some x where x is a boy who is intelligent.
Inference in First-Order Logic is used to deduce new facts or sentences from existing sentences. Before
understanding the FOL inference rule, let's understand some basic terminologies used in FOL.
Substitution:
Substitution is a fundamental operation performed on terms and formulas. It occurs in all inference systems
in first-order logic. The substitution is complex in the presence of quantifiers in FOL. If we write F[a/x], so
it refers to substitute a constant "a" in place of variable "x".
Note: First-order logic is capable of expressing facts about some or all objects in the universe.
First-Order logic does not only use predicate and terms for making atomic sentences but also uses another
way, which is equality in FOL. For this, we can use equality symbols which specify that the two terms refer
to the same object.
As propositional logic we also have inference rules in first-order logic, so following are some basic inference
rules in FOL:
o Universal Generalization
o Universal Instantiation
o Existential Instantiation
o Existential introduction
1. Universal Generalization:
Universal generalization is a valid inference rule which states that if premise P(c) is true for any
arbitrary element c in the universe of discourse, then we can have a conclusion as ∀ x P(x).
o
Example: Let's represent, P(c): "A byte contains 8 bits", so for ∀ x P(x) "All bytes contain 8 bits.", it will
also be true.
2. Universal Instantiation:
o Universal instantiation is also called as universal elimination or UI is a valid inference rule. It can be
applied multiple times to add new sentences.
o The new KB is logically equivalent to the previous KB.
o As per UI, we can infer any sentence obtained by substituting a ground term for the variable.
The UI rule state that we can infer any sentence P(c) by substituting a ground term c (a constant
within domain x) from ∀ x P(x) for any object in the universe of discourse.
o
Example:1.
Example: 2.
"All kings who are greedy are Evil." So let our knowledge base contains this detail as in the form of FOL:
So from this information, we can infer any of the following statements using Universal Instantiation:
3. Existential Instantiation:
o Existential instantiation is also called as Existential Elimination, which is a valid inference rule in
first-order logic.
o It can be applied only once to replace the existential sentence.
o The new KB is not logically equivalent to old KB, but it will be satisfiable if old KB was satisfiable.
o This rule states that one can infer P(c) from the formula given in the form of ∃x P(x) for a new
constant symbol c.
o The restriction with this rule is that c used in the rule must be a new term for which P(c ) is true.
Example:
4. Existential introduction
For the inference process in FOL, we have a single inference rule which is called Generalized Modus
Ponens. It is lifted version of Modus ponens.
Generalized Modus Ponens can be summarized as, " P implies Q and P is asserted to be true, therefore Q
must be True."
According to Modus Ponens, for atomic sentences pi, pi', q. Where there is a substitution θ such that
SUBST (θ, pi',) = SUBST(θ, pi), it can be represented as:
Predicate Logic in AI
Predicate logic, also known as first-order logic, is a formal language used in
artificial intelligence and logic-based systems to represent and reason about knowledge and relationships
in a structured and precise manner. Predicate logic extends propositional logic by introducing variables,
quantifiers, and predicates, enabling more expressive and flexible representations of knowledge. Here's an
overview of predicate logic in AI:
Quantifiers, such as ∀ (universal quantifier) and ∃ (existential quantifier), specify the scope of
Predicates represent relationships or properties that hold between objects.
For example, statements such as "All humans are mortal" can be represented as ∀x (Human(x) →
variables, and quantifiers.
Mortal(x)), where Human(x) and Mortal(x) are predicates representing the properties of being human
and mortal, respectively.
4. Inference and Reasoning:
Inference and reasoning in predicate logic involve deriving new logical conclusions from existing
knowledge and logical rules.
Deductive reasoning techniques, such as resolution and natural deduction, can be used to derive
logical consequences from a set of logical axioms and inference rules.
Automated theorem proving systems and logic programming languages, such as Prolog, implement
inference mechanisms for predicate logic, allowing for automated reasoning and problem-solving.
5. Applications:
Predicate logic is used in various AI applications, including expert systems, natural language
processing, knowledge-based systems, automated reasoning, planning, and robotics.
In expert systems, predicate logic is employed for representing domain knowledge and making
logical deductions and inferences based on the encoded knowledge.
In natural language processing, predicate logic can be used to parse and interpret the meaning of
natural language sentences and queries, enabling systems to understand and reason about textual
information.
Humans are best at understanding, reasoning, and interpreting knowledge. Human knows things, which
is knowledge and as per their knowledge they perform various actions in the real world. But how machines
do all these things comes under knowledge representation and reasoning. Hence we can describe
Knowledge representation as following:
o Knowledge representation and reasoning (KR, KRR) is the part of Artificial intelligence which
concerned with AI agents thinking and how thinking contributes to intelligent behavior of agents.
o It is responsible for representing information about the real world so that a computer can understand
and can utilize this knowledge to solve the complex real world problems such as diagnosis a medical
condition or communicating with humans in natural language.
o It is also a way which describes how we can represent knowledge in artificial intelligence.
Knowledge representation is not just storing data into some database, but it also enables an intelligent
machine to learn from that knowledge and experiences so that it can behave intelligently like a
human.
What to Represent:
o Object: All the facts about objects in our world domain. E.g., Guitars contains strings, trumpets are
brass instruments.
o Events: Events are the actions which occur in our world.
o Performance: It describe behavior which involves knowledge about how to do things.
o Meta-knowledge: It is knowledge about what we know.
o Facts: Facts are the truths about the real world and what we represent.
o Knowledge-Base: The central component of the knowledge-based agents is the knowledge base. It is
represented as KB. The Knowledgebase is a group of the Sentences (Here, sentences are used as a
technical term and not identical with the English language).
Types of knowledge
1. Declarative Knowledge:
2. Procedural Knowledge
3. Meta-knowledge:
4. Heuristic knowledge:
5. Structural knowledge:
Knowledge of real-worlds plays a vital role in intelligence and same for creating artificial intelligence.
Knowledge plays an important role in demonstrating intelligent behavior in AI agents. An agent is only able
to accurately act on some input when he has some knowledge or experience about that input.
Let's suppose if you met some person who is speaking in a language which you don't know, then how you
will able to act on that. The same thing applies to the intelligent behavior of the agents.
As we can see in below diagram, there is one decision maker which act by sensing the environment and
using knowledge. But if the knowledge part will not present then, it cannot display intelligent behavior.
An Artificial intelligence system has the following components for displaying intelligent behavior:
o Perception
o Learning
o Knowledge Representation and Reasoning
o Planning
o Execution
The above diagram is showing how an AI system can interact with the real world and what components help
it to show intelligence. AI system has Perception component by which it retrieves information from its
environment. It can be visual, audio or another form of sensory input. The learning component is responsible
There are mainly four approaches to knowledge representation, which are givenbelow:
o It is the simplest way of storing facts which uses the relational method, and each fact about a set of
the object is set out systematically in columns.
o This approach of knowledge representation is famous in database systems where the relationship
between different entities is represented.
o This approach has little opportunity for inference.
Player1 65 23
Player2 58 18
Player3 75 24
2. Inheritable knowledge:
o In the inheritable knowledge approach, all data must be stored into a hierarchy of classes.
o All classes should be arranged in a generalized form or a hierarchal manner.
o In this approach, we apply inheritance property.
o Elements inherit values from other members of a class.
o This approach contains inheritable knowledge which shows a relation between instance and class,
and it is called instance relation.
o Every individual frame can represent the collection of attributes and its value.
o In this approach, objects and values are represented in Boxed nodes.
3. Inferential knowledge:
a. Marcus is a man
b. All men are mortal
Then it can represent as;
man(Marcus)
∀x = man (x) ----------> mortal (x)s
4. Procedural knowledge:
1. Representational Accuracy:
KR system should have the ability to represent all kind of required knowledge.
2. Inferential Adequacy:
KR system should have ability to manipulate the representational structures to produce new
knowledge corresponding to existing structure.
3. Inferential Efficiency:
The ability to direct the inferential knowledge mechanism into the most productive directions by
storing appropriate guides.
4. Acquisitional efficiency- The ability to acquire the new knowledge easily using automatic methods.
There are mainly four ways of knowledge representation which are given as follows:
1. Logical Representation
2. Semantic Network Representation
3. Frame Representation
4. Production Rules
Logical representation is a language with some concrete rules which deals with propositions and has no
ambiguity in representation. Logical representation means drawing a conclusion based on various conditions.
This representation lays down some important communication rules. It consists of precisely defined syntax
and semantics which supports the sound inference. Each sentence can be translated into logics using syntax
and semantics.
Syntax:
o Syntaxes are the rules which decide how we can construct legal sentences in the logic.
o It determines which symbol we can use in knowledge representation.
o How to write those symbols.
Semantics:
o Semantics are the rules by which we can interpret the sentence in the logic.
o Semantic also involves assigning a meaning to each sentence.
Note: We will discuss Prepositional Logics and Predicate logics in later chapters.
1. Logical representations have some restrictions and are challenging to work with.
2. Logical representation technique may not be very natural, and inference may not be so efficient.
Note: Do not be confused with logical representation and logical reasoning as logical representation is a
representation language and reasoning is a process of thinking logically.
Semantic networks are alternative of predicate logic for knowledge representation. In Semantic networks, we
can represent our knowledge in the form of graphical networks. This network consists of nodes representing
objects and arcs which describe the relationship between those objects. Semantic networks can categorize
the object in different forms and can also link those objects. Semantic networks are easy to understand and
can be easily extended.
ADVERTISEMENT
Example: Following are some statements which we need to represent in the form of nodes and arcs.
Statements:
a. Jerry is a cat.
b. Jerry is a mammal
In the above diagram, we have represented the different type of knowledge in the form of nodes and arcs.
Each object is connected with another object by some relation.
1. Semantic networks take more computational time at runtime as we need to traverse the complete
network tree to answer some questions. It might be possible in the worst case scenario that after
traversing the entire tree, we find that the solution does not exist in this network.
2. Semantic networks try to model human-like memory (Which has 1015 neurons and links) to store the
information, but in practice, it is not possible to build such a vast semantic network.
3. These types of representations are inadequate as they do not have any equivalent quantifier, e.g., for
all, for some, none, etc.
4. Semantic networks do not have any standard definition for the link names.
5. These networks are not intelligent and depend on the creator of the system.
3. Frame Representation
A frame is a record like structure which consists of a collection of attributes and its values to describe an
entity in the world. Frames are the AI data structure which divides knowledge into substructures by
representing stereotypes situations. It consists of a collection of slots and slot values. These slots may be of
any type and sizes. Slots have names and values which are called facets.
Facets: The various aspects of a slot is known as Facets. Facets are features of frames which enable us to
put constraints on the frames. Example: IF-NEEDED facts are called when data of any particular slot is
needed. A frame may consist of any number of slots, and a slot may include any number of facets and facets
may have any number of values. A frame is also known as slot-filter knowledge representation in artificial
intelligence.
Frames are derived from semantic networks and later evolved into our modern-day classes and objects. A
single frame is not much useful. Frames system consist of a collection of frames which are connected. In the
frame, knowledge about an object or event can be stored together in the knowledge base. The frame is a type
of technology which is widely used in various applications including Natural language processing and
machine visions.
Ontology engineering plays a crucial role in artificial intelligence (AI) by providing a structured framework
for organizing knowledge and representing the semantics of concepts within a domain. Here are some key
aspects of how ontology engineering contributes to AI:
Overall, ontology engineering plays a fundamental role in advancing AI capabilities, enabling machines to
acquire, represent, and utilize knowledge effectively across diverse domains and applications.
Categories and Objects –
Categories and objects are fundamental concepts in cognitive science, linguistics, philosophy, and artificial
intelligence. Let's delve into each:
1. Categories:
Definition: Categories are mental constructs that represent groups or classes of entities sharing
common features, properties, or characteristics. These groupings help individuals make sense of the
world by organizing information and facilitating cognitive processes such as perception, memory,
and reasoning.
Types of Categories:
Natural Categories: These are categories that arise from natural phenomena or common
experiences, such as animals, plants, and basic objects.
Artifact Categories: These categories consist of human-made objects, artifacts, or constructs,
such as tools, vehicles, and buildings.
Abstract Categories: These categories represent abstract concepts or ideas, such as love,
justice, and democracy.
Formation of Categories:
Prototype Theory: According to prototype theory, categories are represented by prototypical
examples that possess typical features of the category. For example, a robin might be
considered a prototypical example of a bird.
Exemplar Theory: Exemplar theory suggests that individuals categorize entities by
comparing them to specific instances or exemplars encountered in the past. This approach
emphasizes the role of memory and personal experiences in category formation.
In summary, categories and objects are fundamental concepts that play a crucial role in human cognition,
language, perception, and reasoning, as well as in artificial intelligence systems designed to simulate or
interact with the world.
1. Prototype-based Reasoning:
Description: Prototype-based reasoning models categorization by comparing entities to prototypical
examples or representations of each category. Entities are classified based on their similarity to these
prototypes.
Example: In a prototype-based system for animal categorization, a new animal is classified as a
"bird" if it shares many features with a prototypical bird (e.g., having wings, feathers, and the ability
to fly).
2. Exemplar-based Reasoning:
These reasoning systems for categories are used in various applications, including natural language
processing, computer vision, robotics, and expert systems, to enable machines to categorize and understand
the world in a manner similar to humans.
Planning -Definition -Algorithms
Planning:
Planning is a fundamental process in artificial intelligence and computer science, involving the generation of
a sequence of actions to achieve a specific goal in a given environment or domain. It aims to find a series of
steps or actions that will transform the current state of the world into a desired state, taking into account the
available resources, constraints, and objectives.
The task of the planner is to search through the space of possible action sequences to find a plan that leads
from the initial state to the goal state while satisfying any constraints and optimizing some criteria, such as
minimizing cost or maximizing utility.
Algorithms:
There are various algorithms and approaches to solve planning problems, each suited to different types of
domains and problem instances. Some common planning algorithms include:
These algorithms can be combined or adapted to suit specific planning domains and problem instances,
depending on factors such as problem complexity, resource constraints, and the availability of domain
knowledge. Additionally, advancements in AI, such as deep reinforcement learning and probabilistic
graphical models, have led to novel approaches for planning in complex, uncertain environments.
Heuristics for Planning
Heuristics play a crucial role in planning by guiding the search process towards promising regions of the
state space, thereby improving efficiency and effectiveness. Here are some common heuristics used in
planning:
1. Admissible Heuristics:
Definition: An admissible heuristic is a function that estimates the cost or distance from a given state
to the goal state, such that it never overestimates the true cost. Admissible heuristics ensure that the
search algorithm finds an optimal solution if one exists.
Examples:
Manhattan Distance: In grid-based domains, the Manhattan distance heuristic computes the
sum of the horizontal and vertical distances from the current state to the goal state. It is
admissible because it underestimates the true distance in grid worlds.
Relaxed Problem Heuristics: Heuristics derived from relaxing constraints or simplifying the
planning problem. For example, ignoring obstacles or considering simplified versions of the
problem can lead to admissible heuristics.
2. Consistent Heuristics:
Definition: A consistent (or monotonic) heuristic is a function that satisfies the triangle inequality,
ensuring that the estimated cost of reaching a successor state plus the estimated cost from that
successor to the goal state is never greater than the estimated cost from the current state to the goal
state.
Examples:
Straight-line Distance: In pathfinding problems, the straight-line distance heuristic computes
the Euclidean distance between the current state and the goal state. It is consistent because the
direct path between two states is always the shortest path.
Adaptive A Heuristic*: This heuristic dynamically adjusts its estimates based on the search
progress, maintaining consistency throughout the search process.
3. Dominance Heuristics:
Definition: Dominance heuristics compare the estimated costs of different states and preferentially
expand states with lower estimated costs. They aim to prioritize states that are likely to lead to the
goal more quickly.
These heuristics can be combined or tailored to specific planning domains and problem instances to improve
the efficiency and effectiveness of planning algorithms. However, selecting an appropriate heuristic requires
consideration of factors such as problem structure, computational resources, and the balance between
exploration and exploitation in the search process.
Hierarchical Planning
Hierarchical planning is a problem-solving approach that decomposes complex planning problems into a
hierarchy of smaller, more manageable subproblems. This hierarchical structure allows planners to focus on
different levels of abstraction and detail, enabling more efficient and scalable solutions to large and complex
planning tasks. Here's an overview of hierarchical planning:
1. Hierarchy Levels:
In hierarchical planning, the planning problem is divided into multiple levels of abstraction, with
each level representing a different aspect or perspective of the problem.
Typically, hierarchical planning involves at least two levels: a high-level or abstract level and a low-
level or detailed level. However, more levels can be added as needed to capture additional levels of
abstraction.
2. Abstraction and Decomposition:
At each level of the hierarchy, the planning problem is abstracted and decomposed into smaller
subproblems that are easier to solve.
Overall, hierarchical planning provides a structured and scalable approach to solving complex planning
problems by decomposing them into smaller, more manageable subproblems at different levels of
abstraction. It offers advantages in terms of scalability, modularity, flexibility, and efficiency, making it a
valuable technique for planning in diverse application domains.
UNIT-IV
1. Probability Theory:
Probability Distributions: Probability distributions are mathematical functions that assign
probabilities to different outcomes of a random variable. Common probability distributions include
the normal distribution, binomial distribution, and Poisson distribution.
Bayesian Inference: Bayesian inference is a statistical framework for updating beliefs or
probabilities about uncertain events based on prior knowledge and observed evidence. It provides a
principled approach to quantifying uncertainty and updating probabilities as new information
becomes available.
2. Fuzzy Logic:
Fuzzy Sets: Fuzzy logic is a mathematical framework for representing and reasoning with
uncertainty and imprecision. Fuzzy sets allow for partial membership, where elements can belong to
a set to varying degrees. Fuzzy logic enables modeling of uncertain and vague concepts, such as
"tall" or "hot," using linguistic variables and fuzzy rules.
3. Interval Analysis:
Interval Arithmetic: Interval analysis represents uncertainty by bounding the possible range of
values for a variable using intervals. Instead of precise values, variables are represented by intervals
that capture uncertainty about their true value. Interval arithmetic allows for rigorous computation
with uncertain quantities.
4. Monte Carlo Simulation:
Random Sampling: Monte Carlo simulation involves generating random samples from probability
distributions to estimate the behavior of complex systems or processes under uncertainty. By
simulating multiple scenarios with probabilistic inputs, Monte Carlo methods provide insights into
the range of possible outcomes and their likelihoods.
5. Decision Theory:
Expected Utility Theory: Decision theory provides a framework for making decisions under
uncertainty by quantifying the expected utility or value of different options. It combines probabilities
of outcomes with utility functions representing preferences to guide decision-making.
Risk Analysis: Risk analysis assesses the potential consequences and probabilities of uncertain
events to inform decision-making and risk management strategies. Techniques such as sensitivity
analysis, scenario analysis, and decision trees are commonly used in risk assessment.
6. Machine Learning:
These methods and techniques provide tools for quantifying uncertainty in diverse contexts, allowing
decision-makers to make informed choices, assess risks, and manage uncertainty effectively. Depending on
the application domain and the nature of uncertainty, different approaches may be appropriate for
representing and reasoning about uncertain events and variables.
Probabilistic Reasoning
Probabilistic reasoning is a framework for making inferences under uncertainty using probability theory. It
allows us to reason about uncertain events, predict future outcomes, and make decisions based on available
evidence and prior knowledge. Probabilistic reasoning is widely used in various fields, including artificial
intelligence, statistics, machine learning, economics, and decision theory. Here are some key concepts and
methods in probabilistic reasoning:
1. Bayesian Inference:
2. Bayesian Networks:
Bayesian networks (also known as belief networks or graphical models) are graphical representations
of probabilistic relationships among a set of variables. They consist of nodes representing variables
and directed edges representing probabilistic dependencies between variables.
Bayesian networks provide a compact and interpretable way to model complex probabilistic
relationships, allowing for efficient inference and reasoning about uncertain events.
Inference in Bayesian networks involves computing posterior probabilities of variables given
observed evidence using methods such as exact inference, approximate inference (e.g., sampling
methods), and inference by enumeration.
3. Markov Decision Processes (MDPs):
Markov decision processes are probabilistic models used to model sequential decision-making under
uncertainty. They consist of states, actions, transition probabilities, and rewards, and follow the
Markov property, where the future state depends only on the current state and action.
MDPs are commonly used in reinforcement learning, robotics, and operations research to model and
solve decision-making problems with uncertain outcomes and partial observability.
4. Hidden Markov Models (HMMs):
Hidden Markov models are probabilistic models used to model sequences of observations with
underlying hidden states. They consist of observable variables and hidden states connected by
transition probabilities and emission probabilities.
HMMs are widely used in speech recognition, natural language processing, bioinformatics, and time
series analysis to model and infer underlying patterns and states from observed data.
5. Probabilistic Graphical Models (PGMs):
Probabilistic graphical models are a general framework that encompasses Bayesian networks,
Markov networks, and other graphical models. They provide a unified representation for encoding
probabilistic dependencies among variables in complex systems.
PGMs allow for efficient inference, learning, and reasoning about uncertain events and dependencies
in large-scale problems.
Probabilistic reasoning provides a principled and flexible approach to modeling and reasoning under
uncertainty, allowing decision-makers to make informed choices, predict outcomes, and handle variability in
complex systems effectively. It forms the foundation for many advanced techniques in artificial intelligence,
machine learning, and decision analysis.
Probabilistic Reasoning over Time
Probabilistic reasoning over time provides a powerful framework for modeling, reasoning, and making
decisions in dynamic systems and sequential data. It enables understanding and prediction of temporal
1. Probabilistic Models:
In probabilistic programming, probabilistic models are represented using programming constructs
such as variables, functions, and control flow statements. These models can capture complex
probabilistic relationships among variables, including uncertainty, dependencies, and distributions.
2. Probabilistic Inference:
Probabilistic inference involves estimating the posterior distribution of unknown variables given
observed data and prior knowledge. In probabilistic programming, inference algorithms
automatically perform this task by analyzing the probabilistic model specified by the user.
Common inference algorithms used in probabilistic programming include Markov chain Monte Carlo
(MCMC) methods, variational inference, belief propagation, and symbolic inference.
3. Expressiveness and Flexibility:
Probabilistic programming languages provide a high level of expressiveness and flexibility, allowing
users to define complex probabilistic models using familiar programming constructs.
Users can easily specify probability distributions, conditional dependencies, and hierarchical
structures within their models, making it possible to represent a wide range of real-world phenomena
and problems.
4. Domain-Specific Languages (DSLs):
Many probabilistic programming frameworks provide domain-specific languages tailored to
probabilistic modeling and inference tasks. These DSLs offer specialized syntax, constructs, and
abstractions for expressing probabilistic models and performing inference efficiently.
Examples of probabilistic programming languages and frameworks include Stan, Pyro, Edward,
Church, and Infer.NET.
5. Applications:
Probabilistic programming finds applications in various domains, including machine learning,
artificial intelligence, statistics, robotics, finance, and healthcare.
It is used for tasks such as Bayesian inference, probabilistic modeling of data and processes,
Bayesian optimization, decision-making under uncertainty, probabilistic reasoning, and generative
modeling.
6. Probabilistic Programming Workflow:
The typical workflow in probabilistic programming involves the following steps:
Model Specification: Define a probabilistic model using the programming language's syntax
and constructs.
Inference: Use inference algorithms provided by the probabilistic programming framework to
estimate the posterior distribution of unknown variables given observed data.
Probabilistic programming provides a powerful and flexible framework for building and reasoning about
probabilistic models, enabling users to tackle complex problems involving uncertainty and incomplete
information. It bridges the gap between probabilistic modeling and traditional programming, making it
accessible to a wider range of users and applications.
Making Simple Decisions
Making simple decisions involves evaluating available options and choosing the one that best achieves a
desired outcome or goal. While the complexity of decision-making can vary depending on the context and
the number of available options, here are some general steps and considerations for making simple decisions:
By following these steps and considerations, individuals can make effective decisions even in relatively
simple situations. The key is to be systematic, deliberate, and thoughtful in evaluating options and selecting
the best course of action to achieve desired outcomes.
Making complex decisions requires a structured and systematic approach that considers multiple
perspectives, uncertainties, and trade-offs. By following these steps and leveraging appropriate decision-
making tools and techniques, individuals and organizations can navigate complexity and make sound
decisions that lead to positive outcomes.
Case Based Reasoning
Case-based reasoning (CBR) is a problem-solving paradigm that involves solving new problems by
retrieving and adapting solutions from previously solved similar cases. It is a knowledge-based approach that
relies on the principle of similarity: if a past problem or case is similar to the current problem, then the
solution or decision applied to the past case can be reused or adapted to solve the current problem. Here's
how CBR typically works:
1. Retrieve:
The CBR process begins by identifying and retrieving relevant cases from a case base or repository.
A case base consists of a collection of past cases, each comprising a description of the problem, the
solution applied, and the outcome.
Similarity measures are used to assess the similarity between the current problem and past cases in
the case base. Cases that are most similar to the current problem are retrieved for further analysis.
2. Reuse:
Once relevant cases are retrieved, the next step is to reuse the solutions or knowledge contained in
these cases to solve the current problem. The solution applied in the retrieved cases serves as a
starting point or template for solving the current problem.
By reusing past solutions, CBR can leverage existing knowledge and expertise to solve new
problems more efficiently and effectively.
3. Revise:
After retrieving a solution from past cases, the CBR system may need to revise or adapt the solution
to better fit the current problem context. This adaptation process involves modifying the retrieved
solution to account for differences between the current problem and the past cases.
Revision techniques may include adjusting parameters, refining constraints, or incorporating new
information to tailor the solution to the specific needs of the current problem.
4. Retain:
Case-based reasoning is widely used in various domains, including expert systems, decision support systems,
diagnostic systems, planning, design, and customer support. It offers a flexible and adaptive approach to
problem-solving, allowing systems to leverage past experience and knowledge to tackle new and unfamiliar
problems effectively.
Explanation-Based Learning
Explanation-based learning (EBL) is a machine learning paradigm that aims to improve learning efficiency
by utilizing explanations or justifications of past experiences to generalize knowledge and solve new
problems more effectively. EBL is inspired by human learning, where learners often extract general
principles or rules from specific examples or explanations provided by teachers or mentors. Here's how EBL
typically works:
Explanation-based learning has been applied in various domains, including natural language processing,
expert systems, robotics, diagnostic systems, and planning. It offers advantages such as improved learning
efficiency, interpretability of learned models, and the ability to leverage domain knowledge and expertise to
guide the learning process. However, EBL may also face challenges such as scalability, computational
complexity, and the need for rich, domain-specific explanations.
Evolutionary Computation
Evolutionary computation (EC) is a family of computational optimization algorithms inspired by principles
of biological evolution and natural selection. These algorithms mimic the process of evolution to solve
complex optimization problems by iteratively evolving a population of candidate solutions over multiple
generations. Evolutionary computation encompasses various techniques, including genetic algorithms,
genetic programming, evolutionary strategies, and evolutionary programming. Here's an overview of
evolutionary computation:
Evolutionary computation techniques have been applied in various domains, including engineering design,
robotics, financial modeling, data mining, scheduling, and bioinformatics. They offer advantages such as
robustness, flexibility, and the ability to handle complex, multimodal, and high-dimensional optimization
problems. However, the performance of evolutionary computation algorithms may depend on factors such as
problem representation, selection of parameters, and tuning of evolutionary operators.
UNIT V PHILOSOPHY, ETHICS AND SAFETY OF AI
Limits of AI
AI, while incredibly powerful, still has its limitations. Some of these limitations include:
1. Lack of common sense: AI systems often lack the innate understanding of the world that humans possess.
They may struggle with tasks that require common sense reasoning or understanding of context.
While AI continues to advance rapidly, addressing these limitations remains an ongoing area of research and
development. Efforts to overcome these challenges will be crucial for realizing the full potential of AI while
minimizing its risks and drawbacks
Knowledge in Learning
Knowledge plays a fundamental role in learning, both for humans and artificial intelligence systems. Here
are some key aspects of knowledge in learning:
1. Acquisition of Knowledge: Learning involves acquiring new knowledge or skills. This can occur through
various means such as direct instruction, observation, experience, or experimentation.
2. Representation of Knowledge: Knowledge can be represented in different forms depending on the context
and the capabilities of the learner. For humans, knowledge can be represented linguistically, visually,
spatially, or even through sensory experiences. In AI systems, knowledge is typically represented in
structured formats such as databases, symbolic logic, or neural network weights.
3. Integration of Knowledge: Learning often involves integrating new knowledge with existing knowledge.
Humans build upon their prior experiences and understanding when learning new concepts or skills.
Similarly, AI systems can benefit from transfer learning, where knowledge gained from one task or domain
is applied to another related task or domain.
4. Organization of Knowledge: Knowledge is often organized hierarchically or categorically, allowing for
efficient retrieval and utilization. For instance, in human learning, concepts are often organized into
taxonomies or schemas. AI systems may utilize knowledge graphs or ontologies to organize and structure
information.
5. Application of Knowledge: Learning is not just about acquiring knowledge but also about applying it
effectively to solve problems or achieve goals. Both humans and AI systems must be able to apply their
knowledge in various contexts and adapt it to different situations.
In both human and AI learning, the acquisition, representation, integration, organization, application, critical
evaluation, and meta-cognition of knowledge are crucial aspects that contribute to effective learning and
problem-solving.
Statistical Learning Methods
Statistical learning methods are a class of techniques used in machine learning and statistics to extract
patterns and relationships from data. These methods are based on statistical principles and aim to make
predictions or decisions based on observed data. Some common statistical learning methods include:
1. Linear Regression: Linear regression is a statistical method used for modeling the relationship between a
dependent variable and one or more independent variables. It assumes a linear relationship between the
variables and aims to find the best-fitting line that describes the relationship.
2. Logistic Regression: Logistic regression is a statistical technique used for modeling binary outcomes. It
estimates the probability that a given observation belongs to a particular category based on one or more
predictor variables. Despite its name, logistic regression is used for classification rather than regression
tasks.
3. Decision Trees: Decision trees are a non-parametric supervised learning method used for both classification
and regression tasks. They partition the feature space into regions based on the values of input variables and
make predictions by assigning the majority class or average value within each region.
4. Random Forests: Random forests are an ensemble learning method that builds multiple decision trees and
combines their predictions to improve accuracy and reduce overfitting. Each tree in the forest is trained on a
random subset of the training data and features.
5. Support Vector Machines (SVM): SVM is a supervised learning algorithm used for classification and
regression tasks. It constructs a hyperplane or set of hyperplanes in a high-dimensional space to separate data
points into different classes while maximizing the margin between them.
6. Naive Bayes Classifiers: Naive Bayes classifiers are probabilistic models based on Bayes' theorem with the
"naive" assumption of independence between features. Despite this simplifying assumption, they are often
surprisingly effective for classification tasks, especially in text classification and spam filtering.
7. K-Nearest Neighbors (KNN): KNN is a simple and intuitive classification algorithm that classifies data
points based on the majority class among their k nearest neighbors in the feature space. It is a non-parametric
method that does not make explicit assumptions about the underlying data distribution.
These are just a few examples of statistical learning methods, and there are many other techniques and
variations within this broad category. The choice of method depends on factors such as the nature of the
data, the problem domain, computational considerations, and the desired interpretability of the model.
Reinforcement Learning
1. Agent: The entity that learns and makes decisions in the environment. The agent takes actions based on its
current state and the feedback it receives from the environment.
2. Environment: The external system with which the agent interacts. The environment provides feedback to
the agent in the form of rewards or penalties based on the actions taken.
3. State: A representation of the current situation or configuration of the environment. The state provides the
necessary information for the agent to make decisions about which actions to take.
4. Action: The set of possible moves or decisions that the agent can take in a given state. The agent selects
actions based on its current state and its learned policy.
5. Reward: A scalar feedback signal provided by the environment to indicate the desirability of the agent's
actions. The goal of the agent is to maximize the cumulative reward over time.
6. Policy: A strategy or mapping from states to actions that guides the agent's decision-making process. The
policy can be deterministic or stochastic and may change over time as the agent learns.
7. Value Function: A function that estimates the expected cumulative reward of being in a particular state and
following a particular policy. Value functions help the agent evaluate the long-term consequences of its
actions.
8. Exploration vs. Exploitation: The trade-off between exploring new actions to learn more about the
environment and exploiting known actions to maximize immediate rewards. Balancing exploration and
exploitation is crucial for effective learning.
Reinforcement learning algorithms, such as Q-learning, SARSA, and Deep Q-Networks (DQN), are used to
train agents to make optimal decisions in various environments. RL has applications in a wide range of
domains, including robotics, game playing, autonomous driving, finance, and healthcare. It is particularly
well-suited for problems where explicit supervision or labeled data is scarce, and the agent must learn from
interaction with the environment.
Introduction to Machine Learning and Deep Learning
Machine Learning (ML) and Deep Learning (DL) are two subfields of artificial intelligence (AI) that focus
on enabling computers to learn from data and make decisions or predictions without being explicitly
programmed. Here's an introduction to both:
Definition: Machine learning is a subset of artificial intelligence that focuses on the development of
algorithms and techniques that allow computers to learn from and make predictions or decisions based on
data.
1. Data: ML algorithms require data to learn patterns and relationships. This data can be structured (e.g.,
tables, databases) or unstructured (e.g., text, images).
2. Features: Features are the attributes or characteristics of the data that are used by ML algorithms to make
predictions or decisions. Feature selection and engineering are important steps in ML model development.
3. Models: ML models are mathematical representations of the relationships between the input data (features)
and the output (predictions or decisions). Examples of ML models include linear regression, decision trees,
support vector machines, and neural networks.
4. Training: Training a ML model involves providing it with labeled data (input-output pairs) and optimizing
its parameters to minimize the difference between the predicted outputs and the actual outputs.
5. Evaluation: After training, ML models are evaluated on unseen data to assess their performance and
generalization ability. Common evaluation metrics include accuracy, precision, recall, and F1-score.
6. Types of Learning: ML can be categorized into three main types of learning:
Supervised Learning: Learning from labeled data, where the model is trained on input-output pairs.
Unsupervised Learning: Learning from unlabeled data, where the model discovers patterns and
structures in the data.
Reinforcement Learning: Learning through interaction with an environment to maximize
cumulative rewards.
Definition: Deep learning is a subset of ML that uses artificial neural networks with multiple layers (deep
architectures) to learn complex patterns in large amounts of data.
Key Concepts:
1. Neural Networks: Deep learning models are based on artificial neural networks, which are computational
models inspired by the structure and function of the human brain.
2. Layers: Deep neural networks consist of multiple layers of interconnected neurons, including input, hidden,
and output layers. Each layer performs transformations on the input data.
3. Activation Functions: Neurons in deep neural networks use activation functions to introduce non-linearity
into the model, allowing it to learn complex relationships in the data.
4. Training: Deep learning models are trained using large datasets and optimization algorithms such as
stochastic gradient descent (SGD) to adjust the model's parameters (weights and biases) and minimize a loss
function.
5. Architectures: DL encompasses various architectures, including convolutional neural networks (CNNs) for
image data, recurrent neural networks (RNNs) for sequential data, and transformers for natural language
processing tasks.
6. Pre-trained Models: Pre-trained deep learning models, such as those available in libraries like TensorFlow
and PyTorch, allow practitioners to leverage the knowledge learned from vast datasets and fine-tune models
for specific tasks with smaller datasets.
In summary, machine learning and deep learning are powerful techniques for enabling computers to learn
from data and make intelligent decisions or predictions. While machine learning covers a broad range of
algorithms and techniques for learning from data, deep learning focuses on neural networks with multiple
layers to learn complex patterns in large datasets.
The question of whether machines can truly think is a longstanding philosophical and scientific debate. Here
are some key perspectives on this topic:
1. Functionalism: Some philosophers argue that it is possible for machines to exhibit behaviors that are
functionally equivalent to human thinking, even if they do not have subjective experiences or consciousness.
From this perspective, machines can "think" in the sense that they can process information, make decisions,
and solve problems in a way that resembles human cognition.
2. Behaviorism: Behaviorists argue that the internal mental states of a system are not necessary to explain or
understand its behavior. From this viewpoint, machines can exhibit intelligent behavior without necessarily
having subjective experiences or consciousness.
3. Strong AI vs. Weak AI: The distinction between strong artificial intelligence (AI) and weak AI is relevant
to this question. Strong AI proponents argue that it is possible to create machines with true cognitive abilities
and consciousness, while weak AI proponents believe that machines can simulate intelligent behavior
without possessing genuine cognitive abilities or consciousness.
4. The Turing Test: The Turing Test, proposed by Alan Turing in 1950, is a criterion for determining whether
a machine exhibits intelligent behavior. In the Turing Test, a human evaluator interacts with a machine and a
human through a text-based interface and tries to determine which is which. If the evaluator cannot reliably
distinguish between the machine and the human, the machine is considered to have passed the Turing Test
and is said to exhibit intelligent behavior.
5. Philosophical Considerations: The question of whether machines can truly think also raises philosophical
considerations about the nature of consciousness, subjective experience, and the mind-body problem. These
are complex and unresolved issues that continue to be debated among philosophers, scientists, and ethicists.
In conclusion, whether machines can truly think depends on one's definition of "thinking" and the underlying
assumptions about the nature of consciousness and intelligence. While machines can certainly exhibit
intelligent behavior and perform tasks that were once thought to require human cognition, the question of
whether they possess genuine cognitive abilities or consciousness remains a topic of ongoing debate and
exploration.
Distributed AI Artificial Life
Distributed AI (Artificial Intelligence) and Artificial Life are two related but distinct fields in the realm of
artificial intelligence and computational biology, respectively. Let's break down each one:
Distributed AI refers to the study and development of AI systems that operate across multiple nodes or
agents, collaborating and communicating to achieve a common goal. In distributed AI systems, each node
typically has limited computational resources and may possess only partial knowledge of the problem
domain. Some key concepts and approaches in distributed AI include:
1. Multi-Agent Systems (MAS): MAS are systems composed of multiple interacting agents, each with its own
goals, capabilities, and knowledge. These agents may cooperate, compete, or act independently to
accomplish tasks or solve problems.
2. Distributed Problem Solving: Distributed problem-solving algorithms involve breaking down complex
problems into smaller subproblems that can be distributed across multiple agents. These agents collaborate
to solve their respective subproblems and then combine their solutions to produce a global solution.
3. Coordination and Communication: Effective coordination and communication mechanisms are essential
for ensuring that distributed AI agents can share information, synchronize their actions, and resolve
conflicts. Coordination techniques may include negotiation, consensus-building, or distributed decision-
making.
4. Decentralized Control: In some distributed AI systems, decision-making authority is decentralized, with
each agent making autonomous decisions based on its local knowledge and objectives. Decentralized control
can improve scalability, robustness, and adaptability.
5. Applications: Distributed AI has applications in various domains, including robotics, autonomous systems,
decentralized control networks, traffic management, and distributed sensor networks.
Artificial Life:
Artificial Life (ALife) is a field of study that investigates the fundamental principles of life by simulating
biological processes and behaviors in artificial systems. ALife researchers aim to understand the mechanisms
underlying the origin, evolution, and behavior of living organisms, as well as to create lifelike behaviors in
artificial systems. Some key concepts and approaches in artificial life include:
In summary, distributed AI focuses on developing AI systems that operate across multiple agents or nodes,
while artificial life explores the fundamental principles of life through simulations and computational models
of biological processes and behaviors. Both fields contribute to our understanding of complex adaptive
systems and have applications in various domains.
The Ethics of AI
The ethics of AI encompasses a wide range of considerations related to the development, deployment, and
impact of artificial intelligence systems on individuals, society, and the environment. Some key ethical
issues in AI include:
1. Bias and Fairness: AI systems can reflect and perpetuate biases present in the data used to train them. This
can lead to unfair or discriminatory outcomes, particularly in areas like hiring, lending, and criminal justice.
Ensuring fairness and mitigating bias in AI algorithms is a critical ethical concern.
2. Transparency and Explainability: Many AI algorithms operate as "black boxes," making it difficult to
understand how they arrive at their decisions. Ensuring transparency and explainability in AI systems is
important for accountability, trust, and understanding potential biases or errors.
3. Privacy and Data Protection: AI systems often rely on large amounts of personal data to make predictions
or decisions. Ensuring the privacy and security of this data, as well as obtaining informed consent from
individuals, is essential for protecting their rights and autonomy.
4. Accountability and Liability: Determining responsibility and accountability for the actions of AI systems
can be challenging, particularly in cases where errors or harm occur. Clarifying legal and ethical frameworks
for assigning liability and ensuring accountability is crucial for addressing potential harms.
5. Autonomy and Control: AI systems have the potential to influence or manipulate human behavior, raising
concerns about individual autonomy and agency. Ensuring that humans retain control over AI systems and
their decisions is essential for safeguarding human values and interests.
6. Employment and Labor Displacement: AI technologies have the potential to automate tasks and jobs,
leading to concerns about unemployment, income inequality, and the future of work. Addressing the societal
impacts of AI-driven automation and ensuring equitable distribution of benefits is important for addressing
these concerns.
7. Safety and Security: AI systems can have physical, economic, and social impacts that raise concerns about
safety and security. Ensuring the robustness, reliability, and resilience of AI systems, as well as addressing
potential vulnerabilities and malicious use, is critical for minimizing risks and ensuring public safety.
8. Global Governance and Equity: AI technologies have global implications, raising questions about
governance, regulation, and equitable access. Collaborative efforts among governments, industry, academia,
and civil society are needed to develop international norms, standards, and policies for the responsible
development and deployment of AI.
Addressing these ethical considerations requires interdisciplinary collaboration, engagement with diverse
stakeholders, and ongoing dialogue and reflection on the values and principles that should guide the
development and use of AI technologies. Ethical AI frameworks and guidelines, as well as mechanisms for
Interpretable AI-
Interpretable AI, also known as Explainable AI (XAI), refers to the development of artificial intelligence
models and systems that are transparent and understandable to humans. While traditional AI models, such as
deep neural networks, are often considered black boxes due to their complex internal workings, interpretable
AI aims to provide explanations for the decisions or predictions made by these models.
1. Explainability: Interpretable AI emphasizes the importance of providing explanations for AI model outputs
in a clear and understandable manner. These explanations help users, stakeholders, and decision-makers
understand the factors influencing the model's decisions and build trust in AI systems.
2. Transparency: Interpretable AI promotes transparency by making the decision-making process of AI
models more transparent and accessible. This transparency enables users to understand how AI models
arrive at their conclusions and identify any biases, errors, or limitations in the model.
3. Model Interpretation: Interpretable AI techniques allow users to interpret and analyze the internal
workings of AI models, such as the importance of input features, the decision boundaries learned by the
model, and the relationships between input and output variables.
4. Local and Global Explanations: Interpretable AI provides both local and global explanations for AI model
outputs. Local explanations focus on explaining individual predictions or decisions, while global
explanations provide insights into the overall behavior and performance of the model.
5. Techniques and Methods: There are various techniques and methods used in interpretable AI, including
feature importance analysis, model-agnostic methods such as LIME (Local Interpretable Model-agnostic
Explanations) and SHAP (SHapley Additive exPlanations), rule-based models, and surrogate models.
6. Applications: Interpretable AI has applications across various domains, including healthcare (interpretable
medical diagnosis), finance (interpretable credit scoring), criminal justice (interpretable risk assessment), and
autonomous systems (interpretable decision-making in self-driving cars).
7. Ethical Considerations: Interpretable AI addresses ethical concerns related to fairness, accountability, and
transparency in AI systems. By providing explanations for AI model outputs, interpretable AI helps mitigate
biases, discrimination, and unintended consequences in AI-driven decision-making processes.
Overall, interpretable AI is essential for building trust, ensuring accountability, and promoting responsible
AI deployment across different industries and applications. As AI technologies continue to advance, the
development of interpretable AI techniques and methods will play a crucial role in enabling humans to
understand and effectively interact with AI systems.
Future of AI
1. Advancements in Deep Learning: Deep learning, a subset of machine learning based on artificial neural
networks with multiple layers, continues to drive significant progress in AI. Future advancements in deep
learning techniques, such as improved architectures, optimization algorithms, and training methodologies,
will enable the development of more powerful AI models capable of solving increasingly complex problems.
2. AI for Healthcare: AI is poised to transform healthcare by improving diagnosis, personalized treatment,
drug discovery, and patient care. AI-driven medical imaging, predictive analytics, and precision medicine
will lead to earlier detection of diseases, more effective treatments, and better health outcomes for patients.
3. Autonomous Systems: Autonomous vehicles, drones, robots, and other autonomous systems will become
more prevalent in the future, revolutionizing transportation, logistics, manufacturing, and agriculture. These
systems will leverage AI technologies, such as computer vision, natural language processing, and
reinforcement learning, to navigate complex environments and perform tasks autonomously.
4. Natural Language Processing (NLP): NLP, the field of AI concerned with the interaction between
computers and human language, will continue to advance, enabling more sophisticated conversational
agents, virtual assistants, and language translation systems. Future developments in NLP will enhance
communication, accessibility, and information retrieval for individuals worldwide.
5. AI Ethics and Governance: As AI technologies become more pervasive, there will be increasing focus on
addressing ethical and societal implications, such as bias, fairness, privacy, accountability, and job
displacement. Efforts to develop ethical frameworks, regulations, and guidelines for the responsible
development and deployment of AI will become more prominent.
6. AI for Climate Change and Sustainability: AI has the potential to contribute to addressing global
challenges, such as climate change, environmental conservation, and sustainable development. AI-driven
solutions for energy optimization, resource management, environmental monitoring, and climate modeling
will help mitigate the impacts of climate change and promote sustainability.
7. AI Democratization: The democratization of AI tools and technologies will enable individuals,
organizations, and communities to harness the power of AI for innovation and problem-solving. Open-
source AI platforms, cloud-based AI services, and low-code AI development tools will make AI more
accessible and affordable to a broader range of users.
8. Human-AI Collaboration: The future of AI will involve closer collaboration between humans and AI
systems, with humans focusing on tasks that require creativity, critical thinking, and emotional intelligence,
while AI systems handle routine, repetitive, and data-intensive tasks. Human-AI collaboration will lead to
new opportunities for productivity, creativity, and innovation.
Overall, the future of AI is bright, with significant potential to drive economic growth, improve quality of
life, and address some of the most pressing challenges facing humanity. However, realizing this potential
will require careful consideration of ethical, societal, and environmental implications, as well as
collaboration across disciplines and stakeholders.
AI Components
1. Data Collection and Preprocessing: Data is the foundation of AI systems, and collecting high-quality data
is essential for training and testing AI models. Data preprocessing involves cleaning, transforming, and
organizing the raw data to make it suitable for analysis and modeling.
2. Feature Engineering: Feature engineering involves selecting, extracting, and transforming relevant features
from the raw data to represent the input to the AI model. Effective feature engineering can significantly
impact the performance of AI models.
3. Machine Learning Algorithms: Machine learning algorithms are the core components of many AI systems.
These algorithms learn patterns and relationships from data to make predictions or decisions. Common types
of machine learning algorithms include supervised learning, unsupervised learning, and reinforcement
learning.
4. Deep Learning Architectures: Deep learning architectures, such as artificial neural networks, are a subset
of machine learning algorithms that are particularly well-suited for learning from complex, high-dimensional
data. Deep learning architectures consist of multiple layers of interconnected neurons that process and
transform the input data.
5. Model Training and Optimization: Model training involves feeding the AI model with labeled training
data and optimizing its parameters to minimize a loss function. Optimization techniques such as gradient
descent are used to adjust the model's parameters iteratively to improve its performance.
6. Model Evaluation and Validation: After training, AI models are evaluated and validated on unseen data to
assess their performance and generalization ability. Evaluation metrics such as accuracy, precision, recall,
and F1-score are used to quantify the model's performance.
7. Deployment and Integration: Once trained and validated, AI models are deployed and integrated into
production systems or applications where they can make predictions or decisions in real-world settings.
Deployment involves considerations such as scalability, reliability, and efficiency.
8. Monitoring and Maintenance: AI systems require ongoing monitoring and maintenance to ensure they
continue to perform effectively over time. Monitoring involves tracking the performance of deployed
models, detecting drift or degradation in performance, and retraining models as needed.
9. Interpretability and Explainability: Interpretability and explainability are increasingly important
components of AI systems, particularly in high-stakes applications such as healthcare and finance. These
components allow users to understand how AI models arrive at their decisions and provide explanations for
model outputs.
10. Ethical and Regulatory Considerations: Ethical and regulatory considerations are critical components of
AI systems, particularly with regard to issues such as bias, fairness, privacy, accountability, and
transparency. Ensuring that AI systems adhere to ethical principles and legal regulations is essential for
responsible AI development and deployment.
Overall, AI systems are complex and multifaceted, consisting of various components that work together to
process data, learn patterns, make predictions or decisions, and deliver value to users and organizations.
1. Traditional Symbolic AI: Symbolic AI, also known as rule-based or expert systems, represents knowledge
using symbols, rules, and logical reasoning. This architecture relies on explicit programming of rules and
logic to perform tasks such as reasoning, planning, and problem-solving.
2. Connectionist AI: Connectionist AI, also known as neural network-based AI, is inspired by the structure
and function of the human brain. This architecture consists of interconnected nodes or neurons organized
into layers, with each neuron performing simple computations. Deep learning architectures, such as
convolutional neural networks (CNNs) and recurrent neural networks (RNNs), are examples of connectionist
AI.
3. Hybrid AI: Hybrid AI architectures combine elements of symbolic AI and connectionist AI to leverage the
strengths of both approaches. These architectures integrate symbolic reasoning with neural network-based
learning to achieve more robust and flexible AI systems.
4. Reinforcement Learning (RL) Architectures: RL architectures are designed for autonomous decision-
making in dynamic environments. These architectures consist of an agent that learns to interact with an
environment through trial and error, receiving feedback in the form of rewards or penalties. RL architectures
often use deep learning models, such as deep Q-networks (DQN) or policy gradients, to learn optimal
policies.
5. Ensemble Learning Architectures: Ensemble learning architectures combine multiple AI models to
improve predictive performance and robustness. These architectures aggregate predictions from multiple
models, such as decision trees, neural networks, or support vector machines, to make more accurate and
reliable predictions.
6. Distributed AI Architectures: Distributed AI architectures distribute computation and data across multiple
nodes or agents to enable collaborative decision-making and learning. These architectures are used in
decentralized systems, multi-agent systems, and distributed computing environments.
7. Generative Adversarial Networks (GANs) Architecture: GANs are a type of AI architecture composed of
two neural networks, a generator and a discriminator, that compete against each other in a game-theoretic
framework. The generator learns to generate synthetic data that is indistinguishable from real data, while the
discriminator learns to differentiate between real and synthetic data.
8. Transformers Architecture: Transformers are a type of neural network architecture that has gained
popularity in natural language processing tasks. Transformers use self-attention mechanisms to process input
sequences and capture long-range dependencies, making them well-suited for tasks such as language
translation and text generation.
These are just a few examples of AI architectures, and there are many other specialized architectures
designed for specific tasks, domains, and applications. The choice of architecture depends on factors such as
the nature of the problem, the available data, computational resources, and performance requirements.