A confusion matrix is a contingency table of correct and incorrect classifications used to evaluate the performance of a classification algorithm in machine learning.
Questions tagged [confusion-matrix]
1111 questions
-1
votes
1 answer
Predicting results with high precision in ML classification problem
I'm working on a multi-class classification problem and want to make predictions with high precision for a single class only (i.e. to predict less but correctly).
I've high lighted the total number of predictions and True positive cases for class-1.…
-1
votes
2 answers
How can I add vertical lines to my confusion matrix generated with matlab?
I have used the following code to generate my confusion matrix, which I have found it on internet :
confmat = C;
labels = {'0', '1', '2', '3', '11' };
numlabels = size(confmat, 1); % number of labels
confpercent =…

baddy
- 369
- 1
- 3
- 23
-1
votes
1 answer
Get multi-class confusion matrix equal to number of class labels
I trained Random Forest Classifier in sklearn to predict multi-class classification problem.
My dataset has four class labels. But my code create 2x2 confusion matrix
y_predict = rf.predict(X_test)
conf_mat = sklearn.metrics.confusion_matrix(y_test,…

ZEESHAN
- 191
- 2
- 15
-1
votes
1 answer
using predict on a regression model
I am trying to figure out how to pass my regression model through to test it with the other part of my dataset so I can start my confusing matrix but I am at a loss of what I am doing wrong.…

Timenight113
- 29
- 4
-1
votes
1 answer
Confusion matrix image in matlab
I'm trying to make a confusion matrix for some classification problem.
So far, I've managed to make a 10 by 10 matrix that stores the accuracy of my estimation for classification problem.
Now I want to make a 10 by 10 square image(?) that has a…

WannabeArchitect
- 1,058
- 2
- 11
- 22
-1
votes
3 answers
How to read a csv file and plot confusion matrix in python
I have a CSV file with 2 columns as
actual,predicted
1,0
1,0
1,1
0,1
.,.
.,.
How do I read this file and plot a confusion matrix in Python?
I tried the following code from a program.
import pandas as pd
from sklearn.metrics import…

uNIKx
- 123
- 2
- 13
-1
votes
1 answer
How to calculate the accuracy of classes from a 7x7 confusion matrix?
So I've got the following results from Naïves Bayes classification on my data set:
I am stuck however on understanding how to interpret the data. I am wanting to find and compare the accuracy of each class (a-g).
I know accuracy is found using this…

rshah
- 675
- 2
- 12
- 32
-1
votes
1 answer
Using confusion matrix to find model accuracy instead of built-it predict method
I have a dataset that I want to build a classification model for it. Given that scikit-learn provides confusion matrix implementation confusion_matrix(test_y, pred_r), I want to use it to calculate the accuracy of my model instead of directly using…

Judas
- 103
- 1
- 9
-1
votes
1 answer
Scikit: How do i display actual labels instead of 0 and 1's as indexes for confusion matrix
I have a confusion matrix but it has 0,1,2 as indexes/labels instead of actual labels. Is there any way to display the actual labels as index for confusion matrix in scikit?

Vivek Sharma
- 19
- 1
- 3
-1
votes
1 answer
Getting list index out of range error in Confusion matrix
import pygame
import numpy
import pickle
import pdb
import sys
def printConfMatrix(grid,num):
# Define some colors
BLACK = ( 0, 0, 0)
WHITE = ( 255, 255, 255)
GREEN = ( 0, 255, 0)
RED = ( 255, 0, …
-1
votes
1 answer
WEKA software analysis of confusion matrix
*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 …

Mohammad Hasan
- 123
- 1
- 6
- 22
-2
votes
1 answer
interpret the performance of my model from confusion matrix
how I can interpret the performance of my model from this matrix

seni
- 659
- 1
- 8
- 20
-2
votes
2 answers
Should there be a correlation between an f1 score and the confusion matrix results in a gradient-boosted decision tree model (XGBoost)?
I'm building a decision tree model based on data from the "Give me some credit" Kaggle competition (https://www.kaggle.com/competitions/GiveMeSomeCredit/overview). I'm trying to train this model on the training dataset from the competition and then…

mvinegret
- 31
- 5
-2
votes
1 answer
Confusion matrix fails to show all labels
I have created a classification matrix for multi-label classification to evaluate the performance of the MLPClassifier model. The confusion matrix output should be 10x10 but at times I get 8x8 as it doesn't show label values for either 1 or 2 class…

Srikanth Tangirala
- 41
- 1
- 1
- 7
-2
votes
1 answer
why confusion matrix do not show accuracy in its calculated measures
I try to calculate accuracy after running the knn method on the dataset. But its output does not show the accuracy measure in it. how can I fix it in order to show accuracy in its calculated measure?
thank you for your consideration.
here is…

hsi
- 97
- 1
- 11