Skip to content

Evaluation, diagnostics, benchmarks, and additional tests · Evaluation, diagnostics, benchmarks, and additional hypothesis tests · EVA005 · Diagnostic

Hopkins cluster-tendency statistic

Compares nearest-neighbor distances from artificial reference locations with nearest-neighbor distances among observed locations.

Runs in CodeSplash Complete calculation CodeSplash's run and the reference's record

In CodeSplash

A CodeSplash method runs this entry in Python and R. Set it up from the method's page.

Do it in CodeSplash Run it on your own data, in Python or R.

Availability
Runs in CodeSplash
Code example
Complete calculation
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
Verified in Python and R through discover.tendency. The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Compares nearest-neighbor distances from artificial reference locations with nearest-neighbor distances among observed locations.

Question / hypotheses

Does the point pattern depart from a specified spatially random reference? This does not identify a unique clustering.

Architecture / computational structure

A fixed scoring/calibration pipeline applied to model outputs or supplied observations; the formula and usage sections identify its operations.

Assumptions

A sampling region and its volume measure must be defined. Metric, dimension, boundary behavior, and duplicate observations matter. The reference must respect constrained support.

Formula / computational definition

H=∑i=1muid∑i=1muid+∑i=1mwid.H=\frac{\sum_{i=1}^{m}u_i^d}{\sum_{i=1}^{m}u_i^d+\sum_{i=1}^{m}w_i^d}.

Parameters and notation

u_i is distance from a uniform reference point to the data; w_i is leave-self-out nearest-neighbor distance for a sampled data point; d is dimension, m sampling count. Some packages reverse the convention or omit the power.

Fitting, fine-tuning, and adaptation

There is no model fine-tuning step for this evaluation procedure. Freeze the evaluated systems and evaluator before the final test. Select evaluation settings on development data; if a learned evaluator or calibration model is adapted, use separate fitting data, version it, and reassess its validity.

How to use and calibrate

Declare the convention, simulate the null for your actual support, and repeat sampling to quantify Monte Carlo variation. Use distributional checks before fitting clusters.

Example application

Check whether a feature cloud has stronger local aggregation than uniform points in its allowed region.

Interpretation / pitfalls

Watch out

Nonuniform but unimodal densities, edges, irrelevant dimensions, and duplicates may create apparent cluster tendency. A high score under this convention is not proof of meaningful discrete classes.

Python and R code examples

Scope: Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.

Validation: Python — Executed successfully on synthetic inputs. R — reviewed but not executed in this environment. Python dependencies are explicit imports; R uses base R unless a package/bridge is explicitly named.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Complete calculation — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline. · needs numpy

import numpy as np
u=np.array([.8,.9,.7]); w=np.array([.1,.2,.1]); d=2
print(np.sum(u**d)/(np.sum(u**d)+np.sum(w**d)))
R

Complete calculation — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.

u <- c(.8,.9,.7); w <- c(.1,.2,.1); d <- 2
print(sum(u^d)/(sum(u^d)+sum(w^d)))

Sources

From the CodeSplash reference, entry EVA005.