A helper package for analyzing and visualizing spatial clusters, designed to facilitate reproducibility and ease of use in academic and applied research contexts. Developed in support of Anselin (2024).
- Cluster Statistics: Generate labels/cardinality summaries (
cluster_stats
) - Fit Metrics: TSS, WSS, BSS, and cluster quality ratios (
cluster_fit
) - Stress Evaluation: Raw/normalized stress values (
stress_value
) - Optimal Clusters: Elbow plot visualization for K-means (
elbow_plot
) - Silhouette Analysis: Observation-level silhouette scores (
plot_silhouette
)
- Validation Indices:
- Fragmentation (entropy/Simpson) (
cluster_fragmentation
) - Spatial autocorrelation (Join Count Ratios) (
cluster_joincount
) - Compactness & diameter metrics (
cluster_compactness
,cluster_diameter
)
- Fragmentation (entropy/Simpson) (
- Neighborhood Overlap: KNN coverage comparison (
common_coverage
)
- Cluster Maps: Geographic cluster visualization (
cluster_map
) - Dendrograms: Hierarchical clustering trees (
plot_dendrogram
) - Scatter Plots: 2D cluster visualization (
plot_scatter
)
- Cluster Centers: Mean/median descriptors (
cluster_center
) - Data Management: Automated example datasets handling (
ensure_datasets
)
You can install the package from pypi:
pip install spatial-cluster-helper
You can check several usage examples in the lab materials developed for the Spatial Cluster Analysis course taught at the University of Chicago in the Winter of 2025 here.
This project is licensed under the MIT License.
Developed at The Center for Spatial Data Science at the University of Chicago by Luc Anselin and Pedro Amaral