

.. _example_cluster_kmeans_digits.py:


===========================================================
A demo of K-Means clustering on the handwritten digits data
===========================================================

Comparing various initialization strategies in terms of runtime and quality of
the results.

TODO: explode the ouput of the cluster labeling and digits.target groundtruth
as categorical boolean arrays of shape (n_sample, n_unique_labels) and measure
the Pearson correlation as an additional measure of the clustering quality.


**Python source code:** :download:`kmeans_digits.py <kmeans_digits.py>`

.. literalinclude:: kmeans_digits.py
    :lines: 13-
    