proc-r-package

ROC function error “Predictor must be numeric or ordered.”

你说的曾经没有我的故事 提交于 2021-02-08 03:41:51
问题 I am not able to get ROC function to work, I get the error "Predictor must be numeric or ordered". I've looked through other posts, but nothing solves my problem. Any help is highly appreciated. "Get data" flying=dget("https://www.math.ntnu.no/emner/TMA4268/2019v/data/flying.dd") ctrain=flying$ctrain ctest=flying$ctest library(MASS) fly_qda=qda(diabetes~., data=ctrain) #Test error is given below: predict_qda=predict(fly_qda, newdata=ctest, probability=TRUE) table_qda<-table(ctest$diabetes,

SVM in R: “Predictor must be numeric or ordered.”

有些话、适合烂在心里 提交于 2020-12-31 06:23:30
问题 I'm new to R and I've ran into this problem: I want to compare two prediction techniques (Support Vector Machines and Neural Networks) applying them to some data and I would like to compare their performance. To do this, I use ROC curves. The code is supposed to compute the area under the ROC curve but it is not working. Neural networks code works fine, but when SVM part executes there was this error: > aucs <- auc((dtest$recid=="SI")*1, lr.pred) Error in roc.default(response, predictor, auc

What does coercing the “direction” argument input in roc function (package pROC in R) do exactly?

雨燕双飞 提交于 2020-01-03 16:46:27
问题 I want to create a roc object by using the function 'roc' of pROC package in R, and plot the roc object. However, I am uncertain what the 'direction' argument does. the median predictor values of my controls is smaller than the median predictor value of the cases. so I think the correct direction should be '<'. But if I plot it with direction argument '>'. it just flipped the ROC curve across the diagonal line as a mirror image. I am wondering in this situation that, data telling you 1 thing,

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()

How to deal with multiple class ROC analysis in R (pROC package)?

只愿长相守 提交于 2019-11-29 11:51:31
When I use multiclass.roc function in R (pROC package), for instance, I trained a data set by random forest, here is my code: # randomForest & pROC packages should be installed: # install.packages(c('randomForest', 'pROC')) data(iris) library(randomForest) library(pROC) set.seed(1000) # 3-class in response variable rf = randomForest(Species~., data = iris, ntree = 100) # predict(.., type = 'prob') returns a probability matrix multiclass.roc(iris$Species, predict(rf, iris, type = 'prob')) And the result is: Call: multiclass.roc.default(response = iris$Species, predictor = predict(rf, iris, type

How to deal with multiple class ROC analysis in R (pROC package)?

一曲冷凌霜 提交于 2019-11-28 05:09:47
问题 When I use multiclass.roc function in R (pROC package), for instance, I trained a data set by random forest, here is my code: # randomForest & pROC packages should be installed: # install.packages(c('randomForest', 'pROC')) data(iris) library(randomForest) library(pROC) set.seed(1000) # 3-class in response variable rf = randomForest(Species~., data = iris, ntree = 100) # predict(.., type = 'prob') returns a probability matrix multiclass.roc(iris$Species, predict(rf, iris, type = 'prob')) And

pROC ROC curves remove empty space

烈酒焚心 提交于 2019-11-27 07:14:38
问题 I want to draw ROC curves with pRoC. However for some reason there is extra empty space on either side of the x-axis and I cannot remove it with xlim. Some example code: library(pROC) n = c(4, 3, 5) b = c(TRUE, FALSE, TRUE) df = data.frame(n, b) rocobj <- plot.roc(df$b, df$n, percent = TRUE, main="ROC", col="#1c61b6", add=FALSE) I tried the pROC help file, but that doesn't really help me. Even more puzzling is to me that the Y-axis is OK looking... I really appreciate your help! 回答1: Make