0% found this document useful (0 votes)
28 views

Ai Notes

Uploaded by

Dominic Chuchu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Ai Notes

Uploaded by

Dominic Chuchu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Table of Contents

1. Introduction
o Overview of Prolog and Logic Programming
o Importance of AI and Expert Systems
2. Prolog Programming Language
o 2.1 Operators in Prolog
 2.1.1 Dot (.)
 2.1.2 Semicolon (;)
 2.1.3 Colon (:-)
 2.1.4 Underscore (_)
o 2.2 Characteristics of Agents
o 2.3 Goal State Definition
3. Knowledge Representation in Expert Systems
o 3.1 Factual vs. Heuristic Knowledge
o 3.2 Search Algorithms
 3.2.1 Pathfinding Algorithms
o 3.3 Heuristics
o 3.4 Reasoning Approaches
 3.4.1 Forward vs. Backward Reasoning
4. Natural Language Processing Applications
o 4.1 Applications in Academia
5. Search Techniques
o 5.1 Greedy Best-First Search vs. A* Search
o 5.2 Logical Inference and Deduction
o 5.3 AI System Applications
 5.3.1 Multi-layer Perceptron
 5.3.2 Case-Based Reasoning Systems
6. Graph Search Algorithms
o 6.1 Hill Climbing
o 6.2 Depth-Limited Search
o 6.3 Uninformed Search
7. Expert Systems Design
o 7.1 Components of an Expert System
o 7.2 Application of Expert System Rules
8. A Algorithm Application*
o 8.1 Route Finding Example
o 8.2 Understanding Admissible Heuristics
9. First Order Predicate Logic (FOPL)
o 9.1 Role in AI
o 9.2 Knowledge Representation Examples
10. Intelligent Agents
o 10.1 Types of Agents
o 10.2 PEAS Description for Agents
1. Introduction
Artificial Intelligence (AI) is a branch of computer science that focuses on creating systems
capable of performing tasks that typically require human intelligence. Logic programming
languages, such as Prolog, play a critical role in AI, particularly in the development of expert
systems. These systems utilize knowledge representation and reasoning techniques to mimic
human decision-making.

2. Prolog Programming Language


2.1 Operators in Prolog

 2.1.1 Dot (.): The dot operator indicates the end of a statement or rule in Prolog. For
example:

prolog
Copy code
loves(john, mary).

 2.1.2 Semicolon (;): This operator acts as a logical OR in Prolog. It is used to separate
alternative solutions or goals. For instance:

prolog
Copy code
loves(john, mary); loves(john, sue).

 2.1.3 Colon (:-): The colon is used to define rules in Prolog, indicating that the left side is
true if the right side (the body) is true. For example:

prolog
Copy code
loves(john, mary) :- likes(john, mary).

 2.1.4 Underscore (_): This serves as a wildcard in Prolog, representing an anonymous


variable that can match any value but is not retained in the final output. For instance:

prolog
Copy code
loves(_, mary).

2.2 Characteristics of Agents

1. Autonomy: Agents operate without human intervention. They perceive their environment
and make decisions based on their programming.
2. Reactivity: Agents respond to changes in their environment, allowing them to adapt their
behavior as necessary.

2.3 Goal State Definition

A goal state is a specific condition that an agent aims to achieve during its operation. For
example, in a puzzle-solving AI, the goal state might be the completed arrangement of puzzle
pieces.

3. Knowledge Representation in Expert Systems


3.1 Factual vs. Heuristic Knowledge

 Factual Knowledge: This is objective information that is universally accepted, such as


"The capital of Kenya is Nairobi." It is essential for building a knowledge base in expert
systems.
 Heuristic Knowledge: This consists of rules of thumb or strategies derived from
experience that guide decision-making. For example, "Invest in stocks when the market is
down" helps in financial expert systems.

3.2 Search Algorithms

3.2.1 Pathfinding Algorithms

Algorithms like Dijkstra’s or A* are commonly used to find the shortest path in graph structures.
A simple implementation of a breadth-first search algorithm could look like:

python
Copy code
def bfs(graph, start):
visited = set()
queue = [start]

while queue:
vertex = queue.pop(0)
if vertex not in visited:
visited.add(vertex)
queue.extend(set(graph[vertex]) - visited)
return visited

3.3 Heuristics

A heuristic is a practical method of problem-solving that employs a readily accessible


experience-based technique. For example, in navigation, using "straight-line distance" to
estimate travel time is a heuristic. Heuristics are crucial in AI because they can significantly
reduce the search space and improve efficiency, especially in large datasets.
3.4 Reasoning Approaches

 Forward Reasoning: This starts with the known facts and applies rules to infer new
facts. For instance, if “all humans are mortal” and “Socrates is a human,” forward
reasoning concludes that “Socrates is mortal.”
 Backward Reasoning: This begins with the goal and works backward to find supporting
facts. For example, to prove “Socrates is mortal,” one would seek to verify that he is a
human.

4. Natural Language Processing Applications


Natural Language Processing (NLP) can be applied in various areas within an academic
institution such as Chuka University:

1. Academic Writing Assistance: Tools that help students and faculty improve their
writing by providing grammar checks and style suggestions.
2. Chatbots for Student Support: Intelligent agents that interact with students to answer
common inquiries regarding admissions, course registrations, and more.
3. Sentiment Analysis on Course Feedback: Analyzing student feedback to improve
course content and delivery by understanding student sentiments.

5. Search Techniques
5.1 Greedy Best-First Search vs. A* Search

The Greedy Best-First Search algorithm evaluates nodes based solely on their estimated cost to
reach the goal (using the heuristic), while the A* Search incorporates both the cost to reach the
node and the estimated cost to the goal. A* is more efficient as it guarantees finding the shortest
path if the heuristic is admissible.

5.2 Logical Inference and Deduction

Logical inference involves deriving new facts from known facts using rules of inference. For
example, in propositional logic:

 Modus Ponens: If "P implies Q" and "P is true," then "Q must also be true."

5.3 AI System Applications

 5.3.1 Multi-layer Perceptron: Often used in deep learning for tasks such as image
classification. For instance, a university can utilize it to automate the categorization of
student applications based on various attributes.
 5.3.2 Case-Based Reasoning Systems: This system uses past cases to solve new
problems, ideal for legal or medical applications in a university’s research settings.
6. Graph Search Algorithms
6.1 Hill Climbing

Hill Climbing is a local search algorithm that continuously moves towards the direction of
increasing value (i.e., uphill) until no further improvements can be made. It is simple but can get
stuck in local maxima.

6.2 Depth-Limited Search

Depth-Limited Search is a variant of Depth-First Search that limits the depth of the search tree. It
is useful in scenarios where the search space is large, and you want to avoid getting lost in deep
paths.

6.3 Uninformed Search

Uninformed search strategies do not have additional information about the goal. Examples
include Breadth-First Search (BFS) and Depth-First Search (DFS), where the algorithm explores
all nodes at the present depth before moving on to the nodes at the next depth level.

7. Expert Systems Design


7.1 Components of an Expert System

An expert system typically comprises:

 Knowledge Base: Contains the domain-specific knowledge.


 Inference Engine: Applies logical rules to the knowledge base to deduce new
information.
 User Interface: Allows users to interact with the system.
 Explanation Facility: Explains the reasoning process behind the conclusions drawn by
the system.

7.2 Application of Expert System Rules

Rules such as those provided in the question can help guide investment decisions in a financial
expert system. By employing forward and backward chaining methods, the system can deduce
investment strategies based on user input and predefined rules.

8. A* Algorithm Application
8.1 Route Finding Example

To use the A* algorithm for finding a route from town A to town M:


1. Initialize the open set with the starting node (A).
2. For each node, calculate the cost functions:
o G(n)G(n)G(n): Actual cost from start to the node.
o H(n)H(n)H(n): Estimated cost from the node to the goal (M).
3. Expand the node with the lowest total cost F(n)=G(n)+H(n)F(n) = G(n) + H(n)F(n)=G(n)
+H(n).
4. Repeat until the goal is reached.

8.2 Understanding Admissible Heuristics

An admissible heuristic is one that never overestimates the cost to reach the goal. This property
is crucial because it ensures that the A* algorithm is optimal, meaning it will always find the
least-cost path if one exists.

9. First Order Predicate Logic (FOPL)


9.1 Role in AI

FOPL extends propositional logic by allowing the use of quantifiers and predicates, making it
more expressive for representing knowledge in AI systems. It can capture relationships and
properties of objects effectively.

9.2 Knowledge Representation Examples

1. Semantic Networks: Visual representations of knowledge that show relationships


between concepts.
2. Frames: Data structures for representing stereotypical situations, useful for storing
structured information.
3. Logic Programs: Representing facts and rules in a Prolog-like language, enabling
inference and reasoning.

10. Intelligent Agents


10.1 Types of Agents

1. Simple Reflex Agents: Act on the current percept, following rules based on the current
state. N
2. Model-Based Reflex Agents: Maintain an internal state to represent the world.
3. Goal-Based Agents: Act to achieve specific goals, considering future actions.
4. Utility-Based Agents: Choose actions based on a utility function that quantifies the
preferences of the outcomes.

10.2 PEAS Description for Agents

 i. Internet Shopping Agent


o Performance: Efficiently find the best prices and products.
o Environment: Online retail platforms.
o Actuators: Web browsers, shopping APIs.
o Sensors: Web scraping tools, price comparison tools.
 ii. E-Learning Teaching Assistant
o Performance: Enhance learning through personalized content.
o Environment: Learning management systems.
o Actuators: Course materials, quizzes.
o Sensors: Student interaction data, performance metrics.

You might also like