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
impl Dbscan
Sourcepub fn handle_mut(&mut self) -> &mut Handle
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.
Sourcepub fn fit(
&mut self,
n_samples: usize,
n_features: usize,
data: &[f64],
) -> Result<()>
pub fn fit( &mut self, n_samples: usize, n_features: usize, data: &[f64], ) -> Result<()>
Fit on column-major n_samples × n_features data matrix.
Sourcepub fn n_clusters(&self) -> Result<usize>
pub fn n_clusters(&self) -> Result<usize>
Number of clusters discovered (excludes noise).
Sourcepub fn n_core_samples(&self) -> Result<usize>
pub fn n_core_samples(&self) -> Result<usize>
Number of core samples (points that have at least min_samples
neighbours within distance eps).
Sourcepub fn labels(&self) -> Result<Vec<i32>>
pub fn labels(&self) -> Result<Vec<i32>>
Labels assigned to each input sample. -1 indicates noise; other
values index a cluster 0 .. n_clusters().
Sourcepub fn core_sample_indices(&self) -> Result<Vec<i32>>
pub fn core_sample_indices(&self) -> Result<Vec<i32>>
Indices of the core samples (length = n_core_samples()).