plot roc curve for neural network keras

Solutions on MaxInterview for plot roc curve for neural network keras by the best coders in the world

showing results for - "plot roc curve for neural network keras"
James
19 Sep 2016
1from sklearn.metrics import roc_curve, auc
2
3history = model.fit(x_train, y_train, validation_data=(
4        x_test, y_test), epochs=num_of_epochs, batch_size=batch_size, verbose=1)
5
6y_pred = model.predict(x_test).ravel()
7
8nn_fpr_keras, nn_tpr_keras, nn_thresholds_keras = roc_curve(y_test, y_pred)
9auc_keras = auc(nn_fpr_keras, nn_tpr_keras)
10plt.plot(nn_fpr_keras, nn_tpr_keras, marker='.', label='Neural Network (auc = %0.3f)' % auc_keras)
11
12