Struct petal_clustering::Dbscan[][src]

pub struct Dbscan<A, M> {
    pub eps: A,
    pub min_samples: usize,
    pub metric: M,
}
Expand description

DBSCAN (density-based spatial clustering of applications with noise) clustering algorithm.

Examples

use ndarray::array;
use petal_neighbors::distance::Euclidean;
use petal_clustering::{Dbscan, Fit};

let points = array![[1.0, 2.0], [2.0, 2.0], [2.0, 2.3], [8.0, 7.0], [8.0, 8.0], [25.0, 80.0]];
let clustering = Dbscan::new(3.0, 2, Euclidean::default()).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.0, 7.0] and [8.0, 8.0] in Cluster 1
assert_eq!(clustering.1, [5]);            // [25.0, 80.0] doesn't belong to any cluster

Fields

eps: A

The radius of a neighborhood.

min_samples: usize

The minimum number of points required to form a dense region.

metric: M

Implementations

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.