check_neighbors_object¶
-
imbalanced_ensemble.utils.
check_neighbors_object
(nn_name, nn_object, additional_neighbor=0)¶ Check the objects is consistent to be a NN.
Several methods in imbalanced_ensemble.sampler relies on NN. Only KNeighborsMixin will be accepted. This utility allows for type checking and raise if the type is wrong.
- Parameters
- nn_namestr
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.
- Returns
- nn_objectKNeighborsMixin
The k-NN object.