For I, (train, test) in enumerate (CV):
Print test
#通过训练数据, the SVM linear kernel is used to build the model, and the test set is tested to find out the prediction score.
Probas_ = Classifier.fit (X[train], Y[train]). Predict_proba (X[test)
# Compute ROC curve and area the curve
#通过roc_curve () function, find FPR and TPR, and thresholds
FPR, TPR, thresholds = Roc_curve (y[test), probas_[:, 1])
MEAN_TPR + = Interp (MEAN_FPR, FPR, TPR) #对mean_tpr在mean_fpr处进行插值, calling SciPy () function via INTERP package
Mean_tpr[0] = 0.0 #初始处为0
ROC_AUC = AUC (FPR, TPR)
#画图, only need Plt.plot (FPR,TPR), variable ROC_AUC just record AUC value, through the AUC () function can be calculated
Plt.plot (FPR, TPR, lw=1, label= ' ROC fold%d (area =%0.2f) '% (I, ROC_AUC))
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.