Struct hdbscan::HyperParamBuilder

source ·
pub struct HyperParamBuilder { /* private fields */ }
Expand description

Builder object to set custom hyper parameters.

Implementations§

source§

impl HyperParamBuilder

source

pub fn min_cluster_size(self, min_cluster_size: usize) -> HyperParamBuilder

Sets the minimum cluster size - the minimum number of samples for a group of data points to be considered a cluster. If a grouping of data points has fewer members than this, then they will be considered noise. This should be considered the main hyper parameter for changing the results of clustering. Defaults to 5.

§Parameters
  • min_cluster_size - the minimum cluster size
§Returns
  • the hyper parameter configuration builder
source

pub fn max_cluster_size(self, max_cluster_size: usize) -> HyperParamBuilder

Sets the maximum cluster size - the maximum number of samples for a group of data points to be considered a cluster. If a grouping of data points has more members than this. By default, this value is not considered in clustering.

§Parameters
  • max_cluster_size - the maximum cluster size
§Returns
  • the hyper parameter configuration builder
source

pub fn allow_single_cluster( self, allow_single_cluster: bool ) -> HyperParamBuilder

Sets whether to allow one single cluster (i.e. the root or top cluster). Only set this to true if you feel there being one cluster is correct for your dataset. Defaults to false.

§Parameters
  • allow_single_cluster - whether to allow a single cluster
§Returns
  • the hyper parameter configuration builder
source

pub fn min_samples(self, min_samples: usize) -> HyperParamBuilder

Sets min samples. HDBSCAN calculates the core distances between points as a first step in clustering. The core distance is the distance to the Kth neighbour using a nearest neighbours algorithm, where k = min_samples. Defaults to min_cluster_size.

§Parameters
  • min_cluster_size - the number of neighbourhood points considered in distances
§Returns
  • the hyper parameter configuration builder
source

pub fn dist_metric(self, dist_metric: DistanceMetric) -> HyperParamBuilder

Sets the distance metric. HDBSCAN uses this metric to calculate the distance between data points. Defaults to Euclidean. Options are defined by the DistanceMetric enum.

§Parameters
  • dist_metric - the distance metric
§Returns
  • the hyper parameter configuration builder
source

pub fn nn_algorithm(self, nn_algorithm: NnAlgorithm) -> HyperParamBuilder

Sets the nearest neighbour algorithm. Internally, HDBSCAN calculates a density measure called core distances, which is defined as the distance of a data point to it’s kth (min_samples-th) neighbour. The primary reason for changing this parameter is performance. For example, using BruteForce involves computing a distance matrix between all data points. This works fine on small datasets, however scales poorly to larger ones. Defaults to Auto, whereby the nearest neighbour algorithm will be chosen internally based on size and dimensionality of the input data.

§Returns
  • the hyper parameter configuration builder
source

pub fn build(self) -> HdbscanHyperParams

Finishes the building of the hyper parameter configuration. A call to this method is required to exist the builder pattern and complete the construction of the hyper parameters.

§Returns
  • The completed HDBSCAN hyper parameter configuration.

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.