Skip to main content

Hdbscan

pub struct Hdbscan { /* private fields */ }
Expand description

Hierarchical DBSCAN (Campello, Moulavi and Sander). Instead of one density threshold eps it considers all of them at once:

  1. the mutual reachability distance max(core(a), core(b), d(a, b)) (with core the distance to the min_samples-th nearest neighbour) spreads sparse points apart;
  2. a minimum spanning tree of that metric gives the single-linkage hierarchy;
  3. the hierarchy is condensed: a split only counts if both parts have at least min_cluster_size points, smaller pieces are just points falling out of their cluster;
  4. each condensed cluster’s stability Σ (λ_leave - λ_birth) (with λ = 1/distance) measures how long and how densely it persists, and the set of non-overlapping clusters with the greatest total stability is chosen (“excess of mass”).

The result finds clusters of different densities without choosing eps, and labels the rest as noise (None). The implementation uses the dense O(n²) distance matrix.

Implementations§

Source§

impl Hdbscan

Source

pub fn new(min_cluster_size: usize) -> Self

Source

pub fn with_min_samples(self, min_samples: usize) -> Self

Sets min_samples, the neighbour count defining local density (default: min_cluster_size); larger values make the result more conservative about calling points part of clusters.

Source

pub fn cluster_stabilities(&self) -> &[f64]

The stability of each selected cluster, in label order.

Trait Implementations§

Source§

impl Clone for Hdbscan

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Clusterer for Hdbscan

Source§

fn fit_predict(&mut self, x: VR2D<'_>) -> Result<Vec<Option<usize>>, ErrorsJSL>

Source§

impl Debug for Hdbscan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.