preds_df.to_csv(results_folder + "rf_pred.csv") """ 1. Classification report and summary statistics """ # creating classification report class_report = classification_report(y_test, y_pred_class) print(class_report) # write classification report print(class_report, file=open(results_folder + "rf_classification_report.txt", "w")) # define confusion matrix cm = confusion_matrix(y_test, y_pred_class) # run accuracy summary on confuxion matrix dx_summary = dx_accuracy(cm) print(dx_summary) # save summary metrics dx_summary.to_csv(results_folder + "rf_dx_summary.csv") """ 2. Brier score """ brier_score = np.round(brier_score_loss(y_test, y_pred[:, 1]), 3) print('RF Clinical + Labs Features Benchmark', '\nBrier Score:', brier_score, file=open(results_folder + 'brier_score.txt', 'w')) """ 3. ROC """
preds_df.to_csv(results_folder + "rf_mice_pred.csv") """ 1. Classification report and summary statistics """ # creating classification report class_report = classification_report(y_test, y_pred_class) print(class_report) # write classification report print(class_report, file=open(results_folder + "rf_mice_classification_report.txt", "w")) # define confusion matrix cm = confusion_matrix(y_test, y_pred_class) # run accuracy summary on confuxion matrix dx_summary = dx_accuracy(cm) print(dx_summary) # save summary metrics dx_summary.to_csv(results_folder + "rf_mice_dx_summary.csv") """ 2. Brier score """ brier_score = np.round(brier_score_loss(y_test, y_pred[:, 1]), 3) print('RF Clinical + MICE Imputed Labs', '\nBrier Score:', brier_score, file=open(results_folder + 'brier_score.txt', 'w')) """ 3. ROC """