def TestAccuracy(self, test_file_names): num_files = len(test_file_names) predict_result = self.__model__.predict( CNNClassifier.func_generator(test_file_names)).argmax(axis=1) predict_result = predict_result.reshape(num_files, -1) predicted_fen_arr = np.array([ BoardHelper.LtoFEN(BoardHelper.LabelArrayToL(labels)) for labels in predict_result ]) test_fens = np.array([ DataHelper.GetCleanNameByPath(file_name) for file_name in test_file_names ]) final_accuracy = (predicted_fen_arr == test_fens).astype( np.float).mean() return final_accuracy
def Predict(self, query_data): grids = CNNClassifier.PreprocessImage(query_data) y_pred = self.__model__.predict(grids).argmax(axis=1) return BoardHelper.LabelArrayToL(y_pred)
def Predict(self, query_data): grids = SVCClassifier.SVCPreprocess(query_data) y_pred = self.__svc__.predict(grids) return BoardHelper.LabelArrayToL(y_pred)