SMOTE needs the nearest minority neighbors of each sample. The paper uses Euclidean distance, and the neighbors are chosen from the minority class only.
Implement nearest_neighbors(X, x, k), returning the indices of the k closest rows, nearest first.
Compute the distance from x to every row, then sort the indices by distance and keep the first k.
No results yet
Run your code to check it against the examples, or submit to run every test.