AI&ML Lab Manual

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

S.E.A.

COLLEGE OF ENGINEERING & TECHNOLOGY,


Bengaluru-560049

Department of Computer Science and Engineering &


Information Science and Engineering

BE - VII SEMESTER
ARTIFICIAL INTELLIGENCE AND
MACHINE LEARNING LABORATORY
18CSL76
Name of the student:
USN:
Section & Batch:

S.E.A.COLLEGE OF ENGINEERING & TECHNOLOGY


Ekta Nagar, Near Ayyapa Nagar Circle, Devasandra Main road, Virgonagar Post, Bangalore-560049
Website : seacet-bangalore.org.in Email: info@ seacet-bangalore.org.in
INDEX
S.NO TITLE PAGE
NO
1 Implement A* Search Algorithm 1

2 Implement AO* Search Algorithm 2

For a given set of training data examples stored in a .CSV file,


implement and demonstrate the Candidate-Elimination algorithm to
3 output a description of the set of all Hypotheses consistent with the 3
training examples.
Write a program to demonstrate the working of the decision tree
4 based ID3 algorithm. Use an appropriate data set for building the 5
decision tree and apply this knowledge to classify a new sample.
Build an Artificial Neural Network by implementing the Back
5 propagation algorithm and test the same using appropriate data sets. 9
Write a program to implement the naïve Bayesian classifier for a
6 sample training data set stored as a .CSV file. Compute the 11
accuracy of the classifier, considering few test data sets.

Apply EM algorithm to cluster a set of data stored in a .CSV file. Use


the same data set for clustering using k-Means algorithm. Compare
7 the results of these two algorithms and comment on the quality of 21
clustering. You can add Java/Python ML library classes/API in the
program.
Write a program to implement k-Nearest Neighbor algorithm to
8 classify the iris data set. Print both correct and wrong predictions. 24
Java/Python ML library classes can be used for this problem.

Implement the non-parametric Locally Weighted Regression


9 algorithm in order to fit data points. Select appropriate data set for 26
your experiment and draw graphs.
1. Implement A* Search Algorithm.

Program :

Page No: 1
Page No: 2
Output :

Output :

Page No: 3
2. Implement AO* Search Algorithm.

Program :

Page No: 4
Page No: 5
Page No: 6
Output :

Page No: 7
Page No: 8
3. For a given set of training data examples stored in a .CSV file, implement and
demonstrate the Candidate-Elimination algorithm to output a description of
the set of all Hypotheses consistent with the training examples.

Program:

Page No: 3
Dataset to be considered is as follows:-

The output is as follows:-

Page No: 4
4. Write a program to demonstrate the working of the decision tree based ID3
algorithm. Use an appropriate data set for building the decision tree and
apply this knowledge to classify a new sample.

Program:

Page No: 5
The dataset to be considered is as follows :-

The output is:

Page No: 6
Page No: 7
Page No: 8
5. Build an Artificial Neural Network by implementing the Back
propagation algorithm and test the same using appropriate data
sets.

Program:

Page No: 9
For this we consider:

ADD
Forward propagation BIAS
&
Activatio
n

FEE ADD
D h1 BIAS
FEE
x D &
1 Activatio
n
Input Layer y Output Layer
h2

x O/P Grad= Derivative_Sigmoid


2 (output)
h3 Delta_O/P = O/P Grad*Error

Hidden Layer

Hidden _Error = Delta_ O/P*Transpose(Weight


O/P) Hidden_Grad= Derivative_Sigmoid
(Hidden_layer_ACT) Delta_Hidden=
Hidden_Error* Hidden_Grad
Backward Propagation

The output is as follows:

Page No: 10
6. Write a program to implement the naïve Bayesian classifier for a sample
training data set stored as a .CSV file. Compute the accuracy of the
classifier, considering few test data sets.

The dataset to be considered is as follows :-

Program:

Page No: 11
Page No: 12
The output is as follows:

Page No: 13
Page No: 14
Page No: 15
Page No: 16
7. Apply EM algorithm to cluster a set of data stored in a .CSV file. Use the same
data set for clustering using k-Means algorithm. Compare the results of these
two algorithms and comment on the quality of clustering. You can add
Java/Python ML library classes/API in the program.

Program:

Page No: 21
The dataset to be considered is:

Page No: 22
The output is as follows:

Page No: 23
8. Write a program to implement k-Nearest Neighbor algorithm to classify the
iris data set. Print both correct and wrong predictions. Java/Python ML
library classes can be used for this problem.

Program:

The data set to be considered is:


Iris Flower dataset from SKLearn is imported .

Page No: 24
The output is as follows:

Page No: 25
9. Implement the non-parametric Locally Weighted Regression algorithm in order
to fit data points. Select appropriate data set for your experiment and draw
graphs.

Program:

Page No: 26
The dataset considered is:

The overall dataset consists of over 200 hypothesis values. Out of this First 24 are given below:

The output is:

Page No: 27

You might also like