here is my code and i am getting this error
Diabetes Challenge
hey @naazsayma123 ,
you KNN function is returning a scaler value , i mean a number .
and a an integer value can’t be indexed .
so just change it to , pred
instead of pred[0]
it will work.
It still not working
what is the error you are getting now ?
its something else.
your new_vals array has a single element , hence you can’t access the index 1.
in above np.unique
, add a parameter return_counts=True
I hope it works then
https://drive.google.com/file/d/1zxGSR1Jkz5A-Bp22Q4G2-malMF6VxvGa/view?usp=sharing
I am getting only 66% accuracy
hey @naazsayma123 ,
try working with different values of K .
and also try working on your dataset.
like standardizing data can help you.
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.