Skip to content

Commit c256972

Browse files
author
Arthur
committed
Update readme
1 parent 4f14cd1 commit c256972

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,42 @@ var model = new HdbScan<double[]>(points, euclidean, options, predictionData: tr
6666
var (label, probability) = model.PredictWithProbability(newPoint);
6767
```
6868

69+
### Outlier detection
70+
71+
Each point receives a GLOSH outlier score between 0 and 1. Higher values indicate stronger outliers:
72+
73+
```csharp
74+
for (var i = 0; i < model.OutlierScores.Count; i++)
75+
{
76+
if (model.OutlierScores[i] > 0.9)
77+
Console.WriteLine($"Point {i} is a strong outlier (score {model.OutlierScores[i]:F3})");
78+
}
79+
```
80+
6981
### Options
7082

7183
| Property | Default | Description |
7284
|---|---|---|
7385
| `MinClusterSize` | 5 | Minimum number of points to form a cluster (>= 2) |
74-
| `MinSamples` | 0 (= MinClusterSize) | Number of neighbors for core point definition |
86+
| `MinSamples` | `MinClusterSize` | Number of neighbors for core point definition, including the point itself (>= 2). See [sklearn compatibility](#sklearn-compatibility). |
7587
| `ClusterSelectionMethod` | `ExcessOfMass` | `ExcessOfMass` for stable clusters, `Leaf` for fine-grained clusters |
7688
| `AllowSingleCluster` | `false` | Whether to allow all points in a single cluster |
7789

90+
## sklearn compatibility
91+
92+
This implementation follows the **sklearn.cluster.HDBSCAN** convention where `MinSamples` includes the point itself. Results are validated against scikit-learn's output on multiple datasets.
93+
94+
If you are migrating from the **scikit-learn-contrib/hdbscan** library (which excludes self from the count), add 1 to your `min_samples` value:
95+
96+
```csharp
97+
// scikit-learn-contrib/hdbscan: min_samples=4
98+
// sklearn.cluster.HDBSCAN / HdbScan.Net: MinSamples = 5
99+
var options = new HdbScanOptions { MinSamples = 5 };
100+
```
101+
78102
## Reference
79103

80-
Campello, R.J.G.B., Moulavi, D., Sander, J. (2013). "Density-Based Clustering Based on Hierarchical Density Estimates." PAKDD 2013. Lecture Notes in Computer Science, vol 7819. Springer.
104+
Campello, R.J.G.B., Moulavi, D., Zimek, A., Sander, J. (2015). "Hierarchical Density Estimates for Data Clustering, Visualization, and Outlier Detection." ACM Trans. Knowl. Discov. Data 10, 1, Article 5 (July 2015). https://doi.org/10.1145/2733381
81105

82106
## License
83107

0 commit comments

Comments
 (0)