title: Find distance between a centroid and a point
body: <p>Let's say I have this list of a point' features <code>[3.5, 2.5, 7.5]</code> and the calculated centroid of a class - <code>0.700</code></p>
  <p>I have to find the Euclidean distance between the point and the centroid. And this is where I'm lost as the formula for Euclidean distance that I'm using is:</p>
  <p><img src="https://latex.codecogs.com/gif.latex?dist%20%3D%20%5Csqrt%7B%5Cleft%20%28%20x_%7B1%7D%20-%20y_%7B1%7D%5Cright%20%29%5E2%20+%20%28x_2%20-%20y_2%29%5E2%7D" alt="dist = \sqrt{\left ( x_{1}  - y_{1}\right )^2 + (x_2 - y_2)^2}" /></p>
  <pre><code>def __euclidean(self, x, y):
      return sqrt(sum(pow(a - b, 2) for a, b in zip(x, y)))
  </code></pre>
  <p>In this case, the x variable is the list of features and the y variable is the value of the centroid - 0.7.
  Am I missing something obvious?</p>
  <p>Edit: I'm adding the algorithm I'm trying to implement as well as the formula for the centroid.</p>
  <p>algorithm:
  <a href="https://i.stack.imgur.com/4EGcb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4EGcb.png" alt="enter image description here" /></a></p>
  <p>The input of Algorithm 1 are the training data, X = {x1, x2,...,xn}, the number of centroid neighbours k, the distance metric (Dist) to compute the similarity between points, and the target point p whose class will be estimated. The output is the radius that defines the neighbourhood around
  the target point p.</p>
  <p>centroid formula:</p>
  <pre><code>def __compute_centroid(self, points):
      sum_centroid = []
      for p in points:
          sum_centroid.append(sum(p))
      return (1 / len(points)) * sum(sum_centroid)
  </code></pre>