Home » Solving “COMET ERROR: Error creating confusion matrix: 0; ignoring”

Solving “COMET ERROR: Error creating confusion matrix: 0; ignoring”

  • by
  • 2 min read
Tags:

Lately, I have been messing around with some machine learning training & monitoring tools. Since Comet.ml has been high on my wish list for a couple of months, it was an obvious choice to give it a spin. I really like Comet.ml so expect more blog posts in the future. In this blog post: a “confusing” error.

When I first wanted to use the confusion matrix feature of Comet.ml, I ran the following code:

experiment.log_confusion_matrix(y_true=y_val, y_predicted=y_pred, title='Confusion Matrix', \
	row_label='Actual Category', column_label='Predicted Category')

However, I ran into the following error:

COMET ERROR: Error creating confusion matrix: 0; ignoring

Something inside me tends to break when an error is thrown, and it doesn’t say what the problem exactly is. Thanks for informing me I produced an error. Glad you’re ignoring my code.

However, the Comet.ml documentation is quite detailed so I quickly found what the problem was. Both the y_true and y_predicted argument should be a list.

(optional) list of vectors representing the targets, or a list of integers representing the correct label. If not provided, then matrix may be provided.

In my case, I was passing a one-column Pandas DataFrame. I expected this to work because on a previous try, I actually managed to pass a NumPy array. Apparently, Comet.ml does accept NumPy arrays yet does not convert one-column DataFrames to lists.

Conclusion: check the data type of your y_true and y_pred variables.

Say thanks, ask questions or give feedback

Technologies get updated, syntax changes and honestly… I make mistakes too. If something is incorrect, incomplete or doesn’t work, let me know in the comments below and help thousands of visitors.

Leave a Reply

Your email address will not be published. Required fields are marked *