Struct petal_clustering::Optics
source · pub struct Optics<A, M> {
pub eps: A,
pub min_samples: usize,
pub metric: M,
/* private fields */
}
Expand description
OPTICS (ordering points to identify the clustering structure) clustering algorithm.
§Examples
use ndarray::array;
use petal_neighbors::distance::Euclidean;
use petal_clustering::{Optics, Fit};
let points = array![[1., 2.], [2., 5.], [3., 6.], [8., 7.], [8., 8.], [7., 3.]];
let clustering = Optics::new(4.5, 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, 5]); // the rest in Cluster 1
Fields§
§eps: A
The radius of a neighborhood.
min_samples: usize
The minimum number of points required to form a dense region.
metric: M
The metric to compute distance between the entries.
Implementations§
Trait Implementations§
source§impl<'de, A, M> Deserialize<'de> for Optics<A, M>where
A: Deserialize<'de>,
M: Deserialize<'de>,
impl<'de, A, M> Deserialize<'de> for Optics<A, M>where
A: Deserialize<'de>,
M: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<A, M> RefUnwindSafe for Optics<A, M>where
A: RefUnwindSafe,
M: RefUnwindSafe,
impl<A, M> Send for Optics<A, M>
impl<A, M> Sync for Optics<A, M>
impl<A, M> Unpin for Optics<A, M>
impl<A, M> UnwindSafe for Optics<A, M>where
A: UnwindSafe,
M: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more