title: Correct implementation of weighted K-Nearest Neighbors
body: <p>From what I understood, the classical KNN algorithm works like this (for discrete data):</p>
  
  <ul>
  <li>Let <strong>x</strong> be the point you want to classify</li>
  <li>Let <strong>dist(a,b)</strong> be the Euclidean distance between points <strong>a</strong> and <strong>b</strong></li>
  <li>Iterate through the training set points <strong>pᵢ</strong>, taking the distances <strong>dist(pᵢ,x)</strong></li>
  <li>Classify <strong>x</strong> as the most frequent class between the <strong>K</strong> points closest (according to <strong>dist</strong>) to <strong>x</strong>.</li>
  </ul>
  
  <hr>
  
  <p>How would I introduce weights on this classic KNN? I read that more importance should be given to nearer points, and I read <a href="http://www.data-machine.com/nmtutorial/distanceweightedknnalgorithm.htm" rel="nofollow noreferrer">this</a>, but couldn't understand how this would apply to discrete data.</p>
  
  <p>For me, first of all, using <strong>argmax</strong> doesn't make any sense, and if the weight acts increasing the distance, than it would make the distance worse.  Sorry if I'm talking nonsense.</p>