Struct kodama::Step [−][src]
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
.
Methods
impl<T> Step<T>
[src]
impl<T> Step<T>
pub fn new(
cluster1: usize,
cluster2: usize,
dissimilarity: T,
size: usize
) -> Step<T>
[src]
pub fn new(
cluster1: usize,
cluster2: usize,
dissimilarity: T,
size: usize
) -> Step<T>
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]
pub fn set_clusters(&mut self, cluster1: usize, cluster2: usize)
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]
impl<T: Float> Step<T>
pub fn eq_with_epsilon(&self, other: &Step<T>, epsilon: T) -> bool
[src]
pub fn eq_with_epsilon(&self, other: &Step<T>, epsilon: T) -> bool
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: Clone> Clone for Step<T>
fn clone(&self) -> Step<T>
[src]
fn clone(&self) -> Step<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: Debug> Debug for Step<T>
[src]
impl<T: Debug> Debug for Step<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: Eq> Eq for Step<T>
[src]
impl<T: Eq> Eq for Step<T>
impl<T: Hash> Hash for Step<T>
[src]
impl<T: Hash> Hash for Step<T>
fn hash<__HT: Hasher>(&self, state: &mut __HT)
[src]
fn hash<__HT: Hasher>(&self, state: &mut __HT)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: PartialEq> PartialEq for Step<T>
[src]
impl<T: PartialEq> PartialEq for Step<T>