Ai Expert Book
Ai Expert Book
Problem-Solving agents:
In AI, Search techniques are universal problem- solving methods. Rational agents
Algorithms or Problem-solving mostly used these search strategies to solve a specific
problem and provide the best result.
Problem-Solving agents are the goal-based agents and use atomic representation.
1) Search
Searching is a step-by-step procedure to solve a search-problem in a given search
space. A Search problem can have 3 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.
2) Search tree
A tree representation of search problem is called search tree. The root of the search
tree is the root node is corresponding to the initial state.
3) Actions
It gives the description of all the available action to the agent.
4) Transition model
A description of what each action do can be represented as a transition mode.
5) Path cost
It is a function which assigns a numeric cost to each path.
6) Solution
It is an action sequence which leads from the start node to the goal node.
7) Optimal Solution
If a solution has the lowest cost among all solutions.
Properties of Search Alogrithms:
Algorithms:
Completeness
Optimality
Time Complexity
Space Complexity
Completeness:
Time Complexity:
Space Complexity:
It is the maximum storage space required at any point during the search, as the
complexity of the problem.
Search Algorithms:
Search Algorithms are classified into uniformed (Blind search) search and informed
search (Heuristic search) algorithms.
Search Algorithms:
Uninformed/Blind
o Breadth First Search
o Uniform Cost Search
o Depth First Search
o Depth Limited Search
o Iterative Deeping Depth
o Bidirectional Search
Informed Search
o Best First Search
o A*Search
Uninformed/Blind Search:
The uninformed search does not contain any domain knowledge such as closeness, the
location of the goal.
Breadth-first search is the most common search strategy for traversing a tree or graph. The
algorithm searches breadth wise in a tree or graph.
Advantages:
Disadvantages:
Example:
SA → B →C → D → GHE−FK
Depth-first Search:
It starts from the root node and follows each path to its greatest depth node before
moving to the next path.
DFS uses a stack data structure for its implementation.
The process of the DFS algorithm is similar to the BFS algorithm.
Advantages:
Examples:
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 it has no other goal node is not found. After it
will traverse node C and then by, and it will terminate as it found goal node.
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 can use search technique such as BFS, DFS, DLS, etc.
Example:
This algorithm divides one graph/tree into two sub graphs. Its stark traversing from node. In
the forward direction and starts from goal node 16 in the backward direction.
The algorithm terminates at node a where two searches meet Root node.
Solving Problems:
Using logical search mechanisms. It employ such algorithms to determine the quickest or
shortest path between two locations.
Search Programming:
Many AI activities can be coded in terms of searching, which improves the formulation of a
given Problems solution.
Goal-based agents:
It’s efficiency is improved through search algorithms. It can offer the finest resolution to an
isave to solve it
Production systems use search, algorithm in AI to find the rules that can lead to the required
action
1. BFS:
a. Time complexity of BFS algorithm can be obtained by the number of nodes
traversed in BFS.
b. T(b) = 1+b^2+b^2++bd = 0 (bd) where dis depth of shallowest solution and b
is a node at every state.
c. The space complexity of BFS algorithm is o(bd).
d. BFS is complete and optimal.
2. DFS
a. Time complexity of DFS will be equivalent to the node traversed by the
algorithm T(n)=1+n^2+n^3+…-c(n^m) depth of any node.
b. Space complexity of DFS is equivalent size, which is (bm).
c. DFS algorithm is complete within finite state space.
d. DFS algorithm non-optimal, as it may generate a large number of steps
Advantages:
DFS requires very less memory. It takes less time to reach to the goal node.
Disadvantages:
3. DLS:
a. The traversal path will be S → A → C → D→ B→ I → J
b. The time complexity of DLS algorithm is o(b^a).
c. The space complexity of D is algorithm is O(be).
d. DLS algorithm is complete if the solution is above the depth-limit
Advantages:
DLS is memory efficient.
Disadvantages:
DIS also has a disadvantage of incompleteness.
4. UCS:
a. The traversal path will be, S → A → D →G
b. The worst-case time complexity of Uniform cost search is DCb+[C/2].
c. The worst-case space complexity of Uniform-cost search is DCb[C/E].
d. Uniform cast search is optimal- Advantages
Disadvantages:
The algorithm may be stuck in an infinite.
5. IDDFS:
a. IDDFS algorithm is optimal.
b. This algorithm is complete.
c. The space complexity of IDDFS will be o(b^d).
d. The worst time complexity is o(b^d).
Advantages:
Disadvantage:
The main drawback of IDDFS is that it repeats all the work of the previous phase.
6. BSA:
a. Time complexity of bidirectional search using BFS is o(bd).
b. Space complexity of bidirectional search is o(bd)
c. Bidirectional search is optimal
d. Bidirectional search is complete, if we BFS in both searches
Advantages:
Disadvantages:
Informed search:
h(x), evaluates the successive node based on how close to the target node.
The total cost for the path( A →C → E ) evaluates 10. Which is the lowest cost, breedy best
first search always ignored the path, because it does not consider the edge weights.
A*Search:
A* Tree search, known as A ^k search, combines the strengths of uniform- cost search and
greedy search.
A heuristic function is used to determine the estimated cost and estimate the distance
between the current node and the desired need.
A*search determine lowest cost between any two nodes. This algorithm is a variant of
Dijkstra’s algorithm.
The evaluation function F(x) for the areas where in parameters were located after the
instructions that are particular to the task.
Entirely.
Variables
Domains
Constraints
1) Variables:
Variables represent the entities or Components of the problem that weed to be
assigned Values for eg in a scheduling problem, variables might represent time slots
or tasks.
2) Domains:
Fach variable has an associated domain, which defines the set of values that the
variables can take. For instance, in scheduling , the domain of a time slot variable
might be a list of i available times.
3) Constraints:
Constraints are the rules or conditions that specify relationships between variables.
They restrict the combinations of values that variables can conditions that specify
relationships between variable constraints can be unary(single variable) or binary(two
variable).
Example:
1) Sudoku puzzles: In sudoku, the variables are the empty cells, the domains are
numbers from 1to9 , and the constraints entire that no number is repeated in a
row,column or 3*3 subgrid
2) Map Colouring : In the map colouring problem, Variables represent regions or
countries, domains represent available colours, and constraints ensure that adjacent
regions must have different colours.
Local search optimization algorithms that are used to find the best possible solution
within a given search space.
The basic working principle of a local search algorithm involves the following steps.
Initialization:
Start with an initial solution, which can be generated randomly or through some heuristic
method.
Evaluation:
Evaluate the quality of the initial sdation using an objective function ov a firi fitness
measure.
Neighbour Generation:
Generate a set of neighbouring solutions by making minor changes to the current solution.
These changes are typically referred to as “moves”.
Selection:
Choose one of the neighbouring solutions Cho based on a criterion, such as the
improvement in the objective function value. These steps determine the direction in which
the search proceeds.
Termination:
Continue the process iteratively, moving to the Selected neiboring solution, and repeating
steps 2 to 4 until a termination condition is met.
Example
1) Hill dimbing:
a) Hill climbing is a straightforward local search algorithm that starts with an
initial solution and iteratively moves to the best neighboring solution that
improves the objective function.
b) Initialization, Evaluation, Neighbor bjeneration Selection, Termination(eg:
reaching a maximum number of iterations or finding a satisfactory solution)
c) Hill climbing has a limitation in that it can get stuck in local optima, which
are solutions that are better than their neighbours but not necessarily the best
overall solution.
Types Of Reasoning:
Deducting Reasoning
Common Sense Reasoning
Inductive Reasoning
Monotonic Reasoning
Abductive Reasoning
Non-Monotonic Reasoning
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.
In Deductive Reasoning, the truth of the premises guarantees the truth of the
conclusion.
Example:
Premise-1: All the human eats veggies.
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 states with single or multiple
observations then seeks to find the most likely explanation or conclusion for the observation.
Example:
Implication: Cricket ground is wet if it is raining.
Conclusion: It is raining.
Common Sense Reasoning simulates the human ability to make presumptions about
events which occurs on every day.
Example:
1. One can be at one place at a time.
5. Monotonic Reasoning:
In this 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 and not useful for
the real-time systems.
In this, adding knowledge does not decrease the set of prepositions that can be derived.
Example:
Earth revolves around the sun.
It is a true fact, and it cannot be changed even if we add another sentence in knowledge
base like, “The Moon revolves around the Earth”, or “Earth is not round”, etc.
6. Non-Monotonic Reasoning:
In Non-Monotonic Reasoning some conclusions may be invalidated if we add some
more information to our knowledge base.
Example:
1) Birds can fly.
2) Penguins cannot fly.
3) Pitty is a bird.
If we add one another sentence into knowledge base “Pitty is a Penguin”, which concludes
“Pitty cannot fly”, so it invalidates the above conclusion.
2) Symbolic Reasoning:
Symbol Artificial Intelligence (AI) is a sub-field of AI that focuses on the processing
and manipulation of symbols or concepts, rather than numerical data.
Example: If the patient reports having a fever, the system might use the following rule.
If patient has a fever AND patient has a cough AND patient has difficulty in breathing
THEN patient may have pneumonia.
Uncertainty:
Knowledge representation with first-order logic and propositional logic is based on
certainty, means we are sure about the predicates.
Example:
A B, which means if A is true then B is true, but what about the situation where we
are not sure about whether A is true or not then we cannot express this statement, this
situation comes under uncertainty.
Causes Of Uncertainty:
1) Information occurred from unreliable sources.
2) Experimental Errors.
3) Equipment Fault.
4) Temperature Variation.
5) Climate Change.
Probabilistic Reasoning:
Unpredictable Outcomes.
Predicates are too large to handle.
Unknown error occurs.
Bayes’ rule.
Bayesian Statistics.
Bayes’ Rule:
It determines the probability of an event with uncertain knowledge.
Value of P (B/A) with the knowledge of P (A/B).
P (B)
P (A) is called the Prior Probability. Probability of hypothesis before considering the
evidence.
P (B) is called Marginal Probability, pure probability of an evidence.
Example:
A Doctor is aware that disease meningitis causes a patient to have a stiff neck, and it
occurs 80% of the time. He is also aware of some more facts, which are given as follows:
The known probability that a patient has meningitis disease is 1/30,000. The known
probability that a patient has a stiff neck is 2%.
P (a/b) = 0.8
P (b) = 1/30000
P (a) = 0.02
P (b/a) = P (a/b) P (b) = 0.8 + (1/30000) = 0.001333333
P (a) 0.02
Bayesian Network:
A Bayesian Network is a probabilistic graphical model which represents a set variables
and their conditional dependencies using a directed acyclic graph.
Semantic Network:
A Semantic Network (SN) is a simple notation scheme for logical knowledge
representation.
A SN consists of a concepts and relations between concepts.
Representing a SN with a directed graph,
1) Vertices: denote concepts.
2) Edges: represent relation between concepts.
The graphical depiction associated with a SN is a significant reason for their
popularity.
Semantic Networks can show natural relationships between objects/concepts.
Uses of Semantic Nets,
1) Coding static World Knowledge.
2) Built-in fast inference method.
3) Localization of information.
Example:
“A Sparrow is a bird”.
Two concept: “Sparrow” and “bird”.
Sparrow is a kind of bird, so connect the two concepts with a IS-A
relation.
This is a higher-lower relation or abstract-concrete relation.
Frames:
Frame is a collection of attributes called as slots and associated values that describe
some entity in the world (filler).
It contains information as attributes – value pairs, default values, etc.
Example:
An example frame corresponding to the semantic net.
(Twenty
(SPECIES (VALUE bird))
(COLOUR (VALUE yellow))
(ACTIVITY (VALUE fly))
Example:
It should be noted that this representation is same for different saying with same
meaning.
Example:
Example:
UNIT-III
KNOWLEDGE REPRESENTATION
The way knowledge is encoded. How machines do all these things comes under knowledge
representation and reasoning.
I. Declarative knowledge
It includes concepts facts and objects.
It also called descriptive knowledge and expressed in declarative sentences.
It is simpler than procedural language.
Example:
Medical diagnosis: Declarative knowledge includes a knowledge base of
symptoms, diseases and their relationships, enabling a system to provide
accurate diagnoses
II. Heuristic knowledge
Heuristic knowledge is representing knowledge of some experts in a field or
subject.
It is rules of thumb based on previous experiences, awareness of approaches
and which are good work but not guaranteed.
Examples:
A study of planning, tagging and learning.
III. Meta knowledge
Knowledge about the other types of knowledge is called meta-knowledge.
Example:
A study at planning, tagging and learning.
IV. Procedural knowledge
It is also known as imperative knowledge.
It is a type of knowledge which is responsible for knowing how to do
something.
It includes rules, strategies, procedures, agendas, etc.
Example
Writing a sorting algorithm: procedural knowledge involves understanding the
specific steps, such as bubble sort or quicksort, sort a list of elements.
V. Structural knowledge
It is describes relationships between variables concepts such as kind of part of
grouping of something.
It describes the relationship that exists between concepts or objects.
Example:
A Computer keyboard has keys and an acoustic instrument has strings.
Ai Knowledge Cycle
Perception
Learning
Knowledge representation and reasoning
Planning
Execution
In this diagram how an AI System can interact with real world and what components help,
it to show intelligence.
Learning
Perception
Knowledge Reasoning
representation
Planning
Education
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 for learning from data captured by perception
comportment.
The main components are knowledge representation and reasoning & it involved in
showing the intelligence in machine like humans & these are independent with each
other but also coupled together.
The planning and execution depend on analysis of knowledge representation and
reasoning.
Logical representation
Semantic Network representation
Production rules
Frame representation
Logical representation
i. Logical representation
Logical representation is a language with some definite rules which
deal with prepositions and has no ambiguity in representation.
It consist of defined syntax and semantics.
SYNTAX SEMANTICS
It refers to the formal structure It refers to the meaning conveyed
or arrangement of symbols and by syntactic structures
rules.
Advantages
Disadvantage
This technique may not be very natural inference may not be very efficient.
ii. Semantic network representation
Semantic networks work as an alternative of predicate logic for knowledge
representation. In Semantic networks, we can represent our knowledge in the form of
graphical networks.
It is consists of two types of relations
IS-A relation(Inheritance)
Kind-of-relation
Example:
Kind - of
car Pick-up truck
IS-A IS-A
Audi BMW
Has Has
headlight
Advantages:
Disadvantage:
Advantage:
Disadvantage:
Advantage:
The Production rules are highly modular and can be easily removed or modified.
Disadvantage:
During the execution of the program many rules may be active. Thus rule-based
production systems are inefficient.
Predicate Logic
∀ - For all ˅- OR
→ - Implies
¬ -Not
Example
First-Order Logic
Example: x, y, z
3. Predicates: Functions that return true or false, depending on the objects n they
are applied.
5. Logical connectives:
Conjunction (˄): P˄Q (P and Q )
Disjunction (˅):P˅Q (P or Q)
Negation(¬):¬ P (not P)
Implication(→):P→ a( if P then Q)
Biconditional(↔):P↔ Q(P if and only if Q)
6. Quantifiers
Universal Quantifier(∀):∀xP(x)
(for all x, P(x) is true)
Existential Quantifer(∃):∃xP(x)
(there exists an x such that P(is) is true)
Rules-Based Systems
It consists of a set of rules, a working memory and an inference engine. The rules are used to
reason about the knowledge in the working memory to derive conclusion or make decisions.
Types of Rules
1) Production Rules
If-then rules that specify a conclusion or action based on conditions
Example: If it is raining, then take an umberella.
2) Semantic Rules:
Define relationships between concepts and Objects.
Example: A car is a type of vehicle.
3) Procedural Rules:
Special a sequence of actions to perform a task.
Example: To make a cup of coffee, first, boil water, then add coffee powder, sugar,
milk etc..
Components of a Rule:
Advantages:
Syntactic representation refers to the formal structure or arrangement of symbols and rules
used to construct valid statements or expressions in a given language.
Examples:
Semantic Representation
Logic is used to represent knowledge using logical statements, rules and inference
techniques.
It provides a formal way to reason about knowledge, making it possible to draw
conclusions, make decisions and solve problems.
Slot is an attribute value pair in its simplest form. Filler is a value that a slot can take
could be a numeric, string value or a pointer to another slot.
Slot filter are used to represent knowledge using a frame a-based structures.
Slots represent attributes or properties.
Fillers represent the values or instances of those attributes.
Slot fillers are often used in semantic networks, frames, and ontologies to represent
knowledge in a structured and organized way.
Examples:
Frame: person
For e.g : Consider a knowledge base that represents information about people, including their
name, age and occupation.
Slot fillers can be used to represent the attributes and values of individual people,such as
By combining logic and slot fillers, the knowledge base can reason about the knowledge base
can reason about the knowledge and make Inferences, such as
Game playing is an important domain of Artificial Intelligence. Game don’t require much
knowledge. the only knowledge use need to provide is the rules, legal moves and the
conditions of winning or losing the game.
Game-playing as search
With the complication of an opponent
Evaluation functions
Minmax principle
Alpha-beta pruning
Heuristic techniques
Generate Procedure : So that only good moves are generated.
Test procedure: So that the best move can be explored first.
TWO MAIN APPROACHES
Rule-based Systems
Machine Learning-based systems
Rule-based systems
Computational Complexity
Limited Generalization
Lack of Creativity
Complexity of Game Rules
Game: TIC-TAC-TOE
Objective: Max aims to win or draw the game by making optimal moves
AI Program:Max
Game play
Max’s Turn: Max makes the 1st move,placing its symbols(x) in position 5.
Max’s Turn: Max analyzes the board and decides to place its symbols(x) in position 9
o x
Max’s Turn: Max analyzes the board again and decides to place the symbols(x) in position 6
x x
o x
o o
x x
o x
Max’s Turn: Max analyzes the board and decides to place the symbol(x) in Position 7
o o
x x
x o x
Minimal Search
Key Components
1) Graph: A graph represents the search space, consisting of nodes & edges.
2) Initial State: The starting point of the search.
3) Goal State: The desired outcome or solution.
Applications:
1) Pathfinding: Finding the shortest path in video games, GPS navigation, roboatics
2) Problem soving: Solving puzzles, such as the sliding file puzzle
Advantage:
Alpha-Beta Cutoff
Alpha cutoffs are applied by the maximizing player, cutsoff moves at minimizing level.
Beta cutoffs are applied by the minimizing player(the opponent) cuts of moves at maximizing
player
Alpha-Beta Cutoff
When the algorithm determines that a node’s score is outside the alpha-beta window. It stops
exploring that branch of the tree. This is known as an alpha-beta cutoff.
Two Parameters
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 - ∞
BETA: The best(lowest-value) choice we have found so far at any point along the path of
minimizer. The initial value of alpha is + ∞
How It works:
Node A (score=5)
A, B, C,D Node A is the root node, and nodes B, C, D are its childen
Alpha (∞)=4
Beta(β)=8
We start by evaluating node A. Since its score(5) is within the alpha-beta window(4-8), we
expand its children
Next, we evaluate node B. Its score(3) is less than alpha(4), so we can prune this branch.
We don’t need to evaluate nodes C and D because the score of node B is already outside the
alpha-beta window
Diagram
5 A
C
3 7
B
2
D
In this diagram, the alpha-beta cutoff occurs at node B because its score (3) is less than
alpha(4). We prune the branch and don’t evaluate nodes C and D.
After evaluating a few nodes, we reach a node with a score of 3, which is less than alpha(4).
We can stop exploring their branch.
By applying alpha-beta cutoff, we reduce the number of nodes to be evaluated making the
algorithm more efficient.
How it works
Key Components
1. Planning problems: A planning problem consists of an initial state, a goal state, and a
set of actions.
2. Actions: A plan is a sequence of actions of that achieves the goals
Advantages:
Example:
Actions:
Using iterative deepening planning, we can generate a plan to achieve the goal.
Depth limit=1:
Move Forward
Depth limit=2:
Move Forward
Turn left
In this example, iterative deepening planning is used to generate a plan to move the robot
from location A to location C. The depth limit is gradually increased until the goal is
achieved.
Component Of Planning System
Types of planning in AI
Classical planning
Temporal planning
Hierarchical planning
CLASSICAL PLANNING
A series of actions is created to accomplish a goal in a predetermined setting.
It assumes that everything is static and predictable.
HIERARCHICAL PLANNING
By dividing large problems into smaller once, hierarchical planning makes
planning more effective.
TEMPORAL PLANNING
Planning for the future considers time restrictions and interdependencies between
actions. It ensures that the plan is workable within a certain time limit by taking
into account the duration of tasks.
Benefits of AI planning
Resource Allocation
Better Decision Making
Automation of Complex tasks
Application of AI planning
List of Predicates
B C D
A C D A B
Initial state
B
B D
C
A2- PUTOWN(C)
A D
1-PICKUP(C)
C
A C D A D B
3-UNSTACK(B, A)
C 4-PUTDOWN(B
C
B
A D A D B
5-PICKUP(C) 6-STACK(C, A)
C C B
A D A D
7-PICKUP(B) 8-STACK(B, D)
GOAL STATE
I. There are two players one is called Maximizer and other is called minimizer.
II. Maximizer will try to get the maximum possible score, and minimizer will try to get
the minimum possible score
III. This algorithm applies DFS, we have to go all the way through the leaves to reach the
terminal nodes.
IV. At the terminal node, the terminal values are given so we will compare those and
backtrack the tree until the initial state occurs.
V. Main steps involved in solving the two-player game tree.
Step 1: The algorithm generates the entire game-tree and apply the utility function to get
the utility values for the terminal states.
=>Maximizer
A
=>Minimizer
B C
D E G
H F O
I J K L M N
=>Maximizer
-1
7 =>Terminal node
Step 2: Now, we find the utilities value for the Maximizer,
0 its initial value is -∞, so we will
4
2 value in
compare each 6 terminal-3
state with-5initial value of Maximizer and determines the
higher node values. It will find the maximum among the all
Step 3: It’s a two of minimizer, so it will compare all nodes value with +∞, and will find the
3rd layer node values
=> Maximier
A
=> Minimizer
4 -3 => Maximizer
B C
7 => Terminal node
G
4 D 6 3
E F O
N 7
H M
I J K L 0
-1 -5
4 2 6 -3
Step 4:For node A max(4, -3)=4
4 => Maximier
A
=> Minimizer
4 -3 => Maximizer
B C
7
G
4 D 6 -3 => Terminal node
E F O
N 7
H M
I J K L 0
-1 -5
4 2 6 -3
This was the completer workflow of the minmax two player game.
Step 1: Max player will start first move from node A where α=-∞ and β=+∞.
α= -∞ => Max
A
β=∞ => Min
=> Max
B C
7
G
4 D 6 -3 5 => Terminal node
E F
7
2 1
3 5 9 0
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
α= -∞ => Max
A
B C
α= -∞ β=∞ => Min
β=3 3 => Max
=> Terminal node
α =3
3 5
β =∞
7
2 1
3 5 9 0
Step 5: Alpha value changed the maximum available value is 3 as max (-∞, 3)=3 β =+∞
=> Max
A
α =3 => Min
B C
3 β =∞
α =3 => Max
β =∞ G
D F => Terminal node
E
G 5
2 3 5 9 0 1 7
α =3 => Min
B C
3 β =1
=> Max
3 =>Max
A
=> Min
B C
3
=> Max
Depth=1
D
B
C
Depth=2
E
H
F G
Depth=3
I J K L M N
Depth=4
O P R S
The starting node is A and the depth initialized to O. The goal node R to find the depth and
path to reach it.
DEPTH={0,1,2,3,4}
0 A
1 ABCD
2 ABEFCGDH
3 ABEIFJKCGLDHMN
4 A B E I F J K O P C G L D HMNS
UNIT-IV
NLP:
NLP is a field of computer science, artificial intelligence and linguistics that studies how
humans and computers interact with language.
Is Nlp Ai Or Ml?
NLP is a subfield of computer science and artificial intelligence(AI) that uses machine
learning to enable computers to understand and communicate with human language.
Syntactic Analysis:
Syntactic analysis is used to check grammar,word arrangements
and shows the relationship among the words.
Semantic Analysis:
Syntactic analysis is concerned with the meaning
representation. It mainly focuses on the literal meaning of
words, phrases and sentences.
Discourse Integration:
Discourse integration depends upon the sentences that proceeds
it and also invokes the meaning of the sentence that follow it.
Pragmatic Analysis:
It helps you to discover the intended effect by applying a set of
rules that characterize cooperative dialogues.
Advantages Of Nlp:
NLP helps users to ask questions about any subject and get a
direct response within seconds.
Disadvantages Of Nlp:
NLP is unpredictable.
NLP may not show context
NLP may require more keystrokes.
Nlp Techniques:
NLP encompasses a wide array of technique that aimed at enabling computers to
process and understand human language.
• Removing common words(like “and” , “the” , “is”) that may not carry
significant meaning.
• Semantic Analysis
• Identifying and classifying entities in text, such as names of people,
organizations,locations,dates,etc.,
• Question Answering
• Retrival based QA: Finding and returning the most relevant text passage in
response to a query.
This involves identifying the different parts of speech in a sentence, such as nouns,
verbs, adjectives, adverbs and how they relate to each other in order to give proper
meaning to the sentence.
“cat” as a noun
“sat” as a verb
“on” as a preposition
“mat” as a noun
It would also involve understanding that “cat” is the subject of the sentence and “mat” is the
object.
1. Language translation:
2. Sentiment analysis:
4. Text summarization:
Understanding the syntactic structure of a text helps identify the most important
information.
1. Information Retrieval:
2. Question Answering:
3. Text Summarization:
4. Sentiment Analysis:
It determines the sentiment and emotional tone behind text, such as
detecting positive or negative opinions.
6. Relationship Extraction:
1. Improved understanding:
For example: red, blue, and green are all hyponyms of color, their hypernym.
• Meronomy:
• Synonyms:
• Antonyms:
• Homonyms:
• Relationship extraction
Relationship Extraction:
It determine the semantic relationship between words in a text. In this,
relationship include various entities such as an individuals name,place, company,
designation, etc.,
Example:
Elon Musk is one of the co-founders of Tesla, which is based in Austin, Texas.
This phrase illustrates two different relationships.
1. Parallel processing:
2. Distributed processing:
GOALS:
• Scalability:
Model complex cognitive phenomena that require large-scale processing.
• Flexibility:
Accommodate individual differences and adapt to changing environments.
• Real-time processing:
Enable real-time interaction and feedback.
APPLICATIONS:
• Cognitive architectures:
Integrate parallel and distributed processing into cognitive models.
• Neural networks:
Use parallel and distributed computing to train and deploy neural
networks.
• Multi-agent systems:
Model social behavior and interactions using distributed AI.
• Human-computer interaction:
Develop more natural and intuitive interfaces using parallel and
distributed AI.
• Cognitive robotics:
Control and coordinate robotic behavior using distributed AI.
BENEFITS:
Improved scalability and flexibility
CHALLENGES:
Complexity:
Managing and coordinating parallel and distributed processes
Communication:
Ensuring efficient data exchange between processing units.
Synchronization:
Coordinating tasks and maintaining consistency across processing units
Scalability:
Adapting to large-scale problems and datasets
Interpretability:
Understanding and explaining complex AI models and behaviors.
PARALLELISM:
1. Task parallelism: Dividing a reasoning task into smaller sub-tasks and executing
them concurrently.
2. Data parallelism: Distributing data across multiple processing units and performing
the same reasoning task on each unit.
3. Pipelined parallelism: Breaking down a reasoning task into a series of stages and
executing them concurrently.
DISTRIBUTED PROCESSING:
BENEFITS:
APPLICATIONS:
This model is inspired by the structure and function of the brain and is often used to
describe the processing of information in neural networks.
KEY FEATURES:
Feedforward Networks: Information flows only in one direction, from input nodes
to output nodes.
Recurrent Networks: Information can flow in a loop, allowing for feedback and
recurrent processing.
Memory and Learning: Connectionist models can learn and remember new
information.
Flexibility: Can be used to model a wide range of cognitive tasks and processes.
HOPEFIELD NETWORKS
Hopfield networks are a type of recurrent artificial neural network that serve as a
content-addressable ("associative") memory system with binary threshold nodes.
They are a simple example of a neural network that can store and recall memories.
Recurrent: Hopfield networks have feedback connections, which allow the network
to settle into a stable state.
Binary threshold nodes: Each node in the network has a binary output (0 or 1) and
a threshold value that determines its output.
Symmetric weights: The weights connecting nodes are symmetric, meaning that the
weight from node A to node B is the same as the weight from node B to node A.
Initialization: The network is initialized with a set of random weights and biases.
Training: The network is trained on a set of patterns, where each pattern is a binary
vector.
Storage: The network stores the patterns in its weights and biases.
Machine learning: Hopfield networks can be used as a building block for more
complex machine learning models.
Sensitivity to noise: The network can be sensitive to noise in the input patterns.
NEURAL NETWORKS:
A Neural networks is a machine learning model inspired by the structure and
function of the human brain. It consists of layers of interconnected nodes on
“neurons”. Which process and transmit information.
Image recognition
Natural language processing
Speech recognition
Predictive analysis.
Adaptability: Neural networks are useful for activities where the link between
inputs and outputs is complex or not well defined because they can adapt to new
situations and learn from data.
Pattern Recognition: Their proficiency in pattern recognition renders them
efficacious in tasks like as audio and image identification, natural language
processing, and other intricate data patterns.
Black box Nature: As “black box” models, neural networks pose a problem in
important applications since it is difficult to understand how they make decisions.
So the feedforward neural network has a front-propagated wave only and usually
does not have backpropagation.
But a CNN has one or more than one convolutional layer that uses a convolution
operation on the input and then passes the result obtained in the form of output to the
next layer.
CNN has applications in speech and image processing which is particularly useful in
computer vision.
The advantage of this modular neural network is that it breaks down a large and
complex computational process into smaller components, thus decreasing its
complexity while still obtaining the required output.
RBF functions have two layers. In the first layer, the input is mapped into all the
Radial basis functions in the hidden layer and then the output layer computes the
output in the next step.
Radial basis function nets are normally used to model the data that represents any
underlying trend or function.
The first layer in the RNN is quite similar to the feed-forward neural network and the
recurrent neural network starts once the output of the first layer is computed.
After this layer, each unit will remember some information from the previous step so
that it can act as a memory cell in performing computations.
• User Interface
• Inference Engine
• Knowledge Base
>User Interface
• With the help of a user interface, the expert system interacts with the user, takes
queries as an input in a readable format, and Passes it to the inference engine.
• After getting the response from the inference engine, it displays the output to the user.
In other words, it is an interface that helps a non-expert user to communicate with the
expert system to find a solution
>Inference Engine
• The inference engine is known as the brain of the expert system as it is the main
Processing unit of the system. It applies inference rules to the knowledge base to
derive a conclusion or deduce new information.
• With the help of an Inference engine, the system extracts the knowledge from the
Knowledge base.
• Two types of inference Engine
>Knowledge Base
• The Knowledge base is a type of storage that stores knowledge acquired from the
different experts of the particular domain. It is considered as big storage of
knowledge.
• It is similar to a database that contains information and rules of a particular domain or
subject.
• One can also view the knowledge base as Collections of objects and their attributes.
Such as a lion is an object and its attributes are it is a mammal, it is not a domestic
animal.
Planning and scheduling: The expert systems can also be used for Planning and
scheduling some particular tasks for achieving the goal of that task.
Example: Automated control systems that adjust based on uncertain environmental conditions
or financial forecasting models that handle both quantitative data and fuzzy inputs.
1. Forward chaining:
• "What can happen next?" The inference engine follows the chain of conditions and
derivations and finally deduces the outcome.
• It considers all the facts and rules, and sorts them before concluding to a solution
• This strategy is followed for working on conclusion, result, or effect.
Example, prediction of share market status as an effect of changes in interest rates.
2. Backward chaining:
• An expert system finds out the answer to the question, "Why this happened?"
• On the basis of what has already happened, the inference Engine tries to find out
which conditions could have happened in the past for this result.
• This strategy is followed for finding out cause or reason. Example: diagnosis of
blood cancer in humans
Common Sense
• Common sense is the mental skills that most people share.
• Common Sense is ability to analyze a situation based on its context, using millions of
integrated pieces of common knowledge.
Common sense is what people come to know in the process of growing and living in
the world.
• Common sense knowledge includes the basic facts about events and their effects, facts
about knowledge and how it is obtained, facts about beliefs and desires. It includes the
basic facts about material objects and their properties
• Example: Everyone knows that dropping a glass of water, the glass will break and
water will spill on podium. However, this information is not Obtained by formula or
equation for a falling body or equations governing fluid flow.
• The goal of the formal common sense reasoning community is to encode this implicit
knowledge using format logic Common sense is Identified as:
1. If you have a problem, think of a past situation where you solved a similar problem
2. If you fall at something, imagine how you might have done things differently.
Common sense Architecture:
• The system takes as input a template Produced by information extraction system about
certain aspects of a scenario
The template is a frame with slots and slots fillers
• The template is fed to a script classifier, which classifies what script is active in the
template
• The template and the script are passed to a reasoning problem builder specific to the
script, which converts the template into a commonsense reasoning problem.
• The problem and a commonsense knowledge base are passed to a commonsense
reasoner. It infers and fills in missing details to Produce a model of the input text.
• The model provides a deeper representation of the input, than is provided by the
template alone.
Qualitative physics
• Qualitative physics in AI is a way to study the physical world by representing and
reasoning about it.
• Qualitative physics uses dimensional analysis to solve problems, which requires
Knowledge of physical variables and dimensional representation.
• This allows reasoning about systems and devices without needing to know the
physical laws that govern them.
• for eg:, if a problem involves time period, mass, and spring constant, the variables and
their dimensions are t (T), m [M], K[MT-2].
• Qualitative Physics can also be used to solve physical system problems, and can be
used for tasks like behavior analysis and conceptual design.
Applications of Ontologists in AI
• Expert Systems: Ontologists in AI develop Ontologies that power expert systems,
which mimic human decision-making in a particular domain
• Natural Language Processing: Ontologists in AI use ontologies to improve natural
language processing systems, enabling machines to understand human language
• Decision Support Systems: It support decision-making in complex domains
Data Integration: Ontologists in AI use ontologies to integrate data from multiple
sources, enabling machines to reason about the integrated data.
• Robotics and autonomous system: It enable robots and autonomous systems to
understand their environment and make decisions
Benefits of ontology
• Improved knowledge organization and sharing Enhanced reasoning & decision-
making capabilities.
• Increased data consistency and quality
• Better interoperability and integration
• More explainable and transparent AI Systems
Memory Organization
• Memory Organization provides a framework within which to understand the
relationship between individual identification, duplicate records, and the proper
functioning of AI
• Types of Memory Organization
There are several types of memory Organization used in computer system.
Memory Organization in Artificial Intelligence can include a variety of techniques that help
AI Systems.
1. Versatile applications: We can use them for different industries like healthcare, finance
or engineering
2. Easy modifications: As your needs change, you can quickly adjust your expert system
Built in Features
• Inference Engines: It They are already included, so you don't need to build One from
scratch.
• Explanation facilities: These help users understand how the system reaches its
conclusions
Knowledge base Editors: They make organizing and updating information simple
>User Interface:
>Explanation Facility:
>Inference Engine:
The "brain" of the Expert System
>Rule Builder:
• Allows users to create if then rules easily Helps in setting up the logic the system
will follow often includes a visual interface for creating rules.
• Developed by NASA
• Free and open-source
• Good for building rule-based expert systems
• Used in space shuttle operations >Jess (Java Expert System Shell):