Hello Rohit Kulkarni,
Welcome to the MS Q&A platform.
As per the error message, it seems like you are passing a singleton array (an array with only one element) as an argument to the classification_report
function. This is causing the function to raise a TypeError
.
Please check the shape of your ytest
and ytest_predict
arrays to ensure that they have the same number of elements
import numpy as np
print(np.array(ytest).shape)
print(np.array(ytest_predict).shape)
If the shapes are the same then you can try reshaping the singleton array to be a one dimensional array using the np.ravel(),
, which should be a valid collection for the classification_report
function.
print(classification_report(ytest,np.ravel(ytest_predict)))
If you are still facing the error, please provide more context or code snippets to understand the issue better.