Enum Method

Source
pub enum Method {
    Single,
    Complete,
    Average,
    Weighted,
    Ward,
    Centroid,
    Median,
}
Expand description

A method for computing the dissimilarities between clusters.

The method selected dictates how the dissimilarities are computed whenever a new cluster is formed. In particular, when clusters a and b are merged into a new cluster ab, then the pairwise dissimilarity between ab and every other cluster is computed using one of the methods variants in this type.

Variants§

§

Single

Assigns the minimum dissimilarity between all pairs of observations.

Specifically, if AB is a newly merged cluster and X is every other cluster, then the pairwise dissimilarity between AB and X is computed by

min(d[ab, x] for ab in AB for x in X)

where ab and x correspond to all observations in AB and X, respectively.

§

Complete

Assigns the maximum dissimilarity between all pairs of observations.

Specifically, if AB is a newly merged cluster and X is every other cluster, then the pairwise dissimilarity between AB and X is computed by

max(d[ab, x] for ab in AB for x in X)

where ab and x correspond to all observations in AB and X, respectively.

§

Average

Assigns the average dissimilarity between all pairs of observations.

Specifically, if AB is a newly merged cluster and X is every other cluster, then the pairwise dissimilarity between AB and X is computed by

sum(d[ab, x] for ab in AB for x in X) / (|AB| * |X|)

where ab and x correspond to all observations in AB and X, respectively, and |AB| and |X| correspond to the total number of observations in AB and X, respectively.

§

Weighted

Assigns the weighted dissimilarity between clusters.

Specifically, if AB is a newly merged cluster and X is every other cluster, then the pairwise dissimilarity between AB and X is computed by

0.5 * (d(A, X) + d(B, X))

where A and B correspond to the clusters that merged to create AB.

§

Ward

Assigns the Ward dissimilarity between clusters.

Specifically, if AB is a newly merged cluster and X is every other cluster, then the pairwise dissimilarity between AB and X is computed by

let t1 = d(A, X)^2 * (|A| + |X|);
let t2 = d(B, X)^2 * (|B| + |X|);
let t3 = d(A, B)^2 * |X|;
let T = |A| + |B| + |X|;
sqrt(t1/T + t2/T + t3/T)

where A and B correspond to the clusters that merged to create AB.

§

Centroid

Assigns the centroid dissimilarity between clusters.

Specifically, if AB is a newly merged cluster and X is every other cluster, then the pairwise dissimilarity between AB and X is computed by

let t1 = |A| * d(A, X) + |B| * d(B, X));
let t2 = |A| * |B| * d(A, B);
let size = |A| + |B|;
sqrt(t1/size + t2/size^2)

where A and B correspond to the clusters that merged to create AB.

§

Median

Assigns the median dissimilarity between clusters.

Specifically, if AB is a newly merged cluster and X is every other cluster, then the pairwise dissimilarity between AB and X is computed by

sqrt(d(A, X)/2 + d(B, X)/2 - d(A, B)/4)

where A and B correspond to the clusters that merged to create AB.

Trait Implementations§

Source§

impl Clone for Method

Source§

fn clone(&self) -> Method

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Method

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Method

Source§

fn eq(&self, other: &Method) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Method

Source§

impl Eq for Method

Source§

impl StructuralPartialEq for Method

Auto Trait Implementations§

§

impl Freeze for Method

§

impl RefUnwindSafe for Method

§

impl Send for Method

§

impl Sync for Method

§

impl Unpin for Method

§

impl UnwindSafe for Method

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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 = 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>,

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.