Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am not sure how to make the confusion matrix. I understand I need to use one output but I do not understand where to
I am not sure how to make the confusion matrix. I understand I need to use one output but I do not understand where to state that one output behind y_test as y_test has more than one variable that could be used.
# Classification report from sklearn.metrics import classification_report # Confusion matrix from sklearn.metrics import confusion_matrix cm = confusion_matrix(y_test, predictions) cr = classification_report(y_test, predictions) print (cm) ValueError in 7 from sklearn.metrics import confusion_matrix 8 --> 9 cm = confusion_matrix(y_test, predictions) 10 11 cr= classification_report (y_test, predictions) C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py 71 72 ---> 73 74 75 Traceback (most recent call last) _weight, normalize) 274 275 --> 276 C:\ProgramData\Anaconda3\lib\site-packages\sklearn\metrics_classification.py in confusion_matrix(y_true, y pred, labels, sample 277 278 in inner_f(*args, **kwargs) FutureWarning) kwargs.update({k: arg for k, arg in zip (sig.parameters, args)}) return f(**kwargs) return inner_f 96 97 ---> 98 99 100 y type, y_true, y_pred = _check_targets (y_true, y_pred) if y_type not in ("binary", "multiclass"): raise ValueError("%s is not supported" % y_type) C:\ProgramData\Anaconda3\lib\site-packages\sklearn\metrics\_classification.py in _check_targets(y_true, y_pred) # No metrics support "multiclass-multioutput" format if (y_type not in ["binary", "multiclass", "multilabel-indicator"]): raise ValueError ("{0} is not supported".format(y_type)) if y_type in ["binary", "multiclass"]: ValueError: multiclass-multioutput is not supported
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started