Skip to main content

hopkins-statistic

CI Coverage PyPI - Version PyPI - Python Version Docs DOI

hopkins-statistic is a library for computing the Hopkins statistic to assess clustering tendency (also known as clusterability) by testing for departure from complete spatial randomness (CSR) in point patterns.

This implementation defaults to the Cross and Jain (1982) formulation, raising distances to the power of the data dimension. In two dimensions, this matches the original definition by Hopkins and Skellam (1954). Because the resulting statistic follows a beta distribution under the null hypothesis, p-values can be computed analytically, avoiding the need for Monte Carlo simulations.

Installation

pip install hopkins-statistic

Usage

import numpy as np
from hopkins_statistic import hopkins

rng = np.random.default_rng(42)
X = rng.uniform(size=(100, 2))

statistic = hopkins(X, rng=rng)
print(f"{statistic:.3f}")
#> 0.514

License

This project is licensed under the terms of the MIT license.

Metadata

Release files for hopkins-statistic 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hopkins-statistic 0.7.0
File Size Uploaded
hopkins_statistic-0.7.0.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hopkins-statistic 0.7.0
File Interpreter ABI Platform
hopkins_statistic-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.4 kB

Release files / hopkins_statistic-0.7.0.tar.gz

Download URL hopkins_statistic-0.7.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5d48cba2ea44074d5a3d53ecc310498fcb6834d54bcdd94e76e879b11527f5a4
BLAKE2b-256 checksum
How to use checksums
ee9ec5687a987a8ad594fd0c80ba539e4de493bd7b70d1a0f3bad787aefd70ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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}

Release files / hopkins_statistic-0.7.0-py3-none-any.whl

Download URL hopkins_statistic-0.7.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3381aeb3b2e4c4c128d8aea2c1c6c1e7d4332d1ae3d077ba20194e332eda4775
BLAKE2b-256 checksum
How to use checksums
528f31c33da866d48f721e5255917fdb2b45c829f9f4ecb487eb1cea278c94c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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}

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page