import matplotlib.pyplot as plt
from pre_process import *
from sklearn.cluster import KMeans
import numpy as np

# elbow method: finding number of clusters

distortions = []
for i in range(1, 20):
    km = KMeans(n_clusters = i, init = 'k-means++', n_init = 20, max_iter = 300, random_state = 0)
    km.fit(co_sim_matrix)
    distortions.append(km.inertia_)

plt.plot(range(1,20), distortions, marker='o')
plt.xlabel('Number of clusters')
plt.ylabel('Distortion')
plt.show()
#
#
# ambiguos curve
x = list()
for i in range (1, 20):
    x.append(1000/i)

plt.plot(range(1, 20), x, marker = 'o')
plt.show()

d88ed97b60bad5d681921f20000ec9781bf6dd59
<mask token>

<mask token>
for i in range(1, 20):
    km = KMeans(n_clusters=i, init='k-means++', n_init=20, max_iter=300,
        random_state=0)
    km.fit(co_sim_matrix)
    distortions.append(km.inertia_)
plt.plot(range(1, 20), distortions, marker='o')
plt.xlabel('Number of clusters')
plt.ylabel('Distortion')
plt.show()
<mask token>
for i in range(1, 20):
    x.append(1000 / i)
plt.plot(range(1, 20), x, marker='o')
plt.show()

<mask token>
distortions = []
for i in range(1, 20):
    km = KMeans(n_clusters=i, init='k-means++', n_init=20, max_iter=300,
        random_state=0)
    km.fit(co_sim_matrix)
    distortions.append(km.inertia_)
plt.plot(range(1, 20), distortions, marker='o')
plt.xlabel('Number of clusters')
plt.ylabel('Distortion')
plt.show()
x = list()
for i in range(1, 20):
    x.append(1000 / i)
plt.plot(range(1, 20), x, marker='o')
plt.show()

import matplotlib.pyplot as plt
from pre_process import *
from sklearn.cluster import KMeans
import numpy as np
distortions = []
for i in range(1, 20):
    km = KMeans(n_clusters=i, init='k-means++', n_init=20, max_iter=300,
        random_state=0)
    km.fit(co_sim_matrix)
    distortions.append(km.inertia_)
plt.plot(range(1, 20), distortions, marker='o')
plt.xlabel('Number of clusters')
plt.ylabel('Distortion')
plt.show()
x = list()
for i in range(1, 20):
    x.append(1000 / i)
plt.plot(range(1, 20), x, marker='o')
plt.show()

import matplotlib.pyplot as plt
from pre_process import *
from sklearn.cluster import KMeans
import numpy as np

# elbow method: finding number of clusters

distortions = []
for i in range(1, 20):
    km = KMeans(n_clusters = i, init = 'k-means++', n_init = 20, max_iter = 300, random_state = 0)
    km.fit(co_sim_matrix)
    distortions.append(km.inertia_)

plt.plot(range(1,20), distortions, marker='o')
plt.xlabel('Number of clusters')
plt.ylabel('Distortion')
plt.show()
#
#
# ambiguos curve
x = list()
for i in range (1, 20):
    x.append(1000/i)

plt.plot(range(1, 20), x, marker = 'o')
plt.show()
