def fit(self, y_train):
     """Finds most common element in y_train and saves that as result
     Args:
         y_train(list of obj): The target y values (parallel to X_train)
             The shape of y_train is n_train_samples
     """
     self.result = myutils.findMostFrequent(y_train)
 def predict(self, X_test):
     """Makes predictions for test instances in X_test.
     Args:
         X_test(list of list of obj): The list of testing samples
             The shape of X_test is (n_test_samples, n_features)
     Returns:
         y_predicted(list of obj): The predicted target y values (parallel to X_test)
     """
     
     results = []
     for instance in X_test:
         treeResults = []
         for tree in self.best_M_trees:
             treeResults.append(self.tdidt_predict(self.header, tree, instance))
         results.append(myutils.findMostFrequent(treeResults))
     return results
 def predict(self, X_test):
     """Makes predictions for test instances in X_test.
     Args:
         X_test(list of list of numeric vals): The list of testing samples
             The shape of X_test is (n_test_samples, n_features)
     Returns:
         y_predicted(list of obj): The predicted target y values (parallel to X_test)
     """
     result = []
     _, indices = self.kneighbors(X_test)
     for lis in indices:
         temp = []
         for jj in lis:
             temp.append(self.y_train[jj])
         result.append(myutils.findMostFrequent(temp))
     return result