Course Solutions Uncategorized (Solved) : Help Implement K Nearest Neighbor Python Import Numpy Nothing Else Training Data Test Data Q31249654 . . . .

(Solved) : Help Implement K Nearest Neighbor Python Import Numpy Nothing Else Training Data Test Data Q31249654 . . . .

 

Help to implement K nearest neighbor in python. Can only importnumpy and nothing else. The training data and test data is a 2Dnumpy array and the Labels are a 1D numpy array EX. labels =[[1],[-1],[1]] features = [[1,2],[5,8],[3,10]]

2 Nearest Neighbors (20 points) Implement a function in python: KNN test (X_train,Y train,X test,Y test,K) that takes training data, test data, and K as inputs. KNN test (X.train, Ytrain,X test,Y test,K) should return the accuracy on the test data. The training data and test data should have the same format as described earlier for the decision tree problems. Your function should be able to handle any dimension feature vector, with real-valued features. Remember your labels are binary, and they should be 1 for the negative class and 1 for the positive class. Write-Up: describe your implementation in detail.

2

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post