Clustering, density estimation, and anomaly detection · Density and exemplar clustering · UCL022 · Algorithm
OPTICS
Produce an ordering that exposes density-based clustering structure over multiple neighborhood radii. The reachability plot can reveal nested or varying-density group candidates without committing immediately to one…
In CodeSplash
A CodeSplash method runs this entry in Python and R. Set it up from the method's page.
- OPTICS Verified in Python and R
Do it in CodeSplash Run it on your own data, in Python or R.
- Availability
- Runs in CodeSplash
- Code example
- Component demo, not a trained model
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- Verified in Python and R through discover.optics. 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
Produce an ordering that exposes density-based clustering structure over multiple neighborhood radii. The reachability plot can reveal nested or varying-density group candidates without committing immediately to one DBSCAN radius.
Question / hypotheses
Which dense groups, modes, or exemplars persist under a defensible similarity scale? This entry defines an estimation or optimization objective, not an intrinsic null/alternative hypothesis test.
Architecture / computational structure
A priority-driven reachability ordering plus a separate cluster-extraction procedure.
Assumptions
An ordering is not itself a unique partition. Varying density is handled more flexibly than a single-radius method, but graph geometry and parameter choices still matter.
Formula / computational definition
Core distance is the distance required for to have the specified neighbor count. Reachability of from a core point is . The ordering expands candidates with smallest current reachability.
Parameters and notation
Learned or fitted quantities: Ordering, core/reachability distances, and extracted labels. User-set hyperparameters/design choices: Choose minimum samples, maximum search radius, metric, and a separate extraction rule such as a DBSCAN cut or steepness. Tune these against the stated objective and stability/validation criteria; do not select settings on the final evaluation set.
Fitting, fine-tuning, and adaptation
Neural fine-tuning is not applicable. Refit or rebuild neighborhoods when the reference distribution changes. Recalibrate neighborhood and extraction settings using stable density structure; verify whether the implementation supports genuine new-point assignment before deployment.
How to use and calibrate
Inspect the full reachability plot, extracted labels, noise coverage, and stability across extraction parameters. Compare equivalent extraction rules, not merely algorithm names.
Example application
Explore several density scales in geospatial observations. Define the reference population, measurement units, and success criterion before fitting; investigate whether discovered groups or alerts reflect the intended phenomenon.
Interpretation / pitfalls
Watch out
The reported result is conditional on the representation and objective. A stable partition can reflect nuisance structure such as batch, collection site, or missingness. Confirm the interpretation in original variables and an independent sample.
Python and R code examples
Python has sklearn.cluster.OPTICS; R has dbscan::optics and extraction helpers. Keep ordering indices aligned with original rows when graphing or joining labels back to a dataset.
Component: OPTICS reachability from a supplied core point. Python: executed successfully; R: not executed (Rscript unavailable). These small fixtures establish the arithmetic operation, not full-method accuracy or reproduction of paper results.
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.
Component demo, not a trained model — OPTICS reachability from a supplied core point. · needs numpy
import numpy as np
dist=np.array([.1,.3,1.2]); core_distance=.25
result=np.maximum(core_distance,dist)
print(result)
Component demo, not a trained model — OPTICS reachability from a supplied core point.
dist=c(.1,.3,1.2); core_distance=.25; result=pmax(core_distance,dist)
print(result)
Sources
- Source 1scikit-learn.org
- Source 2cran.r-project.org
From the CodeSplash reference, entry UCL022.