- imblearn.utils.check_neighbors_object(nn_name, nn_object, additional_neighbor=0)[source]#
Check the objects is consistent to be a k nearest neighbors.
Several methods in
imblearnrelies on k nearest neighbors. These objects can be passed at initialisation as an integer or as an object that has KNeighborsMixin-like attributes. This utility will create or clone said object, ensuring it is KNeighbors-like.
The name associated to the object to raise an error if needed.
- nn_objectint or KNeighborsMixin
The object to be checked.
- additional_neighborint, default=0
Sometimes, some algorithm need an additional neighbors.
The k-NN object.