[][src]Struct kodama::Step

pub struct Step<T> {
    pub cluster1: usize,
    pub cluster2: usize,
    pub dissimilarity: T,
    pub size: usize,
}

A single merge step in a dendrogram.

A step always corresponds to a merge between two clusters, where each cluster has at least one observation. Each step itself corresponds to a new cluster containing the observations of the merged clusters.

By convention, the smaller label is assigned to cluster1.

The type parameter T refers to the type of dissimilarity used. In practice, T is a floating point type.

Fields

cluster1: usize

The label corresponding to the first cluster.

The algorithm for labeling clusters is documented on Dendrogram.

cluster2: usize

The label corresponding to the second cluster.

The algorithm for labeling clusters is documented on Dendrogram.

dissimilarity: T

The dissimilarity between cluster1 and cluster2.

If both cluster1 and cluster2 correspond to singleton clusters, then this dissimilarity is equivalent to the pairwise dissimilarity between the clusters' corresponding observations. Otherwise, the dissimilarity is computed according to the clustering Method used.

size: usize

The total number of observations in this merged cluster. This is always equivalent to the total number of observations in cluster1 plus the total number of observations in cluster2.

Implementations

impl<T> Step<T>[src]

pub fn new(
    cluster1: usize,
    cluster2: usize,
    dissimilarity: T,
    size: usize
) -> Step<T>
[src]

Create a new a step that can be added to a dendrogram.

Note that the clustering labels given are normalized such that the smallest label is always assigned to cluster1.

pub fn set_clusters(&mut self, cluster1: usize, cluster2: usize)[src]

Set the cluster labels on this step.

Note that the clustering labels given are normalized such that the smallest label is always assigned to cluster1.

impl<T: Float> Step<T>[src]

pub fn eq_with_epsilon(&self, other: &Step<T>, epsilon: T) -> bool[src]

Compare two steps for approximate equality.

Approximate equality in this case refers to the dissimilarity in each step. In particular, two dissimilarity are considered equal if and only if the absolute value of their difference is less than or equal to the given epsilon value.

Trait Implementations

impl<T: Clone> Clone for Step<T>[src]

impl<T: Debug> Debug for Step<T>[src]

impl<T: Eq> Eq for Step<T>[src]

impl<T: Hash> Hash for Step<T>[src]

impl<T: PartialEq> PartialEq<Step<T>> for Step<T>[src]

impl<T> StructuralEq for Step<T>[src]

impl<T> StructuralPartialEq for Step<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Step<T> where
    T: RefUnwindSafe

impl<T> Send for Step<T> where
    T: Send

impl<T> Sync for Step<T> where
    T: Sync

impl<T> Unpin for Step<T> where
    T: Unpin

impl<T> UnwindSafe for Step<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.