Advertisement
lessientelrunya

nnalgorithm

Jun 28th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. num = len(X_train) # Compute the number of points in X_train
  2. distance = np.zeros(num) # Initialize an arrays of zeros
  3. for i in range(num):
  4.     distance[i] = dist(X_train[i], X_test) # Compute distance from X_train[i] to X_test
  5. min_index = np.argmin(distance) # Get the index with smallest distance
  6. print(Y_train[min_index])
  7. 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement