scikit-clarans

Getting Started

  • Installation
  • User guide
  • Examples

API Reference

  • API Reference

Example Gallery

  • Cluster Geometries
  • Distance Metrics and Representations
  • Seeding and Validation
  • Inference and Pipelines
  • Robustness and Anomaly Detection
  • Benchmarks and Convergence

Project

  • Project
  • Contributing
  • License
scikit-clarans
  • Example Gallery
  • View page source

Example Gallery

This gallery contains runnable Python examples showcasing the features, clustering capabilities, and scikit-learn integrations of scikit-clarans.

Cluster Geometries

Examples demonstrating clustering behavior across various geometric shapes.

CLARANS Clustering on Interleaving Moons

CLARANS Clustering on Interleaving Moons

CLARANS 2D Clustering on Synthetic Blobs

CLARANS 2D Clustering on Synthetic Blobs

CLARANS on Anisotropically Distributed Clusters

CLARANS on Anisotropically Distributed Clusters

Distance Metrics and Representations

Examples demonstrating non-Euclidean metrics, sparse matrices, precomputed graphs, text sequences, time series, and mixed tabular data.

Clustering Sparse CSR Matrices with CLARANS

Clustering Sparse CSR Matrices with CLARANS

Clustering with Precomputed Distance Matrices

Clustering with Precomputed Distance Matrices

Distance Metrics and Metric Parameters in CLARANS Clustering

Distance Metrics and Metric Parameters in CLARANS Clustering

Graph Clustering with Precomputed Shortest-Path Distances

Graph Clustering with Precomputed Shortest-Path Distances

Custom Callable Distance Metric: Geospatial Haversine Clustering

Custom Callable Distance Metric: Geospatial Haversine Clustering

Clustering on Asymmetric Precomputed Distance Matrices (D != D^T)

Clustering on Asymmetric Precomputed Distance Matrices (D != D^T)

Clustering Incomplete Data with Missing Values (NaN)

Clustering Incomplete Data with Missing Values (NaN)

Clustering Non-Vector Data: Text Sequences with Edit Distance

Clustering Non-Vector Data: Text Sequences with Edit Distance

Clustering Time Series with Dynamic Time Warping (DTW)

Clustering Time Series with Dynamic Time Warping (DTW)

Clustering Mixed-Type Tabular Data with Gower’s Dissimilarity

Clustering Mixed-Type Tabular Data with Gower's Dissimilarity

Seeding and Validation

Examples comparing seeding strategies and evaluating cluster count selection.

User-Provided Initial Candidate Centers for CLARANS

User-Provided Initial Candidate Centers for CLARANS

Comparison of Initial Medoid Seeding Strategies in scikit-clarans

Comparison of Initial Medoid Seeding Strategies in scikit-clarans

Cluster Quality vs. Number of Clusters (Silhouette Analysis)

Cluster Quality vs. Number of Clusters (Silhouette Analysis)

Inference and Pipelines

Examples showing out-of-sample prediction, distance transformations, and scikit-learn pipeline integration.

Feature Transformation via Cluster-Distance Space

Feature Transformation via Cluster-Distance Space

Hyperparameter Tuning with GridSearchCV and Pipelines

Hyperparameter Tuning with GridSearchCV and Pipelines

Predicting Cluster Labels on Unseen Query Data

Predicting Cluster Labels on Unseen Query Data

Fast Precomputed Inference: Compact (n_test, k) vs. Full (n_test, n_train)

Fast Precomputed Inference: Compact (n_test, k) vs. Full (n_test, n_train)

Robustness and Anomaly Detection

Examples demonstrating resistance to extreme outliers and distance-based anomaly scoring.

Outlier Robustness: CLARANS (k-Medoids) vs. K-Means

Outlier Robustness: CLARANS (k-Medoids) vs. K-Means

Unsupervised Anomaly Detection via Medoid Distance Scoring

Unsupervised Anomaly Detection via Medoid Distance Scoring

Benchmarks and Convergence

Empirical benchmarks comparing runtime, swap evaluations, memory footprint, and scaling behavior.

Benchmarking CLARANS vs. FastCLARANS Convergence Speed

Benchmarking CLARANS vs. FastCLARANS Convergence Speed

Runtime Scaling vs. Dataset Size (num_local=2)

Runtime Scaling vs. Dataset Size (num_local=2)

Side-by-Side Comparison: CLARANS, FastCLARANS, and K-Means

Side-by-Side Comparison: CLARANS, FastCLARANS, and K-Means

Parameter Sensitivity: num_local vs. max_neighbors

Parameter Sensitivity: num_local vs. max_neighbors

Monitoring Search Progress and Restart Convergence Trajectories

Monitoring Search Progress and Restart Convergence Trajectories

Comparing Cost Evaluation Strategies: Delta vs. Brute-Force

Comparing Cost Evaluation Strategies: Delta vs. Brute-Force

Download all examples in Python source code: auto_examples_python.zip

Download all examples in Jupyter notebooks: auto_examples_jupyter.zip

Gallery generated by Sphinx-Gallery


© Copyright 2026, Nguyễn Ngọc Thiện.

Built with Sphinx using a theme provided by Read the Docs.