in knn(train, test, k)
22
23 # Get frequencies of each label
—> 24 output = np.unique(labels, return_counts=True)
25 # Find max frequency and corresonding label
26 index = np.argmax(output[1])
Problem in knn np.unique
sir np.unique create problem why
sir np.unique in knn create some promlem
The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.