Class: Ai4r::Clusterers::Clusterer
- Inherits:
-
Object
- Object
- Ai4r::Clusterers::Clusterer
- Includes:
- Data::Parameterizable
- Defined in:
- lib/ai4r/clusterers/clusterer.rb
Overview
The purpose of this class is to define a common API for Clusterers. All methods in this class (other than eval) must be implemented in subclasses.
Direct Known Subclasses
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
Classifies the given data item, returning the cluster it belongs to.
-
#supports_eval? ⇒ Object
Returns
trueif this clusterer supports evaluating new data items with #eval.
Methods included from Data::Parameterizable
#get_parameters, included, #set_parameters
Instance Method Details
#build(data_set, number_of_clusters) ⇒ Object
Build a new clusterer, using data examples found in data_set. Data items will be clustered in “number_of_clusters” different clusters.
28 29 30 |
# File 'lib/ai4r/clusterers/clusterer.rb', line 28 def build(data_set, number_of_clusters) raise NotImplementedError end |
#eval(data_item) ⇒ Object
Classifies the given data item, returning the cluster it belongs to.
35 36 37 |
# File 'lib/ai4r/clusterers/clusterer.rb', line 35 def eval(data_item) raise NotImplementedError end |
#supports_eval? ⇒ Object
Returns true if this clusterer supports evaluating new data items with #eval. Hierarchical algorithms that only build a dendrogram will override this method to return false.
43 44 45 |
# File 'lib/ai4r/clusterers/clusterer.rb', line 43 def supports_eval? true end |