Question: Create a new classifier based on the Rocchio Method ( also know as the nearest centroid method ) adapted for text categorization [ See class
Create a new classifier based on the Rocchio Method also know as the "nearest centroid" method adapted for text categorization See class notes on Text Categorization You should separate the training function from the classification function. The training part for the classifier can be implemented as a function that takes as input the training data matrix and the training labels, returning the prototype vectors for each class. The classification part can be implemented as another function that would take as input the prototypes returned from the training function and the instance to be classified. This function should measure Cosine similarity of the test instance to each prototype vector. Your output should indicate the predicted class for the test instance and the similarity values of the instance to each of the category prototypes. Finally, use your evaluation function to compare your results to the best KNN results you obtained in part dNote: your functions should work regardless of the number of categories class labels and should not be limited to twoclass categorization scenario. The number of classes should not be hardcoded in your implementation.
f pts Using scikitlearn's Nearest Centroid classifier to perform classification of the test instances, as in the previous part. Compare the classification accuracy of your Rocchio implementation in part e to the classification results using scikitlearn.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
