1
$\begingroup$

I am a beginner in Machine Learning. I am working on a project to compare the performance of three ML algorithms which are: LR, SVM and ANN on a dataset containing medical records.

After exploring the data I have found that the dataset is imbalanced, and hence I have applied SMOTE. Then I applied PCA on the resampled data to reduce the dimensionality of the dataset and to improve the performance of the Algorithms.

After plotting a heatmap of the Confusion Matrices of each Algorithms I want to plot the ROC curves showing the AUC scores. Following is the screenshot of the heatmap of the Confusion Matrix of SVM.

enter image description here

And this is the code that I have used to plot the ROC Curve

    from sklearn.metrics import roc_curve, auc
    ### Fit a sklearn classifier on train dataset and output probabilities
    pred_val = svc.predict_proba(self.X_test)[:,1]
    ### Compute ROC curve and ROC area for predictions on validation set
    fpr, tpr, _ = roc_curve(self.y_test, pred_val)
    roc_auc = auc(fpr, tpr)

    ### Plot
    plt.figure()
    lw = 2
    plt.plot(fpr, tpr, color='darkorange',
             lw=lw, label='ROC curve (area = %0.2f)' % roc_auc)
    plt.plot([0, 1], [0, 1], color='navy', lw=lw, linestyle='--')
    plt.xlim([0.0, 1.0])
    plt.ylim([0.0, 1.05])
    plt.xlabel('False Positive Rate')
    plt.ylabel('True Positive Rate')
    plt.title('Receiver operating characteristic example')
    plt.legend(loc="lower right")
    plt.show()

This is the result: enter image description here

Please tell me wheter the result shown by the ROC curve is correct or not.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.