sir, can you please help me to convert this python code into matlab
Show older comments
#false positive rate,fpr= FP/(TN+FP) OR fpr=1-specificty, tpr=sensitivity
y_pred_knn_p =knn.predict_proba(X_test)[:,1]
models=[y_pred_knn_p]
label=['KNN']
# plotting ROC curves
plt.figure(figsize=(10, 8))
m=np.arange(1)
for m in m:
fpr, tpr,thresholds= metrics.roc_curve(y_test,models[m])
print('model:',label[m])
print('thresholds:',np.round(thresholds,3))
print('tpr: ',np.round(tpr,3))
print('fpr: ',np.round(fpr,3))
plt.plot(fpr,tpr,label=label[m])
plt.xlim([0.0,1.0])
plt.ylim([0.0,1.0])
plt.title('ROC curve for Cancer classifer')
plt.xlabel('False positive rate (1-specificity)')
plt.ylabel('True positive rate (sensitivity)')
plt.legend(loc=4,)
Accepted Answer
More Answers (0)
Categories
Find more on Biotech and Pharmaceutical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!