Module: Clusterer_utils
- Included in:
- Weka::Clusterer::Cobweb, Weka::Clusterer::EM, Weka::Clusterer::FarthestFirst, Weka::Clusterer::HierarchicalClusterer, Weka::Clusterer::SimpleKMeans, Weka::Clusterer::XMeans
- Defined in:
- lib/ruby-band/weka/clusterers/clusterers_utils.rb
Overview
This module is used by the classes from the Clusterer module to inherit the following methods (instance and class methods)
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
Instance methods list.
Instance Method Summary collapse
-
#description ⇒ Object
the description provided by the Weka Documentation.
-
#evaluate(*args) ⇒ Object
Validate clusterer.
-
#get_centroids ⇒ Object
list cluster centroids with coordinates.
- #init_clusterer ⇒ Object
- #init_instance_clusterer(&block) ⇒ Object
-
#list_capabilities ⇒ Object
list cluster’s capabilities with attributes (i.e Numeric, Nominal…).
- #list_options ⇒ Object
-
#set_data(data) ⇒ Object
set instance data for the clusterer.
-
#set_options(options) ⇒ Object
set options for the clusterer.
Class Method Details
.included(base) ⇒ Object
Instance methods list
19 20 21 |
# File 'lib/ruby-band/weka/clusterers/clusterers_utils.rb', line 19 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#description ⇒ Object
the description provided by the Weka Documentation
39 40 41 |
# File 'lib/ruby-band/weka/clusterers/clusterers_utils.rb', line 39 def description globalInfo end |
#evaluate(*args) ⇒ Object
Validate clusterer. If the evaluation needs to be performed on a different dataset this function accepts an optional parameter (an Instances class object)
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/ruby-band/weka/clusterers/clusterers_utils.rb', line 55 def evaluate(*args) eval = ClusterEvaluation.new eval.setClusterer(self) if not args[0] if self.class.data eval.evaluateClusterer(self.class.data) else eval.evaluateClusterer(@dataset) end else eval.evaluateClusterer(args[0]) end puts 'performing evaluation' eval.clusterResultsToString end |
#get_centroids ⇒ Object
list cluster centroids with coordinates
44 45 46 |
# File 'lib/ruby-band/weka/clusterers/clusterers_utils.rb', line 44 def get_centroids getClusterCentroids end |
#init_clusterer ⇒ Object
7 8 9 10 |
# File 'lib/ruby-band/weka/clusterers/clusterers_utils.rb', line 7 def init_clusterer (self.class.) if self.class. buildClusterer(self.class.data) end |
#init_instance_clusterer(&block) ⇒ Object
12 13 14 15 16 |
# File 'lib/ruby-band/weka/clusterers/clusterers_utils.rb', line 12 def init_instance_clusterer(&block) self.instance_eval(&block) #@dataset.setClassIndex(@class_index) buildClusterer(@dataset) end |
#list_capabilities ⇒ Object
list cluster’s capabilities with attributes (i.e Numeric, Nominal…)
49 50 51 |
# File 'lib/ruby-band/weka/clusterers/clusterers_utils.rb', line 49 def list_capabilities get_capabilities.to_s end |
#list_options ⇒ Object
34 35 36 |
# File 'lib/ruby-band/weka/clusterers/clusterers_utils.rb', line 34 def listOptions.map {|key| "#{key.synopsis} #{key.description}"}.join("\n") end |
#set_data(data) ⇒ Object
set instance data for the clusterer
24 25 26 |
# File 'lib/ruby-band/weka/clusterers/clusterers_utils.rb', line 24 def set_data(data) @dataset = data end |
#set_options(options) ⇒ Object
set options for the clusterer
29 30 31 32 |
# File 'lib/ruby-band/weka/clusterers/clusterers_utils.rb', line 29 def () = Utils.splitOptions() setOptions() end |