AI Unit 2 with assignment 2
AI Unit 2 with assignment 2
UNIT 2
• Humans are best at understanding, reasoning, and interpreting
knowledge.
• Human knows things, which is knowledge and as per their
knowledge they perform various actions in the real world.
• Knowledge representation and reasoning (KR, KRR) is the part of Artificial
intelligence which concerned with AI agents thinking and how thinking contributes to
intelligent behavior of agents.
• It is responsible for representing information about the real world so that a
computer can understand and can utilize this knowledge to solve the complex real
world problems such as diagnosis a medical condition or communicating with
humans in natural language.
• It is also a way which describes how we can represent knowledge in artificial
intelligence. Knowledge representation is not just storing data into some database,
but it also enables an intelligent machine to learn from that knowledge and
experiences so that it can behave intelligently like a human.
WHAT TO REPRESENT
• Object: All the facts about objects in our world domain. E.g., Guitars contains strings,
trumpets are brass instruments.
• Events: Events are the actions which occur in our world.
• Performance: It describe behavior which involves knowledge about how to do things.
• Meta-knowledge: It is knowledge about what we know.
• Facts: Facts are the truths about the real world and what we represent.
• 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).
1. Declarative Knowledge:
• Declarative knowledge is to know about something.
• It includes concepts, facts, and objects.
• It is also called descriptive knowledge and expressed in declarativesentences.
• It is simpler than procedural language.
2. Procedural Knowledge
• It is also known as imperative knowledge.
• Procedural knowledge is a type of knowledge which is responsible for knowing how
to do something.
• It can be directly applied to any task.
• It includes rules, strategies, procedures, agendas, etc.
• Procedural knowledge depends on the task on which it can be applied.
3. Meta-knowledge:
• Knowledge about the other types of knowledge is called Meta-knowledge.
4. Heuristic knowledge:
• Heuristic knowledge is representing knowledge of some experts in a filed or
subject.
• Heuristic knowledge is rules of thumb based on previous experiences, awareness of
approaches, and which are good to work but not guaranteed.
5. Structural knowledge:
• Structural knowledge is basic knowledge to problem-solving.
• It describes relationships between various concepts such as kind of, part of, and
grouping of something.
• It describes the relationship that exists between concepts or objects.
ISSUES IN KNOWLEDGE REPRESENTATION
The fundamental goal of knowledge Representation is to facilitate inference
(conclusions) from knowledge.
• The issues that arise while using KR techniques are many. Some of these are
Important Attributed:
• Any attribute of objects so basic that they occur in almost every problem
domain
Relationship among attributes:
• Any important relationship that exists among object attributed,The attributes
we use to describe objects
Choosing Granularity(The level of detail at which data is stored ):
• At what level of detail should the knowledge be represented
Set of objects:
• How should sets of objects be represented
Finding Right structure:
• Given a large amount of knowledge stored in a database, how can relevant parts
are accessed when they are needed
HILL CLMBING ALGORITHM
Hill climbing is a heuristic search algorithm used to solve optimization problems. It is often
employed in problems where the goal is to maximize or minimize an objective function.
• how the hill climbing algorithm is applied in AI:
• Initialize: Start with an initial solution. This could be a randomly generated solution or a
predefined one.
• Evaluate: Evaluate the current solution by calculating the value of the objective function.
• Generate neighbors: Generate neighboring solutions by making small changes
(mutations) to the current solution. These changes can include adding or removing
elements, modifying values, or other operations depending on the problem.
• Select the best neighbor: Among the generated neighbors, select the one that
optimizes (minimizes or maximizes) the objective function the most.
• Update: If the best neighbor improves the current solution, move to that neighbor and
update the current solution to be the best neighbor. Otherwise, stop the algorithm.
• Repeat: Repeat steps 2-5 until a stopping criterion is met, such as reaching a
maximum number of iterations or no significant improvement in the objective function
value.
LIMITATIONS
• Local Optima: One of the main limitations of hill climbing is that it tends to get stuck in local
optima. If the search space is rugged or contains multiple peaks, the algorithm may converge to
a suboptimal solution without exploring other potentially better solutions.
• Plateaus: In plateau regions of the search space where the objective function remains constant
over a large area, hill climbing can struggle to make progress. It may get stuck moving back
and forth between neighboring solutions without making significant improvements.
• Greedy Approach: Hill climbing is a greedy algorithm, meaning it only considers immediate
improvements in the objective function without considering the long-term consequences. This can
lead to suboptimal solutions, especially in problems where a series of non-optimal moves are
required to reach the global optimum.
• Initial Solution Dependency: The performance of hill climbing can be highly dependent on the
initial solution. If the initial solution is far from the global optimum, the algorithm may fail to
find the best solution, even if it exists within the search space.
• Limited Exploration: Hill climbing focuses on exploring solutions that are close to the current
solution. This limited exploration can prevent the algorithm from discovering diverse regions of
the search space that may contain better solutions.
• No Memory: Hill climbing does not have memory of past moves or solutions. This means that it
can repeat the same or similar moves, even if they do not lead to improvements, wasting
computational resources.
• Constraint Handling: Hill climbing does not handle constraints well. If the search space contains
constraints, such as boundary limits or logical constraints, hill climbing may violate these
constraints while searching for solutions.
• Slow Convergence: In some cases, hill climbing can converge slowly to an optimal solution,
especially in high-dimensional search spaces where the number of possible solutions is large.
MAPPING
Frames are data structures used in artificial intelligence to organize knowledge into
categories. A frame contains slots that describe aspects of the category, with default
values that can be overridden.
A problem known as the frame problem within artificial intelligence concerns the
application of knowledge about the past to draw inferences (guess or opinion that's
formed because of known facts or evidence ) about the future.
In artificial intelligence (AI), inference is the process of using logical rules to analyze
new information.
The Frame problem can lead to several issues that can impact the effectiveness of an AI
system. Some of these problems are:
• The Qualification Problem: The inability to produce accurate truths about the present
environment is the Representational Problem
• The Inferential Problem: Difficulty with examining the methods by which the world is
judged is the Inferential Problem
• The Ramification Problem: This problem explains how behavior might lead to changes in
the surroundings.
• The Predictive Problem: The Predictive Problem deals with the benefits of predictions.
That is, it is uncertain if a given prediction will cause a positive change in the environment.
If the change will not be positive, "either the laws or description of the given situation must
be imperfect
PREDICATE LOGIC
• Convert to CNF:
• Distribute disjunctions: (¬A ∨ ¬B ∨ C) ∨ (¬A ∨ ¬B ∨ ¬D)
Two attributes isa and instance play an important role in many aspects
of knowledge representation. The reason for this is that they support property
inheritance. isa-- used to show class inclusion, e.g.isa(mega_star,rich). instance--
used to show class membership, e.g.instance(prince,mega_star).
• Class inclusion refers to the ability to classify objects into two or more
categories simultaneously. For example, the ability to recognise that large
categories such as 'cars' includes smaller sub-categories such as 'blue cars' or
'red cars' or different manufacturers.
• the term "class membership" refers to the categorization or labeling of an
instance, object, or data point as belonging to a specific class or category
within a predefined set of classes. Classes represent the outcomes or
categories that an algorithm tries to predict or classify instances into, based
on the features or attributes of those instances. Class membership is crucial in
classification problems, where the goal is to accurately assign instances to one
of several classes based on their attributes.
• Representing instances and "is-a" relationships effectively allows AI systems to
model the real world more accurately, perform logical reasoning, and infer
new knowledge based on the hierarchical structure of information.
Instance Representation
• An instance represents a specific example or occurrence of a concept or
class. It is an individual entity characterized by properties and values that
distinguish it from other instances. In AI, instances are represented in various
ways depending on the context and the data model being used
"Is-A" Relationship Representation
• The "is-a" relationship is a fundamental hierarchical relationship that
represents inheritance or subclassing in knowledge representation. It signifies
that an entity (the subclass or instance) is a specific type of another entity (the
superclass or category). This relationship is crucial for organizing knowledge in
a hierarchy, allowing for inheritance of properties and facilitating reasoning
about categories and instances.
RESOLUTION
• resolution is a fundamental rule of inference that allows for
deriving conclusions from a set of logical sentences. It is
primarily used in propositional logic and first-order logic.
Resolution plays a crucial role in theorem proving, automated
deduction systems, and certain algorithms in AI that require
logical reasoning capabilities.
• resolution is a powerful method in AI for deriving conclusions
from logical statements, with broad applications across
different domains of AI, from theorem proving to natural
Uses of Resolution in AI
• Resolution is widely used in AI for various purposes:
• Automated Theorem Proving: It's a core technique in software that aims to prove or
disprove logical statements automatically.
• Knowledge Representation and Reasoning: Resolution helps in inferring new knowledge
from existing facts and rules within a knowledge base.
• Logic Programming: Languages like Prolog rely on resolution as their primary mechanism
for query processing and solving logical queries.
• Natural Language Processing (NLP): Resolution can be involved in understanding and
generating natural language by applying logical inference to natural language statements.
PROCEDURAL KNOWLEDGE
• Monotonic Reasoning is the process that does not change its direction or can say that
it moves in the one direction.
• Monotonic Reasoning will move in the same direction continuously means it will either
move in increasing order or decrease.
• But since Monotonic Reasoning depends on knowledge and facts, It will only increase
and will never decrease in this reasoning.
• Example:
• Sun rises in the East and sets in the West.
NON-MONOTONIC REASONING
• Non-monotonic Reasoning is the process that changes its direction or values as the
knowledge base increases.
• It is also known as NMR in Artificial Intelligence.
• Non-monotonic Reasoning will increase or decrease based on the condition.
• Since that Non-monotonic Reasoning depends on assumptions, It will change itself with
improving knowledge or facts.
• Example:
• Consider a bowl of water, If we put it on the stove and turn the flame on it will obviously boil hot and
as we will turn off the flame it will cool down gradually.
STATISTICAL REASONING