14 releases (9 breaking)

0.10.0 Nov 2, 2024
0.8.0 Feb 21, 2024
0.7.0 Dec 21, 2023
0.6.0 Aug 7, 2023
0.1.0 Feb 18, 2020

#35 in Machine learning

Download history 390/week @ 2024-07-28 349/week @ 2024-08-04 422/week @ 2024-08-11 425/week @ 2024-08-18 686/week @ 2024-08-25 686/week @ 2024-09-01 699/week @ 2024-09-08 451/week @ 2024-09-15 969/week @ 2024-09-22 841/week @ 2024-09-29 886/week @ 2024-10-06 614/week @ 2024-10-13 640/week @ 2024-10-20 610/week @ 2024-10-27 999/week @ 2024-11-03 544/week @ 2024-11-10

2,812 downloads per month
Used in 3 crates

Apache-2.0

58KB
1.5K SLoC

petal-clustering

A collection of clustering algorithms. Currently this crate provides DBSCAN, HDBSCAN and OPTICS.

crates.io Documentation Coverage Status

Examples

The following example shows how to cluster points using DBSCAN.

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 (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 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, shall be licensed as above, without any additional terms or conditions.

Dependencies

~4MB
~85K SLoC