Class: Ai4r::Clusterers::MedianLinkage
- Inherits:
-
SingleLinkage
- Object
- Clusterer
- SingleLinkage
- Ai4r::Clusterers::MedianLinkage
- Defined in:
- lib/ai4r/clusterers/median_linkage.rb
Overview
Implementation of an Agglomerative Hierarchical clusterer with median linkage algorithm, aka weighted pair group method centroid or WPGMC (Everitt et al., 2001 ; Gower, 1967 ; Jain and Dubes, 1988 ). Hierarchical clusterer create one cluster per element, and then progressively merge clusters, until the required number of clusters is reached. Similar to centroid linkages, but using fix weight:
D(cx, (ci U cj)) = (1/2)*D(cx, ci) +
(1/2)*D(cx, cj) -
(1/4)*D(ci, cj)
Instance Attribute Summary
Attributes inherited from SingleLinkage
#clusters, #data_set, #number_of_clusters
Instance Method Summary collapse
-
#build(data_set, number_of_clusters) ⇒ Object
Build a new clusterer, using data examples found in data_set.
-
#eval(data_item) ⇒ Object
This algorithms does not allow classification of new data items once it has been built.
Methods inherited from SingleLinkage
Methods included from Data::Parameterizable
#get_parameters, included, #set_parameters
Constructor Details
This class inherits a constructor from Ai4r::Clusterers::SingleLinkage
Instance Method Details
#build(data_set, number_of_clusters) ⇒ Object
Build a new clusterer, using data examples found in data_set. Items will be clustered in “number_of_clusters” different clusters.
38 39 40 |
# File 'lib/ai4r/clusterers/median_linkage.rb', line 38 def build(data_set, number_of_clusters) super end |
#eval(data_item) ⇒ Object
This algorithms does not allow classification of new data items once it has been built. Rebuild the cluster including you data element.
44 45 46 |
# File 'lib/ai4r/clusterers/median_linkage.rb', line 44 def eval(data_item) Raise "Eval of new data is not supported by this algorithm." end |