Questions tagged [confusion-matrix]
A confusion matrix is a contingency table of correct and incorrect classifications used to evaluate the performance of a classification algorithm in machine learning.
1,098
questions
0
votes
0
answers
30
views
How to resolve "Error in confusionMatrix.default(predictions, as.factor(valid$Item)) : The data must contain some levels that overlap the reference."
I have a gold jewelry dataset and I am trying to predict which Item will a customer buy using a multinomial logistic regression. Item has 4 categories: necklace, bracelet, earrings, ring.
Here's my ...
-3
votes
0
answers
27
views
Confusion matrix in survival analysis [closed]
In a survival analysis i'm trying to create confusion matrix on my survival data using these survival models: "random survival forest","gradient boosting survival analysis","...
0
votes
0
answers
10
views
YOLOv8 Model Confusion Matrix Background 100% Detection
Confusion matrix
training statistics
I've been training this model on pothole images, but every time I train it, I always get 100% of the background images to be classified as pothole images.
Because ...
0
votes
3
answers
177
views
Is the method of plotting a confusion matrix correct?
I am trying to oversample the imbalanced data and compute a confusion matrix for the data science club. I also attached the link to the data set: https://www.kaggle.com/datasets/ealaxi/paysim1/data.
...
0
votes
1
answer
35
views
Updating Confusion Matrix for Scikit-learn
I have been working on an Jupyter Notebook that takes in a CSV file, and manipulates it and produces various models and visual elements to describe them.
one tool im using is a confusion matrix from ...
-1
votes
0
answers
6
views
I run neural network using R. I got stuck when come to the step confusion matrix. The error: argument length of actual and predicts are different
set.seed(1234)
ind<-sample(2,nrow(Glass4), replace=T, prob=c(0.7,0.3))
train<-Glass4[ind==1,]
test<-Glass4[ind==2,]
model<-neuralnet(Class~RI+Na+Mg+AL+Si+K+Ca+Ba+Fe,data=train,hidden=c(5,3)...
-1
votes
0
answers
16
views
Confusion Matrix for 3x3 [duplicate]
My coding actually already running properly however whenever I run it only shows 1 part.
The picture of the results
I want the percentage all been seen not only on Positive part only, I try many times ...
0
votes
1
answer
26
views
Deprecated confusion_matrix method
I'm working through a Udemy course and it appears that an aspect of it has not been edited to reflect recent updates. I'm attempting to create a Confusion Matrix for a classification problem using ...
0
votes
0
answers
18
views
Why the accuracy, precision and recall results for training and validation shows same value in each epoch in my deep learning model
I want to get the accuracy, precision and recall values, classification report for this problem.But I get same values for accuracy, precision and recall in each epoch. Also I get meager value for iou. ...
0
votes
1
answer
22
views
R Code Warning: number of items to replace is not a multiple of replacement length
From the Iris dataset, I have created the following confusion matrix:
In attempting to perform multiclass classification using the one vs many strategy, I have come up with the following R code:
mtrx ...
0
votes
2
answers
80
views
Confusion Matrix only shows diagonal values for selected labels despite misclassifications
I'm trying to create a confusion matrix for a subset of labels from my data. Despite having misclassified rows, the resulting confusion matrix shows zeros everywhere except the diagonal. Am I missing ...
0
votes
0
answers
21
views
how to generate a confusion matrix for single categorical predictor?
enter image description here
the student variable is categorical variable. I don't know how to do the Q3
I tried the following code
glm.1<-glm(default~student, data = Default, family = binomial)
...
0
votes
1
answer
77
views
How to calculate the sum of multiple confusion matrix in Python?
I have stored the results of 5 confusion matrix in an array. Now I have to calculate the sum of confusion matrix and then I want to use to calculate for True positive, False positive, False negative ...
0
votes
0
answers
52
views
Binary Image classification with CNN, but Precision-Recall-F1 Score is 0 for one class
I am trying to classify if a given image is a woodpile or not. So my classes are wood and none_wood. None_wood class contains different photos including documents, numbers, persons etc. My train set ...
0
votes
1
answer
90
views
Hugging Face K-fold
I want to calculate confusion matrix with K-fold for the entire Hugging Face BERT model.
The question is whenever I calculate confusion matrix without K-fold it gives me larger numbers like this:
{'tn'...
0
votes
0
answers
28
views
Can I manually create the confusion matrix y_true array?
I dont know how to get y_true from customdatagenerator
Can I direct creat a array and input label data?
val_datagen = CustomDataGenerator(image_folders, label_folders, valid_dir, **params, shuffle = ...
0
votes
1
answer
26
views
How to get correct confusion_matrix data in customdatagenerator
I'm building confusion_matrix, but I always return wrong shape y_true
I think my y_label is correct, I have 62 val data
I dont know y_true should be declare at where and where to get y_true
ValueError
...
1
vote
1
answer
27
views
How to get confusion_matrix y_true in Customdatagenerator
I want to build confusion_matrix but I always got error message
ValueError
Found input variables with inconsistent numbers of samples: [0, 62]
File "C:\Labbb\inceptionResnetV2\...
0
votes
0
answers
51
views
Is there a way to generate confusion matrix from eval script of Yolox?
I trained a "YOLOx" model and I need to get the confusion matrix of the results on model evaluation on test data. it does not seem like the "Yolox" has a direct method.
0
votes
2
answers
57
views
custom colours with normalisation in plotly for a confusion matrix
I'm trying to create a confusion matrix where
the neutral value is the 0, and should appear as white
positive values should appear as green, as higher the number, more green. Closest to 0, less green ...
0
votes
1
answer
555
views
How to plot a confusion matrix
I am trying to evaluate my renet50 model with a confusion matrix, but the confusion matrix looks like this:
matrix = confusion_matrix(y_test, y_pred, normalize="pred")
print(matrix)
# ...
0
votes
0
answers
103
views
XGBoost Bayesian Optimisation in tidymodels
I try to apply bayesian optimisation to a binary classification problem (XGBOOST) inside the tidymodels framework.
Are there any flaws inside my code - the model has run since 2 days on a 72 CPU ...
0
votes
1
answer
216
views
How can i get the total precision/recall/F1 score from the confusion matrix?
I have the following confusion matrix for a SVC model compute with sklearn:
Classification report:
precision recall f1-score support
0 0.7975000 0.5907407 0.6787234 ...
0
votes
0
answers
37
views
Where should I place confusion matrix code
I know there are many codes about drawing a confusion matrix on the internet, but none of them mention where they should be placed.
I don't know whether they should be placed after model.fit_generator,...
0
votes
1
answer
116
views
scikit-learn's ConfusionMatrixDisplay() with figsize()
Using figsize() in the following code creates two plots of the confusion matrix, one with the desired size but wrong labels ("Figure 1") and another with the default/wrong size but correct ...
0
votes
0
answers
137
views
How can I calculate the confusion matrix after executing Yolov7's detect.py?
I am currently encountering a problem, the results of yolov7's test.py and detect.py identifying the same test set are not the same.
How can I make detect.py generate a confusion matrix like test.py ...
0
votes
1
answer
75
views
why do I get 0 in the right column of knn classification confusion matrix?
I would like to build a knn model to classify and the dataset that I've used is https://archive.ics.uci.edu/dataset/19/car+evaluation
My confusion matrix is
[[385 0]
[134 0]]
I get a column of ...
-1
votes
1
answer
48
views
ValueError: multilabel-indicator is not supported confusion matrix
multilabel-indicator is not supported is the error message I get, when trying to run:
can you give me any solution or hint.
import seaborn as sns
sns.heatmap(confusion_matrix(y_test, y_pred), annot = ...
0
votes
0
answers
11
views
Why does the Confusion Matrix in Soft Voting vary across multiple iterations?
Why does the Confusion Matrix in Soft Voting vary across multiple iterations? Does probability=True have an influence? How can the Confusion Matrix results be consistent in Soft Voting?
from sklearn....
1
vote
0
answers
56
views
Confusion Matrix with image_dataset_from_directory
I'm trying to work with the FER2013 dataset, but I'm having trouble getting test data (confusion matrix). I downloaded the dataset and read it using tf.keras.preprocessing.image_dataset_from_directory ...
1
vote
0
answers
55
views
Pulling performance metrics from the confusion matrix formed in each loop in R
I'm new to R. I'm trying to solve a 4-class classification problem with the Samme.R algorithm. Due to the scotastic nature of the algorithm, I run it 100 times with the for loop. But I don't know how ...
0
votes
0
answers
39
views
Confusion Matrix
Hi:
I am learning MobileNet in Keras to study NN. But I get confused by the confusion matrix. I do not know why it's so weird. Can any else tell me if this is caused by the matrix code or the other ...
1
vote
0
answers
88
views
Confusion Matrix just showing the first row and the second row is 0
i am using the resnet50 pretrained model, and when the model.fit is done i'm checking the confussion matrix but i got this kind of output, what could be the problem?
import matplotlib.pyplot as plt
...
0
votes
0
answers
405
views
Can anyone explain this behaviour in yolo confusion matrix?
I have trained a model with yolov8 and only one class to detect objects in a video capture. After finishing my training I got this confusion matrix in the image.
I have tested the model and the model ...
0
votes
1
answer
80
views
What is the tidyr pivot_wider equivalent to the index argument in Python's pivot_table?
In this question (What is the best way in python to create a confusion matrix out of an already aggregated table with counts of actual labels and predicted labels), it is relatively straightforward to ...
0
votes
0
answers
654
views
How to manually plot confusion matrix with YOLOv8 with Python
I am currently working with Ultralytics - YOLOv8 model. I want to calculate the confusion matrix manually, not using val.py module. Hence, I wrote the code:
import os
import torch
from PIL import ...
0
votes
1
answer
49
views
I am using tf.keras.preprocessing.image_dataset_from_directory() for multi-class classification to load images. How do i calculate confusion matrix?
I am using tf.keras.preprocessing.image_dataset_from_directory() for multi-class classification to load images. How do i calculate confusion matrix in this case as i load dataset in two parts ...
0
votes
0
answers
165
views
Confusion matrix for multi-class classification, how to get FN TP TN FP
Building a classifier for a multi-class classification and can't figure out how to get FN TP TN FP such to get sensitivity and specificity values. Here is my output and code.code and output
I am ...
0
votes
0
answers
18
views
Getting R Error: `data` and `reference` should be factors with the same levels
This is my R code:
#scaling the data
scale_data <- as.data.frame(lapply(dataset[,2:12], scale))
#Spliting the dataset into training and testing sets
set.seed(123)
data_split <- ...
0
votes
2
answers
79
views
Confused about creating a result matrix for NxN matrix transposition in Python
NxN Matrix transposing gives wrong answers upon making "result" matrix = input matrix
Novice programmer here. I am trying to transpose a NxN matrix. Putting the code here to make the problem ...
0
votes
0
answers
99
views
ValueError: Multioutput target data is not supported with label binarization
ValueError: Multioutput target data is not supported with label binarization
I'm trying to plot the ROC curve and the confusion matrix for a multi class classification using ONE-vs-REST but I keep ...
0
votes
0
answers
40
views
Value error with confusion matrix of sklearn
I made a code to apply to several folders to make random forests. It seems to work on the first two and hangs on the third on my confusion matrix telling me that there is only 1 value in my matrix ...
0
votes
0
answers
105
views
How to Import a Custom Evaluation to my VertexAI Model
I have a classification model, and I want to import an evaluation model instance into the graphical interface of VertexAI using this code:
from google.cloud.aiplatform import gapic
metrics = {"...
0
votes
0
answers
12
views
How to create confusion matrix on this dtype "tensorflow.python.data.ops.dataset_ops.SkipDataset"
I'm working on image dataset having 7 different classes and splitted data based on train, valid, and test .. but when I'm predicting the given code:
# predicting labels of testing set and getting ...
0
votes
0
answers
24
views
Error: `data` and `reference` should be factors with the same levels. Confusion matrix on random forest model
I have code that takes a dataset with a list of wines, then applies random forest model to predict quality. The model is working but the confusion matrix is giving the following error:
> cmrfRed &...
0
votes
0
answers
20
views
How to add values to confusion matrix? [duplicate]
I'm trying to add values of the confusion matrix I made by my self.
This is my code:
import numpy as np
import matplotlib.pyplot as plt
metrics = np.random.randint(0, 50, (2,2))
ax = fig.add_subplot(...
2
votes
1
answer
62
views
Good val accuracy but bad prediction/bad confusion matric
I got a issue when I try to plot the confusion matrix, it's appear that the model didn't learn anything even if I get "good" val and test acc.
def create_chevaux_rgb2(directory) :
# ...
-1
votes
1
answer
75
views
Error from confusion matrix 'Sequential' object has no attribute 'predict_classes' [duplicate]
I have tried to run this code to output the confusion matrix. but there is an error when I run. it should come out with the matrix confusion diagram and its label.
Code:
#Output confusion matrix
...
0
votes
0
answers
239
views
How can I create a confusion matrix with the results of the COCOEvaluator of detetctron2?
I am really new in this topic and I wanted to ask how I can generate the file instances_default.json for the confusion matrix described in the answer here:
Build confusion matrix for instance ...
-1
votes
1
answer
175
views
Name 'predicted_class' is not defined
i try to run confusion matrix codes. before this I'am use
print_confusion_matrix(Y_val_org, model.predict_classes(X))
but this function is deprecated then changes to
predict_x=model.predict(X)
...