AI Notes
AI Notes
Chaudhary North
Maharashtra
University ,Jalgaon
M.sc Information
Technology
Semester Ist (2023-2024)
Artificial Intelligence
1.Introduction (marks:18)
2. State space Search and heuristic
Search Techniques (marks:18)
3.Knowledge Representation
(marks:10)
4.Reasoning (marks:10)
1-Introduction
Overview and definition of AI techniques:
What is Artificial Intelligence?
According to the father of Artificial Intelligence, John McCarthy, it is “The science and
engineering of making intelligent machines, especially intelligent computer programs”.
Artificial Intelligence is a way of making a computer, a computer-controlled robot, or a
software think intelligently, in the similar manner the intelligent humans think.
AI is accomplished by studying how human brain thinks, and how humans learn, decide, and
work while trying to solve a problem, and then using the outcomes of this study as a basis of
developing intelligent software and systems.
Goals of AI
To Create Expert Systems − The systems which exhibit intelligent behavior,
learn, demonstrate, explain, and advice its users.
To Implement Human Intelligence in Machines − Creating systems that
understand, think, learn, and behave like humans.
What is AI Technique?
In the real world, the knowledge has some unwelcomed properties −
Turing Test in AI
In 1950, Alan Turing introduced a test to check whether a machine can think like a
human or not, this test is known as the Turing Test. In this test, Turing proposed that
the computer can be said to be an intelligent if it can mimic human response under
specific conditions.
Turing Test was introduced by Turing in his 1950 paper, "Computing Machinery and
Intelligence," which considered the question, "Can Machine think?"
The Turing test is based on a party game "Imitation game," with some modifications. This
game involves three players in which one player is Computer, another player is human
responder, and the third player is a human Interrogator, who is isolated from other two
players and his job is to find that which player is machine among two of them.
The conversation between all players is via keyboard and screen so the result would
not depend on the machine's ability to convert words as speech.
The test result does not depend on each correct answer, but only how closely its
responses like a human answer. The computer is permitted to do everything possible
to force a wrong identification by the interrogator.
PlayerA (Computer): No
In this game, if an interrogator would not be able to identify which is a machine and
which is human, then the computer passes the test successfully, and the machine is
said to be intelligent and can think like a human.
"In 1991, the New York businessman Hugh Loebner announces the prize
competition, offering a $100,000 prize for the first computer to pass the Turing test.
However, no AI program to till date, come close to passing an undiluted Turing test".
1. Machine Learning
2. Deep Learning
3. Natural Language Processing
4. Robotics
5. Expert Systems
6. Fuzzy Logic
Machine Learning:
Machine Learning is the science of getting machines to interpret, process and
analyze data in order to solve real-world problems.
1. Supervised Learning
2. Unsupervised Learning
3. Reinforcement Learning
Deep Learning:
Deep Learning is the process of implementing Neural Networks on high
dimensional data to gain insights and form solutions. Deep Learning is an
advanced field of Machine Learning that can be used to solve more
advanced problems. Deep Learning is the logic behind the face
verification algorithm on Facebook, self-driving cars, virtual assistants like
Siri, Alexa and so on.
Fuzzy Logic:
Fuzzy logic is a computing approach based on the principles of “degrees of truth”
instead of the usual modern computer logic i.e. boolean in nature. Fuzzy logic is
used in the medical fields to solve complex problems that involve decision making. They
are also used in automatic gearboxes, vehicle environment control and so on.
Expert Systems
An expert system is an AI-based computer system that learns and reciprocates
the decision-making ability of a human expert. Expert systems use if-then logical
notations to solve complex problems. It does not rely on conventional procedural
programming. Expert systems are mainly used in information management, medical
facilities, loan analysis, virus detection and so on.
Application of AI
Artificial Intelligence has various applications in today's society. It is becoming
essential for today's time because it can solve complex problems with an efficient
way in multiple industries, such as Healthcare, entertainment, finance, education, etc.
AI is making our daily life more comfortable and fast.
Following are some sectors which have the application of Artificial Intelligence:
1. AI in Astronomy
2. AI in Healthcare
o In the last, five to ten years, AI becoming more advantageous for the
healthcare industry and going to have a significant impact on this industry.
o Healthcare Industries are applying AI to make a better and faster diagnosis
than humans. AI can help doctors with diagnoses and can inform when
patients are worsening so that medical help can reach to the patient before
hospitalization.
3. AI in Gaming
o AI can be used for gaming purpose. The AI machines can play strategic games
like chess, where the machine needs to think of a large number of possible
places.
4. AI in Finance
o AI and finance industries are the best matches for each other. The finance
industry is implementing automation, chatbot, adaptive intelligence, algorithm
trading, and machine learning into financial processes.
5. AI in Data Security
o The security of data is crucial for every company and cyber-attacks are
growing very rapidly in the digital world. AI can be used to make your data
more safe and secure. Some examples such as AEG bot, AI2 Platform,are used
to determine software bug and cyber-attacks in a better way.
6. AI in Social Media
o Social Media sites such as Facebook, Twitter, and Snapchat contain billions of
user profiles, which need to be stored and managed in a very efficient way. AI
can organize and manage massive amounts of data. AI can analyze lots of
data to identify the latest trends, hashtag, and requirement of different users.
9. AI in Robotics:
10. AI in Entertainment
o We are currently using some AI based applications in our daily life with some
entertainment services such as Netflix or Amazon. With the help of ML/AI
algorithms, these services show the recommendations for programs or shows.
11. AI in Agriculture
o Agriculture is an area which requires various resources, labor, money, and time
for best result. Now a day's agriculture is becoming digital, and AI is emerging
in this field. Agriculture is applying AI as agriculture robotics, solid and crop
monitoring, predictive analysis. AI in agriculture can be very helpful for
farmers.
12. AI in E-commerce
o AI can automate grading so that the tutor can have more time to teach. AI
chatbot can communicate with students as a teaching assistant.
o AI in the future can be work as a personal virtual tutor for students, which will
be accessible easily at any time and any place.
Intelligent Agents:
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.
Intelligent Agents:
An intelligent agent is an autonomous entity which act upon an environment using
sensors and actuators for achieving goals. An intelligent agent may learn from the
environment to achieve their goals. A thermostat is an example of an intelligent
agent.
Types of AI Agents:
Agents can be grouped into five classes based on their degree of perceived
intelligence and capability. All these agents can improve their performance and
generate better action over the time. These are given below:
3. Goal-based agents
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.
4. Utility-based agents
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.
5. Learning Agents
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:
2. Critic: Learning element takes feedback from critic which describes that
how well the agent is doing with respect to a fixed performance
standard.
o Hence, learning agents are able to learn, analyze performance, and look for
new ways to improve the performance.
Autonomous Agents:
What is Autonomous AI?
An autonomous AI agent is a computer system that collects sensory input from its
surroundings and determines on its own how to tie the external stimuli to its
behaviors to achieve certain goals.
These autonomous assistants receive user input, split it down into smaller jobs with
the help of LLMs, and tackle them one at a time. The agents save the results and, if
necessary, employ them in the following rounds of the process. As a result, the top
10 autonomous AI agents can handle challenging jobs and have access to a variety
of fundamental models that aren’t only limited to language. For example, an agent
may decide on its own to use code, video, or speech models; search engines, or
calculating tools to do the work you’ve assigned to it.
1.AgentGPT
AgentGPT online is a self-driving AI platform that allows users to design and deploy
customizable self-driving AI agents directly in the browser. All you have to do is give
your AI agent a name and a purpose, and then watch as it embarks on an adventure
to attain the goal you provided. To fulfill its designated goal, the agent will
autonomously gain information, execute actions, communicate, and adapt.
2.Baby AGI
Baby AGI is an artificial intelligence-powered task management system. To generate,
prioritize, and execute tasks, the system makes use of the OpenAI and Pinecone APIs.
The attractiveness of Baby AGI lies in its capacity to perform challenges
autonomously based on the results of prior tasks while maintaining a set purpose. It
also efficiently prioritizes jobs.
3.Auto-GPT
Auto-GPT is an “AI agent” that will attempt to achieve a goal in natural language by
breaking it down into sub-tasks and utilizing the internet and other tools in an
automated loop. It makes use of OpenAI’s GPT-4 or GPT-3.5 APIs and is one of the
first applications to leverage GPT-4 to execute autonomous tasks.
4.Agent-LLM
An AI Automation Platform called Agent-LLM offers efficient AI instruction
management across several vendors. The agents have adaptive memory, and this
adaptable solution includes a robust plugin system that enables a wide variety of
commands, including web browsing. Agent-LLM is constantly evolving to enable
more AI providers and models, allowing for a broader range of applications.
5.JARVIS / HuggingGPT
Jarvis, also known as HuggingGPT, is a collaborative system made up of a Large
Language Model (LLM) as the central controller and a plethora of expert models as
collaborative executors provided by the Hugging Face Hub. This agent is capable of
using LLMs as well as other models.
6.Xircuits
The Xircuits toolbox includes everything you need to experiment with and build
Collaborative Large Language Model-based automatons (Agents) in the spirit of
BabyAGI and Auto-GPT. The toolkit includes BabyAGI agents by default, but it may
simply be customized to accept your unique prompts.
7.ChaosGPT
ChaosGPT, also known as the autonomous agent attempting to destroy humanity. It
has thus far failed miserably owing to a lack of access to weapons of mass
devastation. It is nevertheless intriguing to see its aspirations for world dominance,
especially given that its basic models are based on humanity’s collective thoughts
about the subject.
8.Micro-GPT
MicroGPT is a lightweight autonomous agent that works with GPT-3.5-Turbo and
GPT-4. It combines strong urging, a limited tool set, and short-term memory. Vector
storage for data augmentation will be introduced soon.
9.AutoGPT.js
AutoGPT. js is an open-source project aimed at bringing AutoGPT’s tremendous
features to your browser. AutoGPT. js provides increased accessibility and privacy by
operating directly in the browser.
10.SFighterAI
To defeat the last boss in “Street Fighter II: Special Champion Edition,” SFighterAI
provides an AI agent trained using deep reinforcement learning. The AI agent makes
judgments based exclusively on the RGB pixel values of the game screen, attaining a
100% victory rate in some cases.
*************************
Simplicity
Modifiability
The feature of modifiability helps alter the rules as per requirements. Initially,
the skeletal form of the production system is created. We then gather the
requirements and make changes in the raw structure of the production system.
This helps in the iterative improvement of the production system.
Knowledge-intensive
3. Absence of learning: Rule based production systems do not store the result
of the problem for future use. Hence, it does not exhibit any type of learning
capabilities. So for each time for a particular problem, some new solutions
may come.
Hill Climbing:
Hill climbing is a simple optimization algorithm used in Artificial Intelligence (AI)
to find the best possible solution for a given problem. It belongs to the family of
local search algorithms and is often used in optimization problems where the goal is
to find the best solution from a set of possible solutions.
1. Hill Climbing can get stuck in local optima, meaning that it may not find
the global optimum of the problem.
2. The algorithm is sensitive to the choice of initial solution, and a poor
initial solution may result in a poor final solution.
3. Hill Climbing does not explore the search space very thoroughly, which
can limit its ability to find better solutions.
4. It may be less effective than other optimization algorithms, such as genetic
algorithms or simulated annealing, for certain types of problems.
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:
2. Else if it is better than the current state then assign new state as a
current state.
3. Else if not better than the current state, then return to step2.
o Step 5: Exit.
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.
1. Let SUCC be a state such that any successor of the current state will be
better than it.
III. If it is goal state, then return it and quit, else compare it to the
SUCC.
V. If the SUCC is better than the current state, then set current state
to SUCC.
o Step 5: Exit.
1. Breadth-first Search
2. Depth-first 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:
4.8M
504
Package BFS will provide a solution if any solution exists.
o If there are more than one solutions for a given problem, then BFS will provide
the minimal solution which requires the least number of steps.
Disadvantages:
o It 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
Time Complexity: Time Complexity of BFS algorithm can be obtained by the
number of nodes traversed in BFS until the shallowest Node. Where the d= depth of
shallowest solution and b is a node at every state.
pace 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.
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.
o The process of the DFS algorithm is similar to the BFS algorithm.
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.
Completeness: DFS search algorithm is complete within finite state space as it will
expand every node within a limited search tree.
Time Complexity: Time complexity of DFS will be equivalent to the node traversed
by the algorithm. It is given by:
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).
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.
In this search example, we are using two lists which are OPEN and CLOSED Lists.
Following are the iteration for traversing the above example.
Space Complexity: The worst case space complexity of Greedy best first search is
O(bm). Where, m is the maximum depth of the search space.
Complete: Greedy best-first search is also incomplete, even if the given state space
is finite.
AO* algorithm:
he Depth-first search and Breadth-first search given earlier for OR trees or graphs
can be easily adopted by AND-OR graph. The main difference lies in the way
termination conditions are determined since all goals following an AND node must
be realized; whereas a single goal node following an OR node will do. So for this
purpose, we are using AO* algorithm.
Like A* algorithm here we will use two arrays and one heuristic function.
OPEN: It contains the nodes that have been traversed but yet not been marked
solvable or unsolvable.
CLOSE: It contains the nodes that have already been processed.
h(n): The distance from the current node to the goal node.
Step 3: Select a node n that is both on OPEN and a member of T0. Remove it from
OPEN and place it in CLOSE
Step 4: If n is the terminal goal node then leveled n as solved and leveled all the
ancestors of n as solved. If the starting node is marked as solved then success and
exit.
Step 5: If n is not a solvable node, then mark n as unsolvable. If starting node is
marked as unsolvable, then return failure and exit.
Step 6: Expand n. Find all its successors and find their h (n) value, push them into O
tep 7: Return to Step 2.
Step 8: Exit.
A* algorithm and AO* algorithm both works on the best first search.
They are both informed search and works on given heuristics values.
A* always gives the optimal solution but AO* doesn’t guarantee to give the
optimal solution.
Once AO* got a solution doesn’t explore all possible paths but A* explores all
paths.
When compared to the A* algorithm, the AO* algorithm uses less memory.
opposite to the A* algorithm, the AO* algorithm cannot go into an endless loop.
***************************
3) knowledge Representation
Knowledge management:
What is knowledge management? Knowledge management (KM) is the process of
identifying, organizing, storing and disseminating information within an organization.
Types of knowledge:
1. Declarative Knowledge:
2. Procedural Knowledge
3. Meta-knowledge:
5. Structural knowledge:
What to Represent:
Following are the kind of knowledge which needs to be represented in AI systems:
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
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
1. Logical Representation
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.
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.
5. Production Rules
Production rules system consist of (condition, action) pairs which mean, "If
condition then action". It has mainly three parts:
First-Order logic:
o First-order logic is another way of knowledge representation in artificial
intelligence. It is an extension to propositional logic.
o FOL is sufficiently expressive to represent the natural language statements in a
concise way.
o First-order logic is also known as Predicate logic or First-order predicate
logic. First-order logic is a powerful language that develops information about
the objects in a more easy way and can also express the relationship between
those objects.
o First-order logic (like natural language) does not only assume that the world
contains facts like propositional logic but also assumes the following things in
the world:
o Objects: A, B, people, numbers, colours, wars, theories, squares, pits,
wumpus, ......
o Relations: It can be unary relation such as: red, round, is adjacent, or
n-any relation such as: the sister of, brother of, has colour, comes
between
o Function: Father of, best friend, third inning of, end of, ......
o As a natural language, first-order logic also has two main parts:
o Syntax
o Semantics
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:
o Complex sentences are made by combining atomic sentences using
connectives.
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.
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:
All man drink coffee.
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.
If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:
o There exists a 'x.'
o For some 'x.'
o For at least one 'x.'
Example:
Some boys are intelligent.
It will be read as: There are some x where x is a boy who is intelligent.
Points to remember:
o The main connective for universal quantifier ∀ is implication →.
o The main connective for existential quantifier ∃ is and ∧.
Properties of Quantifiers:
o In universal quantifier, ∀x∀y is similar to ∀y∀x.
o In Existential quantifier, ∃x∃y is similar to ∃y∃x.
o ∃x∀y is not similar to ∀y∃x.
∀x bird(x) →fly(x).
Unification Algorithm:
o Unification is a process of making two different logical atomic expressions
identical by finding a substitution. Unification depends on the substitution
process.
o It takes two literals as input and makes them identical using substitution.
o Let Ψ1 and Ψ2 be two atomic sentences and 𝜎 be a unifier such that, Ψ1𝜎 =
Ψ2𝜎, then it can be expressed as UNIFY(Ψ1, Ψ2).
o Example: Find the MGU for Unify{King(x), King(John)}
Substitution θ = {John/x} is a unifier for these atoms and applying this substitution,
and both expressions will be identical.
o The UNIFY algorithm is used for unification, which takes two atomic sentences
and returns a unifier for those sentences (If any exist).
o Unification is a key component of all first-order inference algorithms.
o It returns fail if the expressions do not match with each other.
o The substitution variables are called Most General Unifier or MGU.
E.g. Let's say there are two different expressions, P(x, y), and P(a, f(z)).
In this example, we need to make both above statements identical to each other. For
this, we will perform the substitution.
o Substitute x with a, and y with f(z) in the first expression, and it will be
represented as a/x and f(z)/y.
o With both the substitutions, the first expression will be identical to the second
expression and the substitution set will be: [a/x, f(z)/y].
Conditions for Unification:
Following are some basic conditions for unification:
Unification Algorithm:
Algorithm: Unify(Ψ1, Ψ2)
b. If one expression is a variable v i, and the other is a term t i which does not
contain variable vi, then:
5. The fuzzy logic system: This type of AI uses a set of rules that
are not precise to make decisions.
It has been used by many programs that portend to understand English (MARGIE,
SAM, PAM). CD developed by Schank et al. as were the previous examples.
CD provides:
a structure into which nodes representing information can be placed
a specific set of primitives
at a given level of granularity.
ATRANS
-- Transfer of an abstract relationship. e.g. give.
PTRANS
-- Transfer of the physical location of an object. e.g. go.
PROPEL
-- Application of a physical force to an object. e.g. push.
MTRANS
-- Transfer of mental information. e.g. tell.
MBUILD
-- Construct new information from old. e.g. decide.
SPEAK
-- Utter a sound. e.g. say.
ATTEND
-- Focus a sense on a stimulus. e.g. listen, watch.
MOVE
-- Movement of a body part by owner. e.g. punch, kick.
GRASP
-- Actor grasping an object. e.g. clutch.
INGEST
-- Actor ingesting an object. e.g. eat.
EXPEL
-- Actor getting rid of an object from body. e.g. ????.
Six primitive conceptual categories provide building blocks which are the set of
allowable dependencies in the concepts in a sentence:
PP
-- Real world objects.
ACT
-- Real world actions.
PA
-- Attributes of objects.
AA
-- Attributes of actions.
T
-- Times.
LOC
-- Locations.
o
-- object.
R
-- recipient-donor.
I
-- instrument e.g. eat with a spoon.
D
-- destination e.g. going home.
Double arrows ( ) indicate two-way links between the actor (PP) and action
(ACT).
The actions are built from the set of primitive acts (see above).
o These can be modified by tense etc.
p
-- past
f
-- future
t
-- transition
-- start transition
-- finished transition
k
-- continuing
?
-- interrogative
/
-- negative
delta
-- timeless
c
-- conditional
the absence of any modifier implies the present tense.
The has an object (actor), PP and action, ACT. I.e. PP ACT. The triplearrow (
) is also a two link but between an object, PP, and its attribute, PA. I.e. PP
PA.
Primitive states are used to describe many state descriptions such as height, health,
mental state, physical state.
There are many more physical states than primitive actions. They use a numeric
scale.
E.g. John height(+10) John is the tallest John height(< average) John is
short Frank Zappa health(-10) Frank Zappa is dead Dave mental_state(-
10) Dave is sad Vase physical_state(-10) The vase is broken
You can also specify things like the time of occurrence in the relation ship.
For Example: John gave Mary the book yesterday
Now let us consider a more complex sentence: Since smoking can kill you, I
stopped Lets look at how we represent the inference that smoking can kill:
Disadvantages of CD:
Dave bet Frank five pounds that Wales would win the Rugby World Cup.
Applications of CD:
MARGIE
(Meaning Analysis, Response Generation and Inference on English) --
model natural language understanding.
SAM
(Script Applier Mechanism) -- Scripts to understand stories. See next
section.
PAM
(Plan Applier Mechanism) -- Scripts to understand stories.
Scripts
A script is a structured representation describing a stereotyped sequence of events in a particular
context.
Scripts are used in natural language understanding systems to organize a knowledge base in terms
of the situations that the system should understand. Scripts use a frame-like structure to represent
the commonly occurring experience like going to the movies eating in a restaurant, shopping in a
supermarket, or visiting an ophthalmologist.
Thus, a script is a structure that prescribes a set of circumstances that could be expected to follow
on from one another.
Scripts are beneficial because:
Events tend to occur in known runs or patterns.
A
to take place.
Prerequisites exist upon events taking place.
Components of a script
The components of a script include:
Entry condition: These are basic condition which must be fulfilled before events in the
script can occur.
Results: Condition that will be true after events in script occurred.
Props: Slots representing objects involved in events
Roles: These are the actions that the individual participants perform.
Track: Variations on the script. Different tracks may share components of the same
scripts.
Scenes: The sequence of events that occur.
Describing a script, special symbols of actions are used. These are:
Symbol Meaning Example
ATRANS transfer a relationship give
transfer physical location of an
PTRANS go
object
PROPEL apply physical force to an object push
MOVE move body part by owner kick
GRASP grab an object by an actor hold
INGEST taking an object by an animal eat drink
EXPEL expel from animal’s body cry
MTRANS transfer mental information tell
MBUILD mentally make new information decide
conceptualize or think about an
CONC think
idea
SPEAK produce sound say
ATTEND focus sense organ listen
Example:-Script for going to the bank to withdraw money.
SCRIPT : Withdraw money
TRACK : Bank
PROPS : Money
Counter
Form
Token
Roles : P= Customer
E= Employee
C= Cashier
Entry conditions: P has no or less money.
The bank is open.
Results : P has more money.
Scene 1: Entering
P PTRANS P into the Bank
P ATTEND eyes to E
P MOVE P to E
Scene 2: Filling form
P MTRANS signal to E
E ATRANS form to P
P PROPEL form for writing
P ATRANS form to P
E ATRANS form to P
Scene 3: Withdrawing money
P ATTEND eyes to counter
P PTRANS P to queue at the counter
P PTRANS token to C
C ATRANS money to P
Scene 4: Exiting the bank
P PTRANS P to out of bank
Less general than frames.
M semantic network:
the tl;dr
A semantic network is a graphical representation of how words are related to each other.
4) Reasoning
What is Reasoning:
The reasoning is the mental process of deriving logical conclusion and making
predictions from available knowledge, facts, and beliefs. Or we can say, "Reasoning
is a way to infer facts from existing data." It is a general process of thinking
rationally, to find valid conclusions.
In artificial intelligence, the reasoning is essential so that the machine can also think
rationally as a human brain, and can perform like a human.
Types of Reasoning
In artificial intelligence, reasoning can be divided into the following categories:
o Deductive reasoning
o Inductive reasoning
o Abductive reasoning
o Common Sense Reasoning
o Monotonic Reasoning
o Non-monotonic Reasoning
Note: Inductive and deductive reasoning are the forms of propositional logic.
1. Deductive reasoning:
Deductive reasoning is deducing new information from logically related known
information. It is the form of valid reasoning, which means the argument's conclusion
must be true when the premises are true.
Deductive reasoning is a type of propositional logic in AI, and it requires various rules
and facts. It is sometimes referred to as top-down reasoning, and contradictory to
inductive reasoning.
In deductive reasoning, the truth of the premises guarantees the truth of the
conclusion.
Deductive reasoning mostly starts from the general premises to the specific
conclusion, which can be explained as below example.
Example:
2. Inductive Reasoning:
Inductive reasoning is a form of reasoning to arrive at a conclusion using limited sets
of facts by the process of generalization. It starts with the series of specific facts or
data and reaches to a general statement or conclusion.
Example:
Premise: All of the pigeons we have seen in the zoo are white.
3. Abductive reasoning:
Abductive reasoning is a form of logical reasoning which starts with single or
multiple observations then seeks to find the most likely explanation or conclusion for
the observation.
Example:
Conclusion It is raining.
Common Sense reasoning simulates the human ability to make presumptions about
events which occurs on every day.
It relies on good judgment rather than exact logic and operates on heuristic
knowledge and heuristic rules.
Example:
1. One person can be at one place at a time.
2. If I put my hand in a fire, then it will burn.
The above two statements are the examples of common sense reasoning which a
human mind can easily understand and assume.
5. Monotonic Reasoning:
In monotonic reasoning, once the conclusion is taken, then it will remain the same
even if we add some other information to existing information in our knowledge
base. In monotonic reasoning, adding knowledge does not decrease the set of
prepositions that can be derived.
To solve monotonic problems, we can derive the valid conclusion from the available
facts only, and it will not be affected by new facts.
Monotonic reasoning is not useful for the real-time systems, as in real time, facts get
changed, so we cannot use monotonic reasoning.
Example:
Non-monotonic Reasoning:
In Non-monotonic reasoning, some conclusions may be invalidated if we add some
more information to our knowledge base.
"Human perceptions for various things in daily life, "is a general example of non-
monotonic reasoning.
Example: Let suppose the knowledge base contains the following knowledge:
So from the above sentences, we can conclude that Pitty can fly.
However, if we add one another sentence into knowledge base "Pitty is a penguin",
which concludes "Pitty cannot fly", so it invalidates the above conclusion.
ARCHITECTURE
Its Architecture contains four parts :
RULE BASE: It contains the set of rules and the IF-THEN conditions
provided by the experts to govern the decision-making system, on the
basis of linguistic information. Recent developments in fuzzy theory offer
several effective methods for the design and tuning of fuzzy controllers.
Most of these developments reduce the number of fuzzy rules.
FUZZIFICATION: It is used to convert inputs i.e. crisp numbers into
fuzzy sets. Crisp inputs are basically the exact inputs measured by sensors
and passed into the control system for processing, such as temperature,
pressure, rpm’s, etc.
INFERENCE ENGINE: It determines the matching degree of the current
fuzzy input with respect to each rule and decides which rules are to be
fired according to the input field. Next, the fired rules are combined to
form the control actions.
DEFUZZIFICATION: It is used to convert the fuzzy sets obtained by the
inference engine into a crisp value. There are several defuzzification
methods available and the best-suited one is used with a specific expert
system to reduce the error.
Definition: A graph that defines how each point in the input space is mapped to
membership value between 0 and 1. Input space is often referred to as the universe
of discourse or universal set (u), which contains all the possible elements of concern
in each particular application.
There are largely three types of fuzzifiers:
Singleton fuzzifier
Gaussian fuzzifier
Trapezoidal or triangular fuzzifier
What is Fuzzy Control?
It is a technique to embody human-like thinkings into a control system.
It may not be designed to give accurate reasoning but it is designed to give
acceptable reasoning.
It can emulate human deductive thinking, that is, the process people use to
infer conclusions from what they know.
Any uncertainties can be easily dealt with the help of fuzzy logic.
Advantages of Fuzzy Logic System
This system can work with any type of inputs whether it is imprecise,
distorted or noisy input information.
The construction of Fuzzy Logic Systems is easy and understandable.
Fuzzy logic comes with mathematical concepts of set theory and the
reasoning of that is quite simple.
It provides a very efficient solution to complex problems in all fields of
life as it resembles human reasoning and decision-making.
The algorithms can be described with little data, so little memory is
required.
Disadvantages of Fuzzy Logic Systems
Many researchers proposed different ways to solve a given problem
through fuzzy logic which leads to ambiguity. There is no systematic
approach to solve a given problem through fuzzy logic.
Proof of its characteristics is difficult or impossible in most cases because
every time we do not get a mathematical description of our approach.
As fuzzy logic works on precise as well as imprecise data so most of the
time accuracy is compromised.
Application
It is used in the aerospace field for altitude control of spacecraft and
satellites.
It has been used in the automotive system for speed control, traffic
control.
It is used for decision-making support systems and personal evaluation in
the large company business.
It has application in the chemical industry for controlling the pH, drying,
chemical distillation process.
Fuzzy logic is used in Natural language processing and various intensive
applications in Artificial Intelligence.
Fuzzy logic is extensively used in modern control systems such as expert
systems.
Fuzzy Logic is used with Neural Networks as it mimics how a person
would make decisions, only much faster. It is done by Aggregation of data
and changing it into more meaningful data by forming partial truths as
Fuzzy sets.
Bayes' Rule:
Bayes' Rule is the most important rule in data science. It is the
mathematical rule that describes how to update a belief, given some
evidence. In other words – it describes the act of learning.
Conditional probability
The first concept to understand is conditional probability.
You may already be familiar with probability in general. It lets you
reason about uncertain events with the precision and rigour of
mathematics.
Conditional probability is the bridge that lets you talk about how
multiple uncertain events are related. It lets you talk about how the
probability of an event can vary under different conditions.
P(A|B)
Which is read as "the probability of event A occurring, given event
B occurs".
The final step will cover how various computational tricks let you
make use of Bayes' Rule to solve non-trivial problems.
Bayesian networks:
A Bayesian network is a type of graphical model that uses probability to determine
the occurrence of an event. It is also known as a belief network or a causal network.
It consists of directed cyclic graphs (DCGs) and a table of conditional probabilities to
find out the probability of an event happening. It contains nodes and edges, where
edges connect the nodes. The graph is acyclic - meaning there is no direct path
where one node can reach another. The table of probability, on the other hand,
shows the likelihood that a random variable will take on certain values.
The above image illustrates a directed acyclic graph. There are five nodes, namely,
a, b, c, d, and e. From the above graph, we can get the following information:
1. Node a is the parent of node b, c, and e, and node b, c, and e are the child nodes of
node a.
2. Node b and c are the parent nodes of d.
3. Node e is the child node of nodes d, c, and a.
It is important to note the relationships between the nodes. Bayesian networks fall
under probabilistic graphical techniques; hence, probability plays a crucial role in
defining the relationship among these nodes.
There are two types of probabilities that you need to be fully aware of in Bayesian
networks:
1. Joint probability
2. Conditional probability
Conditional probability defines the probability that event B will occur, given that event
A has already occurred. There are two ways joint probability can be represented:
Links act as causal dependencies that define the relationship between the nodes.
Both Chris and Martin call when there is an alarm.
Let’s write the probability distribution function formula for the above five nodes.
Now, let's look at the observed values for each of the nodes with the table of
probabilities:
Node B:
Node E:
Node A:
Node C:
Node M:
Based on the above observed values, the conditional values can be derived and,
therefore, the probability distribution can be calculated.
Node A:
Node C:
Node M:
What is the probability of both Chris and Martin calling, but neither a burglary nor an
earthquake has occurred?
6. Turbo code: Turbo codes are a type of error correction code capable of achieving
very high data rates and long distances between error correcting nodes in a
communications system.
***************************
Mini-Max Algorithm:
o Mini-max algorithm is a recursive or backtracking algorithm which is used in decision-making and game
theory. It provides an optimal move for the player assuming that opponent is also playing optimally.
o Min-Max algorithm is mostly used for game playing in AI. Such as Chess, Checkers, tic-tac-toe, go, and
various tow-players game. This Algorithm computes the minimax decision for the current state.
o In this algorithm two players play the game, one is called MAX and other is called MIN.
o Both the players fight it as the opponent player gets the minimum benefit while they get the maximum
benefit.
o Both Players of the game are opponent of each other, where MAX will select the maximized value and
game tree.
o The minimax algorithm proceeds all the way down to the terminal node of the tree, then backtrack the
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 4: Now it's a turn for Maximizer, and it will again choose the maximum of all
nodes value and find the maximum value for the root node. In this game tree, there
are only 4 layers, hence we reach immediately to the root node, but in real games,
there will be more than 4 layers.
That was the complete workflow of the minimax two player game.
2. Beta: The best (lowest-value) choice we have found so far at any point
along the path of Minimizer. The initial value of beta is +∞.
Note: To better understand this topic, kindly study the minimax algorithm.
1. α>=β
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.
Step 3: Now algorithm backtrack to node B, where the value of β will change as this
is a turn of Min, Now β= +∞, will compare with the available subsequent nodes
value, i.e. min (∞, 3) = 3, hence at node B now α= -∞, and β= 3.
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.
Step 5: At next step, algorithm again backtrack the tree, from node B to node A. At
node A, the value of alpha will be changed the maximum available value is 3 as max
(-∞, 3)= 3, and β= +∞, these two values now passes to right successor of A which is
Node C.
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.
Step 8: C now returns the value of 1 to A here the best value for A is max (3, 1) = 3.
Following is the final game tree which is the showing the nodes which are computed
and nodes which has never computed. Hence the optimal value for the maximizer is
3 for this example.
Goal Stack Planning (in short GSP) is the one of the simplest planning algorithm
that is designed to handle problems having compound goals. And it utilizes STRIP
as a formal language for specifying and manipulating the world with which it is
working.
This approach uses a Stack for plan generation. The stack can contain Sub-goal
and actions described using predicates. The Sub-goals can be solved one by one in
any order.
Step-3: If the stack top is a single unsatisfied goal. It replaces it with an action that
makes it
satisfied and push the action’s precondition on the stack.
Step-4: If stack top is an action, pop it from the stack, execute it and change the
knowledge base by the action’s effects.
Algorithm:
Push the Goal state in to the Stack
Push the individual Predicates of the Goal State into the Stack
IF E is a Predicate
IF E is True then
Do Nothing
ELSE
Push the individual predicates of the Precondition of the action into the Stack
Else IF E is an Action
Apply the action to the current State.
Example :
Lets start here with the example above, the initial state is our current description of
our world. The Goal state is what we have to achieve. The following list of actions
can be applied to the various situation in our problem.
Next push the individual predicates of the goal into the stack.
Now pop an element out from the stack
The popped element is indicated with a strike-through in the above diagram. The
element is ON(B,D) which is a predicate and it is not true in our current world. So
the next step is to push the relevant action which could achieve the subgoal
ON(B,D) in to the stack.
Now again push the precondition of the action Stack(B,D) into the stack.
The preconditions are highlighted with red and the actions are marked with Bold.
Now coming to the point we have to make the precondition to become true in order
to apply the action. Here we need to note an interesting thing about the
preconditions that, it can be pushed into the stack in any order but in certain
situations we have to make some exception and that is clearly seen in the above
diagram. The HOLDING(B) is pushed first and CLEAR(D) is pushed next
indicating that the HOLDING subgoal has to be done second comparing with the
CLEAR. Because we are considering the block world with single arm robot and
everything that we usually do here is depending on the robotic arm if we first
achieve HOLDING(D) then we have to undo the subgoal in order the achieve some
other subgoal. So if our compound goal has HOLDING (x) subgoal, achieve it at
the end.
*****************************
6) Machine Learning
In this topic, we will provide a detailed description of the types of Machine Learning along
with their respective algorithms:
The main goal of the supervised learning technique is to map the input
variable(x) with the output variable(y). Some real-world applications of supervised
learning are Risk Assessment, Fraud Detection, Spam filtering, etc.
o Classification
o Regression
a) Classification
Classification algorithms are used to solve the classification problems in which the
output variable is categorical, such as "Yes" or No, Male or Female, Red or Blue,
etc. The classification algorithms predict the categories present in the dataset. Some
real-world examples of classification algorithms are Spam Detection, Email
filtering, etc.
b) Regression
o Since supervised learning work with the labelled dataset so we can have an
exact idea about the classes of objects.
o These algorithms are helpful in predicting the output on the basis of prior
experience.
Disadvantages:
o Image Segmentation:
Supervised Learning algorithms are used in image segmentation. In this
process, image classification is performed on different image data with pre-
defined labels.
o Medical Diagnosis:
Supervised algorithms are also used in the medical field for diagnosis
purposes. It is done by using medical images and past labelled data with
labels for disease conditions. With such a process, the machine can identify a
disease for the new patients.
o Fraud Detection - Supervised Learning classification algorithms are used for
identifying fraud transactions, fraud customers, etc. It is done by using historic
data to identify the patterns that can lead to possible fraud.
o Spam detection - In spam detection & filtering, classification algorithms are
used. These algorithms classify an email as spam or not spam. The spam
emails are sent to the spam folder.
o Speech Recognition - Supervised learning algorithms are also used in speech
recognition. The algorithm is trained with voice data, and various
identifications can be done using the same, such as voice-activated
passwords, voice commands, etc.
In unsupervised learning, the models are trained with the data that is neither
classified nor labelled, and the model acts on that data without any supervision.
So, now the machine will discover its patterns and differences, such as colour
difference, shape difference, and predict the output when it is tested with the test
dataset
o Clustering
o Association
1) Clustering:
The clustering technique is used when we want to find the inherent groups from the
data. It is a way to group the objects into a cluster such that the objects with the
most similarities remain in one group and have fewer or no similarities with the
objects of other groups. An example of the clustering algorithm is grouping the
customers by their purchasing behaviour.
2) Association:
Some popular algorithms of Association rule learning are Apriori Algorithm, Eclat,
FP-growth algorithm.
Disadvantages:
3. Semi-Supervised Learning
Semi-Supervised learning is a type of Machine Learning algorithm that lies
between Supervised and Unsupervised machine learning. It represents the
intermediate ground between Supervised (With Labelled training data) and
Unsupervised learning (with no labelled training data) algorithms and uses the
combination of labelled and unlabeled datasets during the training period.
Disadvantages:
4. Reinforcement Learning
Reinforcement learning works on a feedback-based process, in which an AI
agent (A software component) automatically explore its surrounding by hitting
& trail, taking action, learning from experiences, and improving its
performance. Agent gets rewarded for each good action and get punished for each
bad action; hence the goal of reinforcement learning agent is to maximize the
rewards.
The reinforcement learning process is similar to a human being; for example, a child
learns various things by experiences in his day-to-day life. An example of
reinforcement learning is to play a game, where the Game is the environment, moves
of an agent at each step define states, and the goal of the agent is to get a high
score. Agent receives feedback in terms of punishment and rewards.
Due to its way of working, reinforcement learning is employed in different fields such
as Game theory, Operation Research, Information theory, multi-agent systems.
A reinforcement learning problem can be formalized using Markov Decision
Process(MDP). In MDP, the agent constantly interacts with the environment and
performs actions; at each action, the environment responds and generates a new
state.
o Video Games:
RL algorithms are much popular in gaming applications. It is used to gain
super-human performance. Some popular games that use RL algorithms
are AlphaGO and AlphaGO Zero.
o Resource Management:
The "Resource Management with Deep Reinforcement Learning" paper
showed that how to use RL in computer to automatically learn and schedule
resources to wait for different jobs in order to minimize average job
slowdown.
o Robotics:
RL is widely being used in Robotics applications. Robots are used in the
industrial and manufacturing area, and these robots are made more powerful
with reinforcement learning. There are different industries that have their
vision of building intelligent robots using AI and Machine learning technology.
o Text Mining
Text-mining, one of the great applications of NLP, is now being implemented
with the help of Reinforcement Learning by Salesforce company.
Advantages and Disadvantages of Reinforcement
Learning
Advantages
Disadvantage
The curse of dimensionality limits reinforcement learning for real physical system.
Euclidean Distance
This is nothing but the cartesian distance between the two points which are in the
plane/hyperplane. Euclidean distance can also be visualized as the length of the
straight line that joins the two points which are into consideration. This metric helps
us calculate the net displacement done between the two states of an object.
Manhattan Distance
This distance metric is generally used when we are interested in the total distance
traveled by the object instead of the displacement. This metric is calculated by
summing the absolute difference between the coordinates of the points in n-
dimensions.
Minkowski Distance
We can say that the Euclidean, as well as the Manhattan distance, are special cases
of the Minkowski distance.
From the formula above we can say that when p = 2 then it is the same as the
formula for the Euclidean distance and when p = 1 then we obtain the formula for
the Manhattan distance.
The above-discussed metrics are most common while dealing with a Machine
Learning problem but there are other distance metrics as well like Hamming
Distance which come in handy while dealing with problems that require overlapping
comparisons between two vectors whose contents can be boolean as well as string
values.
Applications of the KNN Algorithm
Data Preprocessing – While dealing with any Machine Learning problem
we first perform the EDA part in which if we find that the data contains
missing values then there are multiple imputation methods are available as
well. One of such method is KNN Imputer which is quite effective ad
generally used for sophisticated imputation methodologies.
Pattern Recognition – KNN algorithms work very well if you have
trained a KNN algorithm using the MNIST dataset and then performed the
evaluation process then you must have come across the fact that the
accuracy is too high.
Recommendation Engines – The main task which is performed by a
KNN algorithm is to assign a new query point to a pre-existed group that
has been created using a huge corpus of datasets. This is exactly what is
required in the recommender systems to assign each user to a particular
group and then provide them recommendations based on that group’s
preferences.
Advantages of the KNN Algorithm:
*******************************