--- id: fastcluster version: "1.3.0" license: BSD-2-clause OR GPL-2.0-or-later license_treatment: copyleft maintenance: aging --- # fastcluster — Fast hierarchical clustering routines for R and Python. License: copyleft · Maintenance: aging · Downloads: 116.6K/mo ## What it is and what it does fastcluster is a Python library for hierarchical agglomerative clustering that reimplements scipy.cluster.hierarchy functions (linkage, single, complete, average, weighted, centroid, median, ward) with faster C++ algorithms. It accepts either distance matrices or raw vector data and generates hierarchical clusters represented as dendrograms. The interface mirrors MATLAB's Statistics Toolbox to ease code porting. The package is a stable, mature tool designed as a drop-in replacement for scipy when speed matters. It depends only on numpy and requires Python 3 or later. Recent versions track scipy's distance function definitions—notably the Jaccard and Yule distance changes in version 1.3.0—so version pairing with scipy is recommended to avoid inconsistencies. Use it for: - Cluster datasets faster than scipy.cluster.hierarchy when hierarchical agglomerative methods are needed. - Generate dendrograms from distance matrices or vector data for exploratory data analysis. - Port MATLAB clustering code to Python with minimal API changes. - Memory-efficient clustering of vector data via the linkage_vector function. - Perform bioinformatics clustering where hierarchical methods are standard. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Performs fast hierarchical agglomerative clustering from distance matrices or vector data, replacing scipy.cluster.hierarchy functions with optimized C++ implementations. Yes, if you need hierarchical clustering and scipy's performance is insufficient. The package is stable, has no known vulnerabilities, and offers a straightforward scipy-compatible API. The aging maintenance status is not a concern given the author's stated design philosophy (infrequent updates by design). Verify scipy version compatibility using the documented pairings to avoid distance function mismatches. ## Install pip install fastcluster uv add fastcluster poetry add fastcluster ## Installing fastcluster Before you install: Medium install friction due to compiled C++ components; prebuilt wheels available for Python 3.10–3.13 on macOS, Linux, and Windows. Package marked as aging (465 days since last release), but described as stable with infrequent updates by design rather than abandonment. License in practice: Dual-licensed under BSD-2-clause OR GPL-2.0-or-later (copyleft). Users must comply with one of these licenses; GPL-2.0-or-later imposes source-sharing obligations if distributed. Quickstart: import numpy as np from fastcluster import linkage X = np.random.rand(10, 5) Z = linkage(X, method='ward') Requires numpy; C++ compilation needed if prebuilt wheel unavailable for your platform. Verify before relying: - Actual performance gains over scipy.cluster.hierarchy in typical workloads. - Compatibility with scipy versions outside the documented pairings. - Whether the package maintainer actively monitors bug reports at daniel@danifold.net or GitHub. ## Package facts - License: BSD-2-clause OR GPL-2.0-or-later (copyleft) - Python support: supports_current - Install friction: medium - Maintenance: aging - Downloads: 116.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags hierarchical clustering, agglomerative clustering, linkage clustering, dendrogram generation, fast clustering algorithms, distance matrix clustering, ward clustering, vector data clustering, clustering, hierarchical-methods, performance-optimized [View on SkillFed](https://skillfed.io/packages/fastcluster) · [View on PyPI](https://pypi.org/project/fastcluster/)