confusion-matrix

Error in Confusion Matrix with Random Forest

北战南征 提交于 2019-12-13 20:24:45
问题 I have a dataset with 4669 observations and 15 variables. I am using Random forest to predict if a particular product will be accepted or not. With my latest data , I have my output variable with "Yes", "NO" and "". I wanted to predict if this "" will have Yes or No. I am using the following code. library(randomForest) outputvar <- c("Yes", "NO", "Yes", "NO", "" , "" ) inputvar1 <- c("M", "M", "F", "F", "M", "F") inputvar2 <- c("34", "35", "45", "60", "34", "23") data <- data.frame(cbind

confusion matrix error “Classification metrics can't handle a mix of multilabel-indicator and multiclass targets”

偶尔善良 提交于 2019-12-13 18:15:06
问题 I am getting the Classification metrics can't handle a mix of multilabel-indicator and multiclass targets error when I try to use confusion matrix. I am doing my first deep learning project. I am new to it. I am using the mnist dataset provided by keras. I have trained and tested my model successfully. However, when I try to use the scikit learn confusion matrix I get the error stated above. I have searched for an answer and while there are answers on this error, none of them worked for me.

Draw ROC curve in python using confusion matrix only

荒凉一梦 提交于 2019-12-13 15:37:12
问题 I need to draw ROC curve using confusion matrix only. Actually my system was crashed ( every information was lost), therefore I am not getting data. I have only values of confusion matrix. I know how to create ROC curve (http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc_crossval.html), but not getting any clue how to draw from confusion matrix. Please help me in this regards. 回答1: Unfortunately you can't build a ROC curve from a single contingency matrix. A ROC curve shows

random forest package prediction, newdata argument?

北战南征 提交于 2019-12-12 10:12:50
问题 I've just recently started playing around with the random forest package in R. After growing my forest, I tried predicting the response using the same dataset (ie the training dataset) which gave me a confusion matrix different from the one that was printed with the forest object itself. I thought there might be something wrong with the newdata argument but I followed the example given in the documentation to the t and it gave the same problem. Here's an example using the Species dataset.

Scikit - changing the threshold to create multiple confusion matrixes

旧街凉风 提交于 2019-12-12 07:52:53
问题 I'm building a classifier that goes through lending club data, and selects the best X loans. I've trained a Random Forest, and created the usual ROC curves, Confusion Matrices, etc. The confusion matrix takes as an argument the predictions of the classifier (the majority prediction of the trees in the forest). However, I wish to print multiple confusion matrices at different thresholds, to know what happens if I choose the 10% best loans, the 20% best loans, etc. I know from reading other

WEKA software analysis of confusion matrix

穿精又带淫゛_ 提交于 2019-12-12 07:01:58
问题 *Hi again i am in problem for comparing confusion matrix. Bellow i have provided the two confusion matrix. a b classified as 349 58 a tested_negative 93 124 b tested_positive a b classified as 346 61 a tested_negative 90 127 b tested_positive i know that the diagonal of top-left to right but here both that value is same so how can i make decision which one best?* 回答1: It actually depends on your specific application. Say you want to minimize number of false positives (because it will cost you

Why am I getting a 1.000 ROC area value even when I don't have 100% of accuracy

一笑奈何 提交于 2019-12-12 03:49:18
问题 I am using Weka as a classifier, and it has worked great for me so far. However, in my last test, I got a 1.000 ROC area value (which, if i remember correctly, represents a perfect classification) without having 100% of accuracy, as can be seen in the Confusion Matrix in the Figure. My question is: Am I interpreting the results incorrectly or am I getting wrong results (maybe the classifier I am using is badly programmed, although I don't think it's likely)? Classification output Thank You!

Sklearn confusion matrix estimation by cross validation

旧时模样 提交于 2019-12-12 03:32:16
问题 I am trying to estimate the confusion matrix of a classifier using 10-fold cross-validation with sklearn. To compute the confusion matrix I am using sklearn.metrics.confusion_matrix . I know that I can evaluate a model with cv using sklearn.model_selection.cross_val_score and sklearn.metrics.make_scorer like: from sklearn.metrics import confusion_matrix, make_scorer from sklearn.model_selection import cross_val_score cm = cross_val_score(clf, X, y, make_scorer(confusion_matrix)) Where clf is

confusion matrix format after converting to json results using python

人盡茶涼 提交于 2019-12-11 01:04:59
问题 My confusion matrix code will be like this confusionmatrix = pd.DataFrame( confusion_matrix(test["Churn"], predictions), columns=["Predicted False", "Predicted True"], index=["Actual False", "Actual True"] ) I am getting results like this Predicted False Predicted True Actual False 877 100 Actual True 183 179 After i converted this above confusion matrix results to json. My json results would be like this results = [{'confusionmatrix' : confusionmatrix}] final = pd.Series(results).to_json

How to fix google colab cutting of plots of confusion matrices

╄→гoц情女王★ 提交于 2019-12-10 21:14:26
问题 I'm trying to create a confusion matrix on google colab but once I plot it and try to save it the top and the bottom of the plot get cut off. Is there any way to fix this? %matplotlib inline import seaborn as sn import pandas as pd import matplotlib.pyplot as plt from google.colab import files array = [[1, 0, 0], [0, 1, 0.0101], [0, 0, 0.9898]] df_cm = pd.DataFrame(array, index = ["REM", "Wake", "NREM"], columns = ["REM", "Wake", "NREM"],) plt.figure(figsize = (10,7)) sn.heatmap(df_cm, annot