I'm writing a k nearest neighbor classifier in Numpy and faiss (Facebook kNN library). For point classification, I receive:
[[ 9240 4189 8702]
[ 2639 1052 13565]
[10464 14220 13980]
...
[12014 12063 1331]
[ 6719 5832 8827]
[ 1793 5455 12328]]
Each row is an index of the y vector. I need to reference the values for this matrix in the y vector, so e. g. I will swap 9240 in the matrix for y[9240] value, for example 1 (positive class).
Can I do that without Python loop, i. e. can this be done with Numpy only?
ya 1d vector?y[your_array]