How to use the ergo.views.plot_clusters 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
if not args.nclusters:
                args.nclusters = 2
            log.info("computing dbscan clustering with eps=%f" % args.nclusters)
            if args.nmaxclusters:
                log.warning("nmax specified but not used. Inertia analysis only available for Kmeans.")
        if not args.pca and not inertia:
            log.info("computing pca to plot clusters")
            pca = calculate_pca(X)
        if not inertia:
            ca = cluster_alg(X, args.nclusters)
            if len(set(ca.labels_)) == 1:
                log.error("clustering failed. Check input parameter.")
                quit()
            views.plot_clusters(prj, pca, X, y, ca, False)
            if args.D3:
                views.plot_clusters(prj, pca, X, y, ca, args.D3)

    views.show(args.img_only)
github evilsocket / ergo / ergo / actions / explore.py View on Github external
elif args.cluster_alg == 'dbscan':
            cluster_alg = dbscan_clustering
            if not args.nclusters:
                args.nclusters = 2
            log.info("computing dbscan clustering with eps=%f" % args.nclusters)
            if args.nmaxclusters:
                log.warning("nmax specified but not used. Inertia analysis only available for Kmeans.")
        if not args.pca and not inertia:
            log.info("computing pca to plot clusters")
            pca = calculate_pca(X)
        if not inertia:
            ca = cluster_alg(X, args.nclusters)
            if len(set(ca.labels_)) == 1:
                log.error("clustering failed. Check input parameter.")
                quit()
            views.plot_clusters(prj, pca, X, y, ca, False)
            if args.D3:
                views.plot_clusters(prj, pca, X, y, ca, args.D3)

    views.show(args.img_only)