Skip to content

Commit

Permalink
Update metricas.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jtemporal authored Jun 27, 2019
1 parent dff3338 commit 629c40d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/metricas.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def optimal_number_of_clusters(wcss):
x0 = i+2
y0 = wcss[i]

numerator = abs((y2-y1)*x0 - (x2-y2)*y0 + x2*y1 - y2*x1)
numerator = abs((y2-y1)*x0 - (x2-x1)*y0 + x2*y1 - y2*x1)
denominator = sqrt((y2 - y1)**2 + (x2 - x1)**2)
distances.append(numerator/denominator)
return distances.index(max(distances)) + 2
Expand Down Expand Up @@ -51,4 +51,4 @@ def calculate_wcss(data):
kmeans.fit(X=data)
wcss.append(kmeans.inertia_)

return wcss
return wcss

0 comments on commit 629c40d

Please sign in to comment.