struct HClust::Dendrogram::Step

Overview

A single merge step in a dendrogram.

A step corresponds to a merge between two distinct clusters. By convention, the indexes of the merged clusters (#nodes) are always sorted.

Defined in:

hclust/dendrogram.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(c_i : Int32, c_j : Int32, distance : Float64) #

Creates a new Step between the clusters c_i and c_j with the given distance.

NOTE Cluster indexes are stored sorted.


[View source]

Instance Method Detail

def ==(rhs : self) : Bool #

Returns true if the step are equal, else false.

NOTE Distances are compared within numeric precision (epsilon = 1e-15).


[View source]
def clusters : Tuple(Int32, Int32) #

Indexes of the merged clusters. An index can range from 0 to N + N - 1, where N is the number of original elements or observations and an index equals to or greater than N indicates a newly created cluster (refer to the Dendrogram documentation).


[View source]
def distance : Float64 #

Distance between the merged clusters. This is computed according to the selected linkage rule (see Rule) used for the clustering. If both merge clusters have a single element (singleton), the distance is equal to the pairwise distance between the elements.


[View source]
def sqrt : self #

Returns a Step with the square root of the distance.


[View source]