Compute the Hopkins statistic to assess clustering tendency.
Project description
hopkins-statistic
A Python package for computing the Hopkins statistic to test for departure from complete spatial randomness (CSR), often used to assess clustering tendency.
Installation
pip install hopkins-statistic
Usage
import numpy as np
from hopkins_statistic import hopkins
rng = np.random.default_rng(42)
# Clustered test data
centers = np.array([[0, 0], [0, 1]])
labels = rng.integers(len(centers), size=100)
X = centers[labels] + rng.normal(scale=0.1, size=(100, 2))
# For strongly clustered data, the statistic is often > 0.7
H = hopkins(X, rng=rng)
print(f"{H:.2f}")
#> 0.77
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hopkins_statistic-0.1.0.tar.gz.
File metadata
- Download URL: hopkins_statistic-0.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bed39d9ad2ac741b84a98d1e24393c9b26e081e6f4bdb892d53cb2c9183adf3
|
|
| MD5 |
93446fdc27d9a92c42ea485475b4df5c
|
|
| BLAKE2b-256 |
f0f93c69c177aa060a2b9044ed046c541524dc16671139b1aba88cfaa30d7ed0
|
File details
Details for the file hopkins_statistic-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hopkins_statistic-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
581d8911864f7dd0b66979df32d1113d48f96cde6e677651150dcaad24f81d6e
|
|
| MD5 |
cd2c485dc31b88eba9dad2de0b5a9ae7
|
|
| BLAKE2b-256 |
34151df41d726b6a0c44dd281ee24d7cd0c2e0656fbd988fd0724041301f9546
|