Advanced Clustering Controls
Enter numeric observations, then configure each hierarchical clustering decision.
Formulas Used
Euclidean Distance
d(x,y) = √Σ(xᵢ − yᵢ)²This distance measures direct geometric separation between observations. Larger differences increase the final distance more strongly.
Manhattan Distance
d(x,y) = Σ|xᵢ − yᵢ|This distance adds absolute feature differences. It can reduce sensitivity to isolated large deviations.
Cosine Distance
d(x,y) = 1 − (x · y)/(‖x‖‖y‖)This measure compares vector directions. Similar directions produce distances near zero.
Linkage Rules
Single: min d(a,b) | Complete: max d(a,b) | Average: mean d(a,b)Linkage rules define distances between entire clusters. Different rules can create very different tree shapes.
Ward Merge Distance
D(A,B) = √[2nₐnᵦ/(nₐ+nᵦ)] · ‖μₐ − μᵦ‖₂Ward linkage favors merges adding limited within-cluster variation. This implementation requires Euclidean distance.
Cophenetic Correlation
r = cov(d, c) / (σd σc)The coefficient compares original pairwise distances with tree distances. Higher values indicate stronger distance preservation.
How to Use This Calculator
- Paste one numeric observation on each dataset line.
- Add matching labels, or leave labels blank.
- Select scaling, distance, and linkage settings.
- Choose an orientation and visual display options.
- Enter a threshold, or use automatic selection.
- Press the generate button to calculate the hierarchy.
- Review branches, diagnostics, and final cluster assignments.
- Download the chart or assignment table when needed.
Dendrogram Analysis Guide
Understanding Dendrograms
A dendrogram shows how observations combine during hierarchical clustering. Each leaf represents one record within the dataset. Branch heights show the distance where groups become connected.
Low branches indicate observations sharing strong similarity. Large jumps often suggest boundaries between meaningful clusters. Cutting across those jumps creates practical groups for later analysis.
Comparing Linkage Methods
Single linkage joins clusters using their closest pair. This can reveal chains but may create stretched groups. Complete linkage uses farthest pairs and favors compact clusters.
Average linkage considers cross-cluster pairwise distances. It often provides stable structures across many dataset shapes. Ward linkage minimizes added within-cluster variation after each merge.
Selecting Distance Metrics
Euclidean distance measures straight-line separation between numeric points. Manhattan distance sums absolute differences across included features. Chebyshev distance uses the largest single feature difference.
Cosine distance compares vector direction instead of absolute magnitude. It suits sparse profiles and carefully normalized observations. Metric selection should reflect real meaning of feature differences.
Scaling Numeric Features
Features with broad ranges can dominate calculated distances. Z-score scaling centers and standardizes feature variation. Min-max scaling maps every feature into one common interval.
Scaling changes geometry and therefore changes the resulting hierarchy. Keep raw values when measurement units are already comparable. Compare settings before trusting a final cluster structure.
Applying the Cut Threshold
A threshold cuts dendrogram branches at one selected distance. Lower thresholds produce more tightly grouped clusters. Higher thresholds merge broader groups into fewer final clusters.
The calculator reports assignments beneath your chosen threshold. Review grouped records before accepting every automated decision. Domain knowledge remains essential for judging whether clusters are useful.
Reviewing Diagnostic Statistics
Cophenetic correlation compares original distances with dendrogram distances. Higher values indicate stronger preservation of pairwise relationships. Lower values suggest the hierarchy distorts important dataset geometry.
Maximum merge height summarizes the broadest final separation. Cluster counts reveal sensitivity to the selected cut level. These diagnostics support fair comparisons between several clustering configurations.
Following a Reliable Workflow
Start with clean numeric rows and meaningful labels. Remove duplicated records and investigate missing or extreme values. Then compare linkage methods using consistent preprocessing choices.
Inspect branch heights, assignments, and correlation together. Avoid choosing clusters from visual appearance alone. Validate discovered groups using external outcomes or operational knowledge.
Recognizing Important Limits
Dendrograms always produce hierarchies, even without genuine clusters. Apparent branches can emerge from noise or scaling choices. Small samples may create unstable and misleading splits.
Document preprocessing, metric settings, and threshold decisions clearly. Recheck conclusions whenever new observations become available. Careful validation keeps hierarchical clustering useful and responsibly applied.
Frequently Asked Questions
1. What does a dendrogram show?
It shows the order of hierarchical cluster merges. Leaves represent observations or existing groups. Branch heights represent the distance required for each merge.
2. Which linkage method should I choose?
Average linkage is a balanced exploratory choice. Complete linkage favors compact and separated groups. Single linkage helps detect chains but can join clusters early.
3. When should I use Ward linkage?
Use Ward linkage for compact variance-based clusters. It works only with Euclidean distance here. Scaling is usually important when feature ranges differ.
4. Why does scaling change the dendrogram?
Distance calculations depend directly on feature magnitudes. Large-scale features can dominate every comparison. Scaling gives features more comparable influence during clustering.
5. What is a good cophenetic correlation?
Values closer to one indicate better distance preservation. No universal cutoff fits every dataset. Compare values across reasonable metrics and linkage methods.
6. How is the automatic threshold selected?
The automatic cut equals seventy percent of maximum height. It provides an exploratory starting point only. Adjust it after reviewing visible branch gaps.
7. Can cosine distance use negative values?
Yes, cosine distance can process negative values. Interpretation becomes more complex with opposing vector directions. Review domain meaning before accepting those clusters.
8. Why limit the dataset size?
Agglomerative clustering compares many active cluster pairs. Runtime rises quickly as observation totals increase. The limit protects performance on common shared hosting.
9. Are dendrogram clusters always reliable?
No hierarchy proves that natural clusters exist. Noise and preprocessing can create persuasive branches. Careful validation keeps every final clustering decision evidence based.