Now that we have built our first neural network model, let's evaluate its performance. We are going to look at the overall accuracy, precision, and recall, as well as the receiver operating characteristic (ROC) curve and area under the curve (AUC). First, take a look at the following code for computing accuracy, precision, and recall:
from sklearn.metrics import accuracy_score, precision_score, recall_scorein_sample_preds = [round(x[0]) for x in model.predict(X_train)]out_sample_preds = [round(x[0]) for x in model.predict(X_test)]# Accuracyprint('In-Sample Accuracy: %0.4f' % accuracy_score(y_train, in_sample_preds))print('Out-of-Sample Accuracy: %0.4f' % accuracy_score(y_test, out_sample_preds))# Precisionprint('In-Sample ...