Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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)