721
edits
Line 52: | Line 52: | ||
To calculate a centroid of a collection of points (our cluster) we need to do two steps: | To calculate a centroid of a collection of points (our cluster) we need to do two steps: | ||
* sum up our points: <syntaxhighlight inline>p0 + p1 + p2 + p3 ... = sum </syntaxhighlight> | * sum up our points: <syntaxhighlight lang="python" inline>p0 + p1 + p2 + p3 ... = sum </syntaxhighlight> | ||
* divide the sum by out number of point: | * divide the sum by out number of point: | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="python" inline> | ||
centroid = sum / num_of_points | centroid = sum / num_of_points | ||
</syntaxhighlight> | </syntaxhighlight> |