confusion-matrix

plot_confusion_matrix without estimator

plot_confusion_matrix without estimator Question: I’m trying to use plot_confusion_matrix, from sklearn.metrics import confusion_matrix y_true = [1, 1, 0, 1] y_pred = [1, 1, 0, 0] confusion_matrix(y_true, y_pred) Output: array([[1, 0], [1, 2]]) Now, while using the followings; using ‘classes’ or without ‘classes’ from sklearn.metrics import plot_confusion_matrix plot_confusion_matrix(y_true, y_pred, classes=[0,1], title=’Confusion matrix, without normalization’) or plot_confusion_matrix(y_true, …

Total answers: 5

Plot a Confusion Matrix in Python using a Dataframe of Strings

Plot a Confusion Matrix in Python using a Dataframe of Strings Question: I’m doing a 10-fold validation and I need to see how the accuracy of each class changes. I managed to create a DataFrame like this: Snippet: chars = [] for i in range(0, int(classes) + 1): row = [] for j in range(0, …

Total answers: 1

How to get rid of white lines in confusion matrix?

How to get rid of white lines in confusion matrix? Question: Does anyone know why these white lines are quartering my confusion matrix? I’ve changed many of the parameters but cannot figure it out. The only thing that makes them go away is if I don’t label the blocks at all, ie ‘0’, ‘1’,… but …

Total answers: 2

tensorflow – tf.confusion_matrix() throws error ValueError: Shape (2, 2048, 2) must have rank 2

tensorflow – tf.confusion_matrix() throws error ValueError: Shape (2, 2048, 2) must have rank 2 Question: I try to determine the confusion_matrix of my neural network model which is written in python by using google tensorflow. By using this piece of code: cm = tf.zeros(shape=[2,2], dtype=tf.int32) for i in range(0, validation_data.shape[0], batch_size_validation): batched_val_data = np.array(validation_data[i:i+batch_size_validation, :, …

Total answers: 1

python tabulating confusion matrix

python tabulating confusion matrix Question: In my sklearn logistic regression model, I obtained a confusion matrix using metrics.confusion_matrix command. The array looks like this array([[51, 0], [26, 0]]) Ignoring the fact that the model did pretty bad, I am trying to understand what is the best way to tabulate this matrix in pretty way I …

Total answers: 3

How to normalize a confusion matrix?

How to normalize a confusion matrix? Question: I calculated a confusion matrix for my classifier using confusion_matrix() from scikit-learn. The diagonal elements of the confusion matrix represent the number of points for which the predicted label is equal to the true label, while off-diagonal elements are those that are mislabeled by the classifier. I would …

Total answers: 9