Skip to main content

A GridSearchCV like object for clustering in sklearn

Project description

Cluster Optimizer

This is a simple object simulating the GridSearchCV object from scikit-learn (sklearn), but only for clustering. Instead of estimating predictive performance measures using a test fold, it simply calculates unsupervised scores such as the silhouette_score or davies_bouldin_score.

The object is instantiated with an sklearn cluster algorithm, e.g. KMeans, HDBScan, or similar from from sklearn.cluster and a set of parameter options. Different scoring approaches can be supplied as a list of the scoring functions (silhouette_score, davies_bouldin_score, calinski_harabasz_score from sklearn.metrics ).

Using the ClusterOptimizer.optimize() method will perform a grid search through the supplied parameter space. The scores for all supplied scoring functions are stored for all parameters.

The results can be obtained by ClusterOptimizer.results, which should return a pandas DataFrame.

For one or two parameters, the result DataFrame can be used together with seaborn for visualisation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cluster_optimizer-0.0.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

cluster_optimizer-0.0.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file cluster_optimizer-0.0.2.tar.gz.

File metadata

  • Download URL: cluster_optimizer-0.0.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.2

File hashes

Hashes for cluster_optimizer-0.0.2.tar.gz
Algorithm Hash digest
SHA256 20c2473a9c22722c6a8a75fe9e232981c795826d26ef04d4102779f6a76a9733
MD5 6a59b4cbb00ef47c4d3b7fedb4817057
BLAKE2b-256 dd1867a2e20d412b98d3dff55a2628496e5b77d5a69a82f6b56a0be0d5ce8d4f

See more details on using hashes here.

File details

Details for the file cluster_optimizer-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for cluster_optimizer-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 88cef9f8e7fc74a54c0c809fc27a37a05cc659c3f6bc346ef4dd5996bf21ec2c
MD5 d289234da2b46a4c2423a5d0a437fd30
BLAKE2b-256 d8ed9b17675a9b68fe794e704c0a9e7a39c84237b4d0740e188dcb55f181076a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page