Clustering, density estimation, and anomaly detection · Hierarchical clustering · UCL020 · Algorithm
CHAMELEON
Cluster a nearest-neighbor graph using both interconnectivity and closeness relative to each candidate cluster's internal structure. It targets groups whose size, density, or shape differs.
In CodeSplash
Documented in the Academy only. There's no Set up button.
- Availability
- Explained here
- Code example
- Component demo, not a trained model
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- 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
Cluster a nearest-neighbor graph using both interconnectivity and closeness relative to each candidate cluster's internal structure. It targets groups whose size, density, or shape differs.
Question / hypotheses
Which nested divisions or merges summarize the specified dissimilarity structure? This entry defines an estimation or optimization objective, not an intrinsic null/alternative hypothesis test.
Architecture / computational structure
Graph partitioning creates microclusters; relative interconnectivity and closeness guide subsequent merges.
Assumptions
Results depend strongly on graph construction and the initial partitioner. Internal graph cuts must be computed consistently; replacing them with arbitrary averages is a simplified heuristic, not the original algorithm.
Formula / computational definition
A merge score combines relative interconnectivity and relative closeness , often as . Each ratio compares cross-cluster graph connectivity or edge strength with an internal baseline derived from the clusters; controls the emphasis on closeness. Initial graph partitioning creates subclusters before agglomeration.
Parameters and notation
Learned or fitted quantities: Initial subclusters, merge hierarchy, and final partition. User-set hyperparameters/design choices: Set neighbor count, edge similarity, initial partition granularity, and merge threshold or target . 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. A changed distance or linkage generally requires rebuilding the hierarchy. A cut can be changed without rebuilding the tree; assigning new cases to a fixed tree needs a separately stated rule and is not identical to refitting.
How to use and calibrate
Inspect cross-edge structure, stability to neighbor count, and recovery of varying-density shapes. Compare preprocessing and graph-build cost as well as merge time.
Example application
Cluster a variable-density neighborhood graph with local structural normalization. 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
Treat this as a custom implementation in both languages, using sparse graph operations and a partitioning library. The paired mathematical example evaluates a supplied merge score and does not claim a complete CHAMELEON fit.
Component: CHAMELEON supplied relative merge scores. 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 — CHAMELEON supplied relative merge scores. · needs numpy
import numpy as np
RI=np.array([.8,.5]); RC=np.array([.4,.9]); beta=2.
result=RI*RC**beta
print(result)
Component demo, not a trained model — CHAMELEON supplied relative merge scores.
RI=c(.8,.5); RC=c(.4,.9); beta=2
result=RI*RC^beta
print(result)
Sources
- Source 1www2.cs.uh.edu
From the CodeSplash reference, entry UCL020.