Skip to main content

Dbscan

Struct Dbscan 

Source
pub struct Dbscan { /* private fields */ }
Expand description

DBSCAN density-based clustering. Unlike k-means it does not require the number of clusters in advance and can mark points as noise (label -1).

Configure with options like "eps" and "min_samples" via Dbscan::handle_mut before Dbscan::fit; defaults follow scikit-learn’s conventions.

Implementations§

Source§

impl Dbscan

Source

pub fn new() -> Result<Self>

Build a new DBSCAN handle in f64 precision.

Source

pub fn handle_mut(&mut self) -> &mut Handle

Borrow the underlying handle to set DBSCAN-specific options: e.g. set_string_option("metric", "euclidean"), set_int_option("min samples", 5), or for the real-valued eps use da_options_set_real_d directly via Handle::as_raw.

Source

pub fn fit( &mut self, n_samples: usize, n_features: usize, data: &[f64], ) -> Result<()>

Fit on column-major n_samples × n_features data matrix.

Source

pub fn n_clusters(&self) -> Result<usize>

Number of clusters discovered (excludes noise).

Source

pub fn n_core_samples(&self) -> Result<usize>

Number of core samples (points that have at least min_samples neighbours within distance eps).

Source

pub fn labels(&self) -> Result<Vec<i32>>

Labels assigned to each input sample. -1 indicates noise; other values index a cluster 0 .. n_clusters().

Source

pub fn core_sample_indices(&self) -> Result<Vec<i32>>

Indices of the core samples (length = n_core_samples()).

Trait Implementations§

Source§

impl Debug for Dbscan

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> 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, 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.