.. _example_cluster_plot_mini_batch_kmeans.py:


====================================================================
Comparison of the K-Means and MiniBatchKMeans clustering algorithms
====================================================================

We want to compare the performance of the MiniBatchKMeans and KMeans:
the MiniBatchKMeans is faster, but gives slightly different results (see
:ref:`mini_batch_kmeans`).

We will cluster a set of data, first with KMeans and then with
MiniBatchKMeans, and plot the results.
We will also plot the points that are labelled differently between the two
algorithms.



.. image:: images/plot_mini_batch_kmeans_001.png
    :align: center




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

.. literalinclude:: plot_mini_batch_kmeans.py
    :lines: 15-

**Total running time of the example:**  0.33 seconds
( 0 minutes  0.33 seconds)