Created
July 5, 2019 19:41
-
-
Save RoaldSchuring/56832d6fd45822800c8de0f8cd2af689 to your computer and use it in GitHub Desktop.
predict_fn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def predict_fn(input_data, model): | |
input_data_reshaped = input_data.reshape(1, -1) | |
distance, indice = model.kneighbors(input_data_reshaped, 11) | |
distance_list = distance[0].tolist()[1:] | |
indice_list = indice[0].tolist()[1:] | |
nearest_neighbors = [distance_list, indice_list] | |
print('predict_fn output is', nearest_neighbors) | |
return np.array(nearest_neighbors) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment