Struct kodama::Step

source ·
pub struct Step<T> {
    pub cluster1: usize,
    pub cluster2: usize,
    pub dissimilarity: T,
    pub size: usize,
}
Expand description

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§

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.

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.

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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.