Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def n_clusters_analysis(X, nmax = 10, nmin = 2):
global prj, n_jobs
from sklearn.cluster import KMeans
inertia = []
for n in range(nmin, nmax + 1):
log.info("fitting %d clusters to data" % n)
km = KMeans(n_clusters = n, n_jobs=n_jobs).fit(X)
inertia.append(km.inertia_)
views.plot_intertia(prj, range(nmin, nmax + 1), inertia)