Skip to content

How can we create confusion matrix? #9

@AdeelMirza

Description

@AdeelMirza

I am trying to make my custom model. And I want to generate a confusion matrix for that as accuracy is not a good measure for this data set.
I am trying it by following code.

from sklearn.metrics import confusion_matrix
cm=confusion_matrix(X_dev,Y_dev)

But getting following error:-

ValueError                                Traceback (most recent call last)
<ipython-input-10-0dcf84d46f09> in <module>
----> 1 cm=confusion_matrix(X_dev,Y_dev)

~/anaconda3/lib/python3.7/site-packages/sklearn/metrics/classification.py in confusion_matrix(y_true, y_pred, labels, sample_weight)
    251 
    252     """
--> 253     y_type, y_true, y_pred = _check_targets(y_true, y_pred)
    254     if y_type not in ("binary", "multiclass"):
    255         raise ValueError("%s is not supported" % y_type)

~/anaconda3/lib/python3.7/site-packages/sklearn/metrics/classification.py in _check_targets(y_true, y_pred)
     86     # No metrics support "multiclass-multioutput" format
     87     if (y_type not in ["binary", "multiclass", "multilabel-indicator"]):
---> 88         raise ValueError("{0} is not supported".format(y_type))
     89 
     90     if y_type in ["binary", "multiclass"]:

ValueError: unknown is not supported

Will someone help me for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions