Class: Ai4r::Clusterers::WeightedAverageLinkage
- Inherits:
-
SingleLinkage
- Object
- Clusterer
- SingleLinkage
- Ai4r::Clusterers::WeightedAverageLinkage
- Includes:
- ClusterTree
- Defined in:
- lib/ai4r/clusterers/weighted_average_linkage.rb
Overview
Implementation of an Agglomerative Hierarchical clusterer with weighted average linkage algorithm, aka weighted pair group method average or WPGMA (Jain and Dubes, 1988 ; McQuitty, 1966 ) Hierarchical clusterer create one cluster per element, and then progressively merge clusters, until the required number of clusters is reached. Similar to AverageLinkage, but the distances between clusters are weighted based on the number of data items in each of them.
D(cx, (ci U cj)) = ( ni * D(cx, ci) + nj * D(cx, cj)) / (ni + nj)
Instance Attribute Summary
Attributes included from ClusterTree
Attributes inherited from SingleLinkage
#clusters, #data_set, #number_of_clusters
Instance Method Summary collapse
-
#build(data_set, number_of_clusters = 1, **options) ⇒ 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.
- #supports_eval? ⇒ Object
Methods included from ClusterTree
Methods inherited from SingleLinkage
#draw_map, #initialize, #silhouette
Methods included from Data::Parameterizable
#get_parameters, included, #set_parameters
Instance Method Details
#build(data_set, number_of_clusters = 1, **options) ⇒ Object
Build a new clusterer, using data examples found in data_set. Items will be clustered in “number_of_clusters” different clusters.
44 45 46 |
# File 'lib/ai4r/clusterers/weighted_average_linkage.rb', line 44 def build(data_set, number_of_clusters = 1, **) 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.
52 53 54 |
# File 'lib/ai4r/clusterers/weighted_average_linkage.rb', line 52 def eval(_data_item) raise NotImplementedError, 'Eval of new data is not supported by this algorithm.' end |
#supports_eval? ⇒ Object
57 58 59 |
# File 'lib/ai4r/clusterers/weighted_average_linkage.rb', line 57 def supports_eval? false end |