Class: KMeans
- Inherits:
-
Object
- Object
- KMeans
- Defined in:
- lib/k_means.rb
Instance Method Summary collapse
- #clustify(data) ⇒ Object
-
#initialize(k = 4, options = {}) ⇒ KMeans
constructor
A new instance of KMeans.
Constructor Details
#initialize(k = 4, options = {}) ⇒ KMeans
8 9 10 11 12 |
# File 'lib/k_means.rb', line 8 def initialize(k=4, ={}) @k = k @verbose = [:verbose] == true ? true : nil @last_matches = nil end |
Instance Method Details
#clustify(data) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/k_means.rb', line 14 def clustify(data) @data = data place_centroids perform_cluster_process @best_matches end |