title: How to use a user defined metric for nearest neighbors in scikit-learn?
body: <p>I am using scikit-learn 0.18.dev0. I know exactly the same question has been asked before <a href="https://stackoverflow.com/questions/21052509/sklearn-knn-usage-with-a-user-defined-metric">here</a>. I tried the answer presented there, I am getting the following error</p>
  
  <pre><code>&gt;&gt;&gt; def mydist(x, y):
  ...     return np.sum((x-y)**2)
  ...
  &gt;&gt;&gt; X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3,   2]])
  
  &gt;&gt;&gt; nbrs = NearestNeighbors(n_neighbors=4, algorithm='ball_tree',
  ...            metric='pyfunc', func=mydist)
  </code></pre>
  
  <p>Error message 
  <code>_init_params() got an unexpected keyword argument 'func'</code></p>
  
  <p>It looks like this option has been removed. How can I use a user defined matrix in <code>sklearn.neighbors</code>?</p>