How to use the ergo.views.plot_intertia function in ergo

To help you get started, we’ve selected a few ergo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github evilsocket / ergo / ergo / actions / explore.py View on Github external
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)