Simple automation of unsupervised learning

You should automate this whole discovery process to try different clustering algorithms with different hyperparameter settings. The following code will show you a simple way of doing that:

# You will create a list of algorithms to testfrom sklearn.cluster import MeanShift, estimate_bandwidth, SpectralClusteringfrom hdbscan import HDBSCAN# bandwidth estimate for MeanShift algorithm to work properlybandwidth = estimate_bandwidth(X, quantile=0.3, n_samples=100)estimators = [{'estimator': KMeans, 'args': (), 'kwargs': {'n_clusters': 5}},                         {'estimator': DBSCAN, 'args': (), 'kwargs': {'eps': 0.5}},                         {'estimator': AgglomerativeClustering, 'args': (), 'kwargs': {'n_clusters': 5, 'linkage': 'ward'}},                         {'estimator' ...

Get Hands-On Automated Machine Learning now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.