Examples
========

This page contains runnable examples demonstrating different ways to use
`scikit-clarans` and integrations with popular Python tooling.

Quickstart
----------

A minimal quickstart example:

.. literalinclude:: ../../examples/01_quick_start.py
   :language: python

Compare initializations
-----------------------

Use this script to compare initialization strategies and runtimes:

.. literalinclude:: ../../examples/02_compare_initializations.py
   :language: python

Different distance metrics
--------------------------

See how different metrics affect the clustering result:

.. literalinclude:: ../../examples/03_metrics_demo.py
   :language: python

Using sparse inputs
-------------------

.. literalinclude:: ../../examples/04_sparse_input.py
   :language: python

Grid-search and pipelines
-------------------------

.. literalinclude:: ../../examples/05_pipeline_gridsearch.py
   :language: python

Additional Resources
--------------------

Additional examples are available in the `examples directory <https://github.com/ThienNguyen3001/scikit-clarans/tree/main/examples>`_.

The examples directory also includes an interactive Jupyter notebook with many
examples:

.. image:: https://colab.research.google.com/assets/colab-badge.svg
   :target: https://colab.research.google.com/drive/1JdgVaZcbS1uwY7kPQZM8DtX97R9ga31d?usp=sharing
   :alt: Open In Colab