title: Python sklearn: why are my neighbors.KNeighborsRegressor predictions "perfect"?
body: <p>I am running the following code:</p>
  
  <pre><code>from sklearn import neighbors
  import numpy as np
  import pandas as pd
  X = pd.DataFrame(np.random.randn(50, 4), columns=list('ABCD'))
  y = pd.DataFrame(np.random.randn(50, 1), columns=list('T'))
  KNN_ = neighbors.KNeighborsRegressor(n_neighbors=20, weights='distance').fit(X, y)
  yhat = KNN_.predict(X)
  error = yhat-y
  print(error)
  </code></pre>
  
  <p>Why are all the errors zero? As I understand it, the error should capture the difference between the fitted/ predicted values and my data points?</p>
  
  <p>I have applied essentially the same procedure with other estimators (such as Random Forest Regressor) and the error was nonzero as expected, so I fear I am missing a subtlety here in the code?</p>