Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

AI WriteUps

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

Name: Rampurawala Alefiya Abbas Roll No: 42

Subject: Artificial Intelligence Class: TE4 – C

Experiment No.: 01
Aim: Give State-space formulation and PEAS representation for AI application.

1. What is the significance of PEAS in AI?


a. PEAS is an acronym that stands for Performance measure, Environment, Actuators,
and Sensors. It is a framework used in artificial intelligence (AI) to design
intelligent agents. 
b. The significance of the PEAS framework lies in its ability to guide the design of
intelligent agents. By defining the performance measure, environment, actuators,
and sensors, the designer can ensure that the agent is tailored to the specific task or
problem at hand. 
c. The framework also helps in identifying the limitations and challenges of the task
and in selecting the most appropriate AI techniques for the agent.
d. Thus, the PEAS framework provides a structured approach to designing intelligent
agents that are effective, efficient, and adaptable to their environment. It helps in
designing intelligent agents that can interact with the environment, sense the
environment, and actuate in the environment to achieve the desired performance
measure. 
e. The PEAS framework also helps in evaluating the performance of the intelligent
agent and improving its design over time.

2. Explain Performance measure in PEAS.


Performance measure is one of the key components of the PEAS framework used in
artificial intelligence (AI) to design intelligent agents. It refers to the criterion used to
evaluate the success of an intelligent agent in achieving its objectives.
The choice of performance measure depends on the nature of the task or problem that
the agent is designed to solve. It could be a simple metric such as maximizing profits
in a business scenario, or it could be a more complex evaluation that takes into account
multiple factors such as accuracy, speed, and cost-effectiveness.
The performance measure plays a critical role in designing an effective intelligent
agent. It serves as a guide for the agent's decision-making process, as the agent selects
the best course of action based on the current state of the environment and the desired
performance measure.
The performance measure is also used to evaluate the agent's performance after it has
completed a task or solved a problem. By comparing the actual performance with the
desired performance measure, the designer can identify areas where the agent can be
improved and refined.
Overall, the performance measure is an essential component of the PEAS framework
as it guides the agent's decision-making process, and enables the designer to evaluate
and improve the agent's performance.
Example:  PEAS for the shopping for Data Warehousing books on the internet
Performance measures:
 Price of the book
 Author of the book
 Quality of the book
 Book reviews on google.
 Obtain interested/desired books.
 Cost minimization.
Environment:
 Internet websites.
 Web pages of a particular website
 Vendors/Sellers
 Shippers
Actuators:
 Filling in the forms.
 Display to the user
 Follow URL
Sensors:
 Keyboard entry
 Browser used to find web pages
 HTML
Name: Rampurawala Alefiya Abbas Roll No: 42
Subject: Artificial Intelligence Class: TE4 – C

Experiment No.: 02
Aim: Implement the following uninformed search algorithms to reach the goal state.

1. Explain the applications of Depth First Search Breadth First Search in AI


a. DFS (Depth First Search) and BFS (Breadth First Search) are two commonly used
algorithms in artificial intelligence (AI) for traversing graphs or trees. Both DFS
and BFS are used to explore all possible paths or nodes in a graph or tree.
b. DFS starts at the root node and explores each branch as far as possible before
backtracking and exploring the next branch. In other words, DFS goes deeper into
the graph or tree before exploring the nodes at the same level. For example, in a
tree-based game playing algorithm, DFS can be used to explore all possible moves
from the current state and evaluate the outcomes.
c. BFS, on the other hand, starts at the root node and explores all nodes at the current
level before moving on to the next level. In other words, BFS explores the nodes at
the same level before going deeper into the graph or tree. For example, BFS can be
used to find the shortest path between two nodes in a graph, such as finding the
optimal route for transportation.
Here are some applications of DFS and BFS in AI:
Applications of DFS:
a. Finding connected components: DFS can be used to find the connected components
in a graph. This can be useful in social network analysis and in identifying clusters
of similar data points.
b. Topological sorting: DFS can be used to perform a topological sort on a directed
acyclic graph (DAG). This can be useful in scheduling and in determining
dependencies between tasks.
c. Maze solving: DFS can be used to solve mazes by exploring all possible paths until
the goal is reached.
d. Game playing: DFS can be used in game playing algorithms, such as minimax and
alpha-beta pruning, to explore the game tree and find the best move.
Applications of BFS:
e. Shortest path finding: BFS is often used to find the shortest path between two nodes
in a graph or a map. This is useful in navigation systems and in finding the optimal
route for transportation.
f. Web crawling: BFS can be used to crawl websites and search for relevant
information. By starting at a specific webpage and visiting all its links before
moving on to the next page, BFS can help build an index of web pages and extract
information from them.
g. Puzzle solving: BFS can be used to solve puzzles such as the sliding tile puzzle or
the Rubik's cube. By exploring all possible moves from the current state, BFS can
find the shortest sequence of moves to reach the goal state.
h. State space search: BFS can be used to search for solutions in state space search
problems, such as the eight queens problem or the traveling salesman problem.

2. Explain the difference between Depth First Search Breadth First Search

Key BFS DFS

Definition BFS stands for Breadth First Search. DFS stands for Depth First Search.

BFS uses a Queue to find the shortest DFS uses a Stack to find the shortest path.
Data structure path.

BFS is better when target is closer to DFS is better when target is far from
Source Source. source.

As BFS considers all neighbour so it is DFS is more suitable for decision tree. As
Suitability for not suitable for decision tree used in with one decision, we need to traverse
decision tree puzzle games. further to augment the decision. If we reach
the conclusion, we won.

Speed BFS is slower than DFS. DFS is faster than BFS.

Time Time Complexity of BFS = O(V+E) Time Complexity of DFS is also O(V+E)
Complexity where V is vertices and E is edges. where V is vertices and E is edges.

Memory BFS requires more memory space. DFS requires less memory space.

Tapping in In BFS, there is no problem of trapping In DFS, we may be trapped into infinite
loops into finite loops. loops.

BFS is implemented using FIFO (First DFS is implemented using LIFO (Last In
Principle
In First Out) principle. First Out) principle.

Name: Rampurawala Alefiya Abbas Roll No: 42


Subject: Artificial Intelligence Class: TE4 – C

Experiment No.: 03
Aim: Implement the following informed search algorithms to reach the goal state.
(A* search)

1. Compare the following informed searching algorithms based on performance


measure with justification: complete, Optimal, time complexity and space
complexity.
a) Greedy best first b) A*

Greedy Best First:


Greedy best-first search expands the nodes that appear to be closest to the goal.

A*:
A* Algorithms avoid expanding paths that are already expansive.

Name: Rampurawala Alefiya Abbas Roll No: 42


Subject: Artificial Intelligence Class: TE4 – C

Experiment No.: 04
Aim: Implement max-min with α-β pruning for the following game. (Tic-Tac-Toe)
1. Apply alpha-beta pruning on the following example by considering the root
node as max.

Step 1:

α=3

Step 2:

β=3

α=3 α=5

Step 3: α=3
β=3

α=5
α=3
α=1

Step 3: α=3

β=1
β=3

α=5
α=3
α=1

This is the pruned graph.

Name: Rampurawala Alefiya Abbas Roll No: 42


Subject: Artificial Intelligence Class: TE4 – C

Experiment No.: 05
Aim: Implement first-order logic (resolution) for a particular problem in prolog
(Example problems: Family tree, LCM and GCD)

1. Consider the following set of sentences:


a) Whoever can read is literate
b) Birds are no literate
c) Some birds are intelligent
Prove the following using forward reasoning “Some who are intelligent cannot
read”

Given 1, 2, and 3:
• B(x): x is bird.
• L(x): x is literate.
• I(x): x is intelligenet.
• R(x): x can read
Above sentences can be rewritten as:
1. ∀xR(x) ⇒ L(x).
2. ∀xB(x) ⇒ ¬L(x).
3. ∃xB(x) ∧ I(x).
4. ∃xI(x) ∧ ¬R(x).
Converting every sentence to a clause, we get:
1. ¬R(x) ∨ L(x).
2. ¬B(x) ∨ ¬L(x).
3. we need to assign specific value to variable x.
a. B(b1).
b. I(b1).
4. ¬I(x) ∨ R(x) (because the goal is negated).
We can prove state 4 as follows:

¬I(x) ∨ R(x) I(b1)

x/b1
¬R(x) ∨ L(x).
¬R(x) ∨ L(x). R(b1)

x/b1

¬B(x) ∨ ¬L(x). L(b1)

x/b1

B(b1) ¬ D(b1)

x/b1

Name: Rampurawala Alefiya Abbas Roll No: 42


Subject: Artificial Intelligence Class: TE4 – C

Experiment No.: 06
Aim: Implement any one of the following planning problems in prolog.

1. Give the partial order plan for the following Blocks World Problem
The list of predicates that can be used to define the stores are:
 On(A, B): Block A is on B
 Ontable(A, B): Block A is ontable on position P
 Clear(A): Nothing is on top of A
 Holding(A): Arm is holding A
 Armempty: Arm is holding nothing
 Free(P): Position P on the table is free

Initial State:
On(B,A) ∆ on(C,B) ∆ ontable(A,B) armempty free(p) free(a) free(c)

Goal State:
On(C,A) ontable(A) ontable(B) clear(B) armempty free(r) free(c)

Operators are as follows:


 stack(A,B):Stack block A on B
 upstack(A,B): Picling up block A which is ontop of block B.
 pickup(A,P): Pickup A which is ontable at position P
 putdown(A,P): Put block A ontable at position P.
Therefore, the sample plan for the given problem using defined operators are as
follows.

Name: Rampurawala Alefiya Abbas Roll No: 42


Subject: Artificial Intelligence Class: TE4 – C

Experiment No.: 07
Aim: Design a Bayes Belief Network and perform inferencing for a particular example

1. The gauge reading at a nuclear power station shows high values if the
temperature of the core goes very high. The gauge also shows high value if the
gauge is faulty. A high reading in the gauge sets an alarm off. The alarm can also
go off if it is faulty. The probability of faulty instruments is low in a nuclear
power plant.
i) Draw the Bayesian Belief Network for the above situation
ii) Associate a conditional probability table for each node.
i. Here is the Bayesian Belief Network for given situation markdown

Gauge Alarm

CoreTemp AlarmFaulty

ii. The conditional probability table (IPT) for each node is given
below

Node: CoreTemp
CPT:

TEMPRATURE P(TEMPRATURE)
LOW 0.95
HIGH 0.05

Node: Gauge
CPT:

Core Temp Gauge Faulty P(Gauge)


Low False 0.01
Low True 0.99
High False 0.90
High True 0.10

Node: Gauge
CPT:

Core Temp Gauge Faulty P(Gauge)


Low False 0.01
Low True 0.99
High False 0.90
High True 0.10

Node: Alarm Faulty


CPT:

P(Alarm Faulty)
0.001
0.999

Node: Alarm
CPT:

Gauge Alarm Faulty P(Alarm)


False False 0.99
False True 0.01
True False 0.10
True True 0.90

The probability of faulty instruments is low, which is reflected in the


very low probability of Gauge Faulty and Alarm Faulty nodes, Also,
note that the probability of a high reading in the gauge is high if the core
temp is high (0.05), but it is also high if the gauge is faulty (0.10)

Name: Rampurawala Alefiya Abbas Roll No: 42


Subject: Artificial Intelligence Class: TE4 – C

Experiment No.: 08
Aim:  Implement following unsupervised learning algorithm (Self-Organizing Maps)

1. What is unsupervised learning. Explain the algorithm of self organizing maps.


What are the benefits of using self organizing maps.

a. Unsupervised learning is a machine learning technique in which an AI model is


trained on unlabeled data without explicit guidance or supervision from a human. 
b. The goal of unsupervised learning is to identify patterns, similarities, and
relationships in the data without knowing the true labels or outcomes. One popular
unsupervised learning algorithm is the Self-Organizing Map (SOM) or Kohonen
map. 
c. SOM is a neural network-based algorithm that creates a low-dimensional
representation of high-dimensional data.
d.  The algorithm involves mapping the input data to a grid of neurons, where each
neuron represents a cluster or category in the data.
e. The architecture of the Self Organizing Map with two clusters and n input features
of any sample is given below: 

1.

How does SOM work?

Let’s say an input data of size (m, n) where m is the number of training examples and
n is the number of features in each example. First, it initializes the weights of size (n,
C) where C is the number of clusters. Then iterating over the input data, for each
training example, it updates the winning vector (weight vector with the shortest
distance (e.g Euclidean distance) from training example). Weight updation rule is
given by : 
wij = wij(old) + alpha(t) *  (xik - wij(old))
where alpha is a learning rate at time t, j denotes the winning vector, i denotes the ith
feature of training example and k denotes the kth training example from the input data.
After training the SOM network, trained weights are used for clustering new examples.
A new example falls in the cluster of winning vectors. 

Algorithm
Training:
Step 1: Initialize the weights wij random value may be assumed. Initialize the learning
rate α.
Step 2: Calculate squared Euclidean distance.
                    D(j) = Σ (wij – xi)^2    where i=1 to n and j=1 to m
Step 3: Find index J, when D(j) is minimum that will be considered as winning index.
Step 4: For each j within a specific neighborhood of j and for all i, calculate the new
weight.
                   wij(new)=wij(old) + α[xi – wij(old)]
Step 5: Update the learning rule by using :
                   α(t+1) = 0.5 * t
Step 6: Test the Stopping Condition.

The benefits of using SOM include:


1. Dimensionality reduction: SOM can reduce the high-dimensional data to a
lower-dimensional space, which is easier to visualize and interpret.
2. Clustering and pattern recognition: SOM can identify clusters and patterns in the
data, which can be useful for classification, segmentation, and anomaly
detection.
3. Noise reduction: SOM can filter out noise and irrelevant features in the data,
which can improve the accuracy and robustness of the model.

Examples of SOM applications include:


1. Image processing: SOM can be used to group similar images based on their
features or to segment an image into different regions based on their colors or
textures.
2. Customer segmentation: SOM can be used to segment customers based on their
preferences or behaviour, which can help in targeted marketing and product
recommendation.
3. Anomaly detection: SOM can be used to detect anomalies or outliers in a
dataset, which can be useful for fraud detection or quality control.

You might also like