def classification_error(train_data, train_label, test_data, test_label): knn_model = knn_train(train_data= train_data, train_label= train_label) predictions = knn_test(knn_model = knn_model, test_data = test_data) misclassified = len(where(predictions - test_label !=0)[0]) total_points = len(test_label) print "predictions : ", misclassified*1.0/total_points
def classification_error(self): knn_model = knn_train(train_data= self.training_data, train_label= self.train_label) predictions = knn_test(knn_model = knn_model, test_data = self.test_data) print predictions
def classification_error(self): knn_model = knn_train(train_data= self.ld_training_data, train_label= self.train_label) predictions = knn_test(knn_model = knn_model, test_data = self.ld_test_data) misclassified = len(where(predictions - self.test_label !=0)[0]) total_points = len(self.test_label) return misclassified*1.0/total_points