Quote:
To write the code its complicated because several python files are imported so it'll be so long for anyone to read. My all problem is that KNN_batch is not available as an attribute of nearest_neighbors so I want to have it but don't know how
And there's the problem: we can't see any of your code, so we have no idea what you are working with.
That's like you going for a drive, breaking down in the middle of nowhere, calling the garage, saying "it broke" and turning your phone off. How long do you think it will be before the garage arrives with the right part to fix your car, given that they don't know what car it is, what happened to it, or even where the heck it is?
We are in the same position: we can't fix problems when we have no information at all.
So it's going to be up to you. start by finding out what attributes
nearest_neighbors
has, and what module
knn_batch
is part of.
Then use the debugger
pdb — The Python Debugger — Python 3.10.0 documentation[
^].
Put a breakpoint on the first line in the function where the error occurs, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.
Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!