roc

MATLAB - generate confusion matrix from classifier

淺唱寂寞╮ 提交于 2019-12-31 05:29:12
问题 I have some test data and labels: testZ = [0.25, 0.29, 0.62, 0.27, 0.82, 1.18, 0.93, 0.54, 0.78, 0.31, 1.11, 1.08, 1.02]; testY = [1 1 1 1 1 2 2 2 2 2 2 2 2]; I then sort them: [sZ, ind] = sort(testZ); %%Sorts Z, and gets indexes of Z sY = testY(ind); %%Sorts Y by index [N, n] = size(testZ'); This will then give the sorted Y data. At each element of the sorted Y data, I want to classify each point to the left as being of type 1 and everything to the right being class 2; This will then be

Good ROC curve but poor precision-recall curve

痞子三分冷 提交于 2019-12-30 00:40:13
问题 I have some machine learning results that I don't quite understand. I am using python sciki-learn, with 2+ million data of about 14 features. The classification of 'ab' looks pretty bad on the precision-recall curve, but the ROC for Ab looks just as good as most other groups' classification. What can explain that? 回答1: Class imbalance. Unlike the ROC curve, PR curves are very sensitive to imbalance. If you optimize your classifier for good AUC on an unbalanced data you are likely to obtain

How to plot a curved line in MATLAB using a set of points

半腔热情 提交于 2019-12-25 18:49:09
问题 I'm trying to draw ROC curves using an existing set of values using the following command plot(X1,Y1,'--rs',X2,Y2,'-*g'); Where X1 , Y1 , X2 and Y2 are matrices that have the same size However, the lines produced by this command are straight ones. How can I make them curved lines. Thanks Aziz 回答1: MATLAB by default uses straight line approximation to draw your graph in between control points. If you want, you can interpolate in between the points to produce a more realistic graph. Try using

Difference in ROC-AUC scores in sklearn RandomForestClassifier vs. auc methods

亡梦爱人 提交于 2019-12-24 03:54:19
问题 I am receiving different ROC-AUC scores from sklearn's RandomForestClassifier and roc_curve, auc methods, respectively. The following code got me an ROC-AUC (i.e. gs.best_score_) of 0.878: def train_model(mod = None, params = None, features = None, outcome = ...outcomes array..., metric = 'roc_auc'): gs = GridSearchCV(mod, params, scoring=metric, loss_func=None, score_func=None, fit_params=None, n_jobs=-1, iid=True, refit=True, cv=10, verbose=0, pre_dispatch='2*n_jobs', error_score='raise')

3-class AUC calculation in R (pROC package)

情到浓时终转凉″ 提交于 2019-12-24 03:18:10
问题 I met a problem of 3-class ROC analysis in R and obtained a very annoying result (see here ). Now I try to use a different way to solve it. The data is iris and the classifier is multinomial logistic regression which is in nnet package. The code is below: # iris data (3-class ROC) library(nnet) library(pROC) # should be installed first: install.packages('pROC') data(iris) # 3-class logistic regression model = multinom(Species~., data = iris, trace = F) # confusion matrix (z1) & accuracy (E1)

3-class AUC calculation in R (pROC package)

强颜欢笑 提交于 2019-12-24 03:18:06
问题 I met a problem of 3-class ROC analysis in R and obtained a very annoying result (see here ). Now I try to use a different way to solve it. The data is iris and the classifier is multinomial logistic regression which is in nnet package. The code is below: # iris data (3-class ROC) library(nnet) library(pROC) # should be installed first: install.packages('pROC') data(iris) # 3-class logistic regression model = multinom(Species~., data = iris, trace = F) # confusion matrix (z1) & accuracy (E1)

How to plot a ROC curve from Classification Tree probabilities

落爺英雄遲暮 提交于 2019-12-24 03:14:17
问题 I am attempting to plot a ROC curve with classification trees probabilities. However, when I plot the curve, it is absent. I am trying to plot the ROC curve and then find the AUC value from the area under the curve. Does anyone know how to fix this? Thank you if you can. The binary column Risk stands for risk misclassification, which I presume is my label. Should I be applying the ROC curve equation at a different point in my code? Here is the data frame: library(ROCR) data(Risk.table) pred =

How to plot precision and recall of multiclass classifier?

六月ゝ 毕业季﹏ 提交于 2019-12-24 01:11:04
问题 I'm using scikit learn, and I want to plot the precision and recall curves. the classifier I'm using is RandomForestClassifier . All the resources in the documentations of scikit learn uses binary classification. Also, can I plot a ROC curve for multiclass? Also, I only found for SVM for multilabel and it has a decision_function which RandomForest doesn't have 回答1: From scikit-learn documentation: Precision-Recall: Precision-recall curves are typically used in binary classification to study

Plotting a ROC curve from a random forest classification

自作多情 提交于 2019-12-23 21:40:03
问题 I'm trying to plot ROC curve of a random forest classification. Plotting works, but I think I'm plotting the wrong data since the resulting plot only has one point (the accuracy). This is the code I use: set.seed(55) data.controls <- cforest_unbiased(ntree=100, mtry=3) data.rf <- cforest(type ~ ., data = dataset ,controls=data.controls) pred <- predict(data.rf, type="response") preds <- prediction(as.numeric(pred), dataset$type) perf <- performance(preds,"tpr","fpr") performance(preds,"auc")

Difference in average AUC computation using ROCR and pROC (R)

风格不统一 提交于 2019-12-23 17:32:02
问题 I am working with cross-validation data (10-fold repeated 5 times) from a SVM-RFE model generated with the caret package. I know that caret package works with pROC package when computing metrics but I need to use ROCR package in order to obtain the average ROC. However, I noticed that the average AUC values were not the same when using each package, so I am not sure if I should use both packages indistinctively. The code I used to prove that is: predictions_NG3<-list() labels_NG3<-list()