Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num = len(X_train) # Compute the number of points in X_train
- distance = np.zeros(num) # Initialize an arrays of zeros
- for i in range(num):
- distance[i] = dist(X_train[i], X_test) # Compute distance from X_train[i] to X_test
- min_index = np.argmin(distance) # Get the index with smallest distance
- print(Y_train[min_index])
- 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement