Class: KMeans

Inherits:
Object
  • Object
show all
Defined in:
lib/k_means.rb

Instance Method Summary collapse

Constructor Details

#initialize(k = 4, options = {}) ⇒ KMeans



8
9
10
11
12
# File 'lib/k_means.rb', line 8

def initialize(k=4, options={})
  @k = k
  @verbose = options[: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