Skip to main content

Compute the Hopkins statistic to assess clustering tendency.

Project description

hopkins-statistic

CI Docs

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hopkins_statistic-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hopkins_statistic-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

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

Hashes for hopkins_statistic-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3bed39d9ad2ac741b84a98d1e24393c9b26e081e6f4bdb892d53cb2c9183adf3
MD5 93446fdc27d9a92c42ea485475b4df5c
BLAKE2b-256 f0f93c69c177aa060a2b9044ed046c541524dc16671139b1aba88cfaa30d7ed0

See more details on using hashes here.

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

Hashes for hopkins_statistic-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 581d8911864f7dd0b66979df32d1113d48f96cde6e677651150dcaad24f81d6e
MD5 cd2c485dc31b88eba9dad2de0b5a9ae7
BLAKE2b-256 34151df41d726b6a0c44dd281ee24d7cd0c2e0656fbd988fd0724041301f9546

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page