Question: 2 Coding You can create a new classifier by implementing a sliding window kNN from scratch, or you can create a copy ? 2 and

2 Coding
You can create a new classifier by implementing a sliding window kNN from
scratch, or you can create a copy ?2 and adapt one of the existing kNN im-
plementations. However, we strongly recommend that you use the existing
implementations. Notice that your kNN adaptation must be implemented in a
way that it can be executed as a stand-alone classifier.
Standard kNN. A standard implementation of kNN for data streams main-
tains a single sliding window W with the latest N instances seen. The pre-
diction hat(y) for an unlabelled instance x is the most common label among the k
closest instances (nearest neighbors) to x in W, i.e. neighbour (x,k,W). This
process is shown in Figure 2, where all instances (red and blue circles) belong
to W.
2.1 Rocchio Classifier with sliding window
Rocchio classifier (aka Nearest Centroid Classifier) is a classification model
based on the centroids (mean) of the training samples. In contrast to stan-
dard kNN, you are asked to use centroids instead of individual instances to
calculate the distance and find the nearest neighbors. Each class label will be
represented by a centroid. Notice that there is no need to re-calculate the cen-
troids from the scratch for each arriving instance, as you can use the techniques
from the second week's class to incrementally update centroids instance by in-
stance.
Predictions. A prediction will be the label of the closest centroid. Consider
a standard kNN classifier with sliding window W, where we use k=1. In
?2 You will need the original kNN implementation for the experiments, so do not overide it
 2 Coding You can create a new classifier by implementing a

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 Databases Questions!