roc

ROC curve for the testing set using Caret package

自闭症网瘾萝莉.ら 提交于 2021-01-28 08:56:53
问题 I am trying to obtain ROC curve for the best model from caret on the test set. I came across MLeval package which seems to be handy (the output is very thorough, providing all the needed metrics with graphs using few lines of code). A nice example is here: https://stackoverflow.com/a/59134729/12875646 I am trying the code below and able to obtain the required metrics/graphs for the training set but keep getting error when I try to work on the testing set. library(caret) library(MLeval) data

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

How can I generate a plot of positive predictive value (PPV) vs various cut-off points for classifications?

两盒软妹~` 提交于 2020-12-25 01:29:08
问题 I have generated some scores to help predict whether or not something is yes (1) or no (0), let's say the data consists of: scores = c(10:20) response = c(0,0,1,0,1,0,1,1,0,1,1) mydata = data.frame(scores, response) I can do an ROC analysis, which gives an AUC of .77: roc(response = mydata$response, predictor = mydata$scores) Now, how exactly do I see what happens when various cut-offs are chosen? I'd like to have cut-offs on the x-axis (let's say 13,14,15,16,17) and PPV on the y-axis. What's

How to plot ROC_AUC curve for each folds in KFold Cross Validation using Keras Neural Network Classifier

Deadly 提交于 2020-12-13 03:12:57
问题 I really need to find ROC plot for each folds in a 5 fold cross-validation using Keras ANN. I have tried the code from the following link [https://scikit-learn.org/stable/auto_examples/model_selection/plot_roc_crossval.html#sphx-glr-auto-examples-model-selection-plot-roc-crossval-py][1] It works perfectly fine when I'm using the svm classifier as shown here. But when I want to use wrapper to use Keras ANN model it shows errors. I am stuck with this for months now. Can anyone please help me

Different result roc_auc_score and plot_roc_curve

让人想犯罪 __ 提交于 2020-05-31 04:07:02
问题 I am training a RandomForestClassifier (sklearn) to predict credit card fraud. When I then test the model and check the rocauc score i get different values when I use roc_auc_score and plot_roc_curve . roc_auc_score gives me around 0.89 and the plot_curve calculates AUC to 0.96 why is that? The labels are all 0 and 1 as well as the predictions are 0 or 1. CodE: clf = RandomForestClassifier(random_state =42) clf.fit(X_train, y_train[target].values) pred_test = clf.predict(X_test) print(roc_auc

Different result roc_auc_score and plot_roc_curve

[亡魂溺海] 提交于 2020-05-31 04:05:52
问题 I am training a RandomForestClassifier (sklearn) to predict credit card fraud. When I then test the model and check the rocauc score i get different values when I use roc_auc_score and plot_roc_curve . roc_auc_score gives me around 0.89 and the plot_curve calculates AUC to 0.96 why is that? The labels are all 0 and 1 as well as the predictions are 0 or 1. CodE: clf = RandomForestClassifier(random_state =42) clf.fit(X_train, y_train[target].values) pred_test = clf.predict(X_test) print(roc_auc

Cross_val_score is not working with roc_auc and multiclass

那年仲夏 提交于 2020-05-28 06:53:08
问题 What I want to do: I wish to compute a cross_val_score using roc_auc on a multiclass problem What I tried to do: Here is a reproducible example made with iris data set. from sklearn.datasets import load_iris from sklearn.preprocessing import OneHotEncoder from sklearn.model_selection import cross_val_score iris = load_iris() X = pd.DataFrame(data=iris.data, columns=iris.feature_names) I one hot encode my target encoder = OneHotEncoder() y = encoder.fit_transform(pd.DataFrame(iris.target))