Docsity

575 homework for a weekend purpose, Lecture notes of Applied Computing

Toggle sidebar
bg1
SML Homework-3
Meghana Nadella
1225887210
1) Question -1 Handwritten Digits Recognition with k-NN
In the MNIST dataset , we are having 60000 training images and 10000 testing images
of handwritten digits collected.For each test image, run K-NN to find the best match to
the image to associated category of the closest data point measured using Euclidean
distance closest data point.
K = 1; Accuracy: 0.2727
K = 3; Accuracy: 0.2743
K = 5; Accuracy: 0.284
K = 10; Accuracy: 0.2917
K = 20; Accuracy: 0.2825
K = 30; Accuracy: 0.2719
K = 40; Accuracy: 0.2626
K = 50; Accuracy: 0.2557
K = 60; Accuracy: 0.2452
We can see that for K values in [1,3,5,10,20,30,40,50,60] the accuracy increases up to
K=10 and then decreases further which can be seen in the graph above.
K=10 gave the highest accuracy of 29.17% and K=60 gave the lowest accuracy of
24.52%. The choice of k is important. The smaller the value of k, the more noise
influences the result. Large values are computationally expensive and go against the
basic philosophy behind ANNs (nearby points can have similar densities or classes).
Small values of K make the decision limits unstable. Important K values are good for
classification because the decision boundary is smooth.
pf3

Partial preview of the text

Download 575 homework for a weekend purpose and more Lecture notes Applied Computing in PDF only on Docsity!

SML Homework-

Meghana Nadella

1) Question -1 Handwritten Digits Recognition with k-NN In the MNIST dataset , we are having 60000 training images and 10000 testing images of handwritten digits collected.For each test image, run K-NN to find the best match to the image to associated category of the closest data point measured using Euclidean distance closest data point. K = 1; Accuracy: 0. K = 3; Accuracy: 0. K = 5; Accuracy: 0. K = 10; Accuracy: 0. K = 20; Accuracy: 0. K = 30; Accuracy: 0. K = 40; Accuracy: 0. K = 50; Accuracy: 0. K = 60; Accuracy: 0. We can see that for K values in [1,3,5,10,20,30,40,50,60] the accuracy increases up to K=10 and then decreases further which can be seen in the graph above. K=10 gave the highest accuracy of 29.17% and K=60 gave the lowest accuracy of 24.52%. The choice of k is important. The smaller the value of k, the more noise influences the result. Large values are computationally expensive and go against the basic philosophy behind ANNs (nearby points can have similar densities or classes). Small values of K make the decision limits unstable. Important K values are good for classification because the decision boundary is smooth.

2) Question-2 K-Means Clustering Given data consists of 128 data points with 13 features each. The KMeans algorithm is used to cluster given data points into k = 2,3,…,9 clusters. The cluster centers are randomly initialized to one of the given data points for each k, and pairwise distances between each data point and cluster center are calculated, cluster centers are updated with means of data points contained in the cluster until the cluster assignments of the data points remain unchanged. To minimize the total squared error between training instances and their representative prototypes is the optimization criterion for K-Means. This is the same as minimizing the covariance matrix's pool trace.In the graph of Objective function vs a number of clusters, the objective function was decreasing till K=6 and then it was decreasing steadily, the slope value change decreased and almost became the same after K=6. The K-means aim diminishes as K rises. If K = 2, the first two characteristics are used to represent the point. To distinguish between two clusters with two different colors are used.