Files

Ai4r::Clusterers::AverageLinkage

Implementation of a Hierarchical clusterer with group average linkage, AKA unweighted pair group method average or UPGMA (Everitt et al., 2001 ; Jain and Dubes, 1988 ; Sokal and Michener, 1958). Hierarchical clusteres create one cluster per element, and then progressively merge clusters, until the required number of clusters is reached. With average linkage, the distance between a clusters cx and cluster (ci U cj) the the average distance between cx and ci, and cx and cj.

D(cx, (ci U cj) = (D(cx, ci) + D(cx, cj)) / 2

Public Instance Methods

build(data_set, number_of_clusters) click to toggle source

Build a new clusterer, using data examples found in data_set. Items will be clustered in "number_of_clusters" different clusters.

# File lib/ai4r/clusterers/average_linkage.rb, line 38
def build(data_set, number_of_clusters)
  super
end
eval(data_item) click to toggle source

This algorithms does not allow classification of new data items once it has been built. Rebuild the cluster including you data element.

# File lib/ai4r/clusterers/average_linkage.rb, line 44
def eval(data_item)
  Raise "Eval of new data is not supported by this algorithm."
end

Protected Instance Methods

linkage_distance(cx, ci, cj) click to toggle source

return distance between cluster cx and cluster (ci U cj), using average linkage

# File lib/ai4r/clusterers/average_linkage.rb, line 52
def linkage_distance(cx, ci, cj)
  (read_distance_matrix(cx, ci)+
    read_distance_matrix(cx, cj))/2
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.