Question: Write a program to perform supervised pattern classification using kNN classifiers as described in class. Your program should have two components: distance calculation and class

Write a program to perform supervised pattern classification using kNN classifiers as described in class. Your program should have two components: distance calculation and class assignment.
1. Discuss whether you need to normalize the dataset or not. Check the ranges of values and that will give you a hint. Then, normalize the dataset.
2. Separate the entire dataset (613 samples) into training and testing set such as 70% training, 30% testing.
3. For algorithm development, first implement a distance calculation module where a data set with labeled samples (training data) will be used to calculate distances to testing samples.
4. Second implement an assignment module where it will find k-Nearest Neighbors to classify samples with unknown class assignment. You must implement these two modules in one program.
5. Test your kNN for k=1,3,5,7, and 9.
6. Show your testing results for different k values using their accuracy and confusion matrix.
Write a code in python language

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!