def output_evaluation_statistics(test, predictions): logger.info("Statistics with probability cutoff at 0.5") # binary predictions with some cutoff for these evaluations cutoff = 0.5 predictions_binary = np.copy(predictions) predictions_binary[predictions_binary >= cutoff] = 1 predictions_binary[predictions_binary < cutoff] = 0 evaluation.print_model_statistics(test.y, predictions_binary) evaluation.print_confusion_matrix(test.y, predictions_binary) precision1 = precision_at(test.y, predictions, 0.01) logger.debug("Precision at 1%: {} (probability cutoff {})".format( round(precision1[0], 2), precision1[1])) precision10 = precision_at(test.y, predictions, 0.1) logger.debug("Precision at 10%: {} (probability cutoff {})".format( round(precision10[0], 2), precision10[1]))
def print_evaluation(self): y_pred = self.clf.predict(self.X) evaluation.print_confusion_matrix(self.y, y_pred) evaluation.print_precision_recall(self.y, y_pred) print("Accuracy: ", evaluation.get_classifier_accuracy(self.y, y_pred) * 100)