Government Engineering College, Modasa: B.E. - Computer Engineering (Semester - VII) 3170724 - Machine Learning
Government Engineering College, Modasa: B.E. - Computer Engineering (Semester - VII) 3170724 - Machine Learning
Government Engineering College, Modasa: B.E. - Computer Engineering (Semester - VII) 3170724 - Machine Learning
LIST OF PRACTICALS
# Description
1 Given the following vectors:
A = [1, 2, 3, 4, 5, 6, 7, 8, 9 10]
B = [4, 8, 12, 16, 20, 24, 28, 32, 36, 40]
C = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
2 Load breast cancer dataset and perform classification using Euclidean distance. Use 70% data as
training and 30% for testing.
3 Repeat the above experiment with 10-fold cross validation and find the standard deviation in
accuracy.
4 Repeat the experiment 2 and build the confusion matrix. Also derive Precision, Recall and Specificity
of the algorithm.
5 Predict the class for X = < Sunny, Cool, High, Strong > using Naïve Bayes Classifier for given data
𝑃(𝑋 | 𝐶). 𝑃(𝐶)
𝑃(𝐶 | 𝑋) =
𝑃(𝑋)
# Outlook Temp. Humidity Windy Play
Ans: Label = NO
6 For the data given in Exercise 5, find the splitting attribute at first level:
𝑃 𝑃 𝑁 𝑁
Information Gain: 𝐼(𝑃, 𝑁) = − 𝑆 log 2 𝑆 − 𝑆 log 2 𝑆 = 0.940
𝑣
𝑃𝑖 + 𝑁𝑖
𝐸𝑛𝑡𝑟𝑜𝑝𝑦: 𝐸(𝑂𝑢𝑡𝑙𝑜𝑜𝑘) = ∑ 𝐼(𝑃𝑖 , 𝑁𝑖 )) = 0.694
𝑃+𝑁
𝑖=1
𝐺𝑎𝑖𝑛 (𝑂𝑢𝑡𝑙𝑜𝑜𝑘) = 𝐼(𝑃, 𝑁) − 𝐸(𝑂𝑢𝑡𝑙𝑜𝑜𝑘) = 0.246
Ans:
Attribute Gain
Outlook 0.246
Temperature 0.029
Humidity 0.151
Windy 0.048
7 Generate and test decision tree for the dataset in exercise 5
8 Find the clusters for following data with k = 2: Start with points 1 and 4 as two separate clusters.
i A B
1 1.0 1.0
2 1.5 2.0
3 3.0 4.0
4 5.0 7.0
5 3.5 5.0
6 4.5 5.0
7 3.5 4.5
Ans:
i Point
C1 1, 2
C2 3, 4, 5, 6, 7
Additional Tasks:
Mini Project in a group of max. 3 students