https://github.com/petabi/petal-clustering
DBSCAN, HDBSCAN, and OPTICS clustering algorithms.
https://github.com/petabi/petal-clustering
clustering dbscan hdbscan optics
Last synced: 2 months ago
JSON representation
DBSCAN, HDBSCAN, and OPTICS clustering algorithms.
- Host: GitHub
- URL: https://github.com/petabi/petal-clustering
- Owner: petabi
- License: apache-2.0
- Created: 2019-06-06T18:31:20.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-03-05T18:46:22.000Z (3 months ago)
- Last Synced: 2025-03-30T08:11:12.744Z (2 months ago)
- Topics: clustering, dbscan, hdbscan, optics
- Language: Rust
- Homepage:
- Size: 130 KB
- Stars: 32
- Watchers: 2
- Forks: 5
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# petal-clustering
A collection of clustering algorithms. Currently this crate provides DBSCAN,
HDBSCAN and OPTICS.[](https://crates.io/crates/petal-clustering)
[](https://docs.rs/petal-clustering)
[](https://codecov.io/gh/petabi/petal-clustering)## Examples
The following example shows how to cluster points using DBSCAN.
```rust
use ndarray::array;
use petal_clustering::{Dbscan, Fit};let points = array![[1., 2.], [2., 2.], [2., 2.3], [8., 7.], [8., 8.], [25., 80.]];
let clustering = Dbscan::new(3.0, 2).fit(&points);assert_eq!(clustering.0.len(), 2); // two clusters found
assert_eq!(clustering.0[&0], [0, 1, 2]); // the first three points in Cluster 0
assert_eq!(clustering.0[&1], [3, 4]); // [8., 7.] and [8., 8.] in Cluster 1
assert_eq!(clustering.1, [5]); // [25., 80.] doesn't belong to any cluster
```## License
Copyright 2019-2024 Petabi, Inc.
Licensed under [Apache License, Version 2.0][apache-license] (the "License");
you may not use this crate except in compliance with the License.Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See [LICENSE](LICENSE) for
the specific language governing permissions and limitations under the License.## Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the [Apache-2.0
license][apache-license], shall be licensed as above, without any additional
terms or conditions.[apache-license]: http://www.apache.org/licenses/LICENSE-2.0