Class: KMeans
Instance Attribute Summary collapse
-
#centroids ⇒ Object
readonly
Returns the value of attribute centroids.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Instance Method Summary collapse
-
#initialize(data, options = {}) ⇒ KMeans
constructor
A new instance of KMeans.
- #inspect ⇒ Object
- #view ⇒ Object
Constructor Details
#initialize(data, options = {}) ⇒ KMeans
Returns a new instance of KMeans.
11 12 13 14 15 16 17 18 19 |
# File 'lib/k_means.rb', line 11 def initialize(data, ={}) k = [:centroids] || 4 @verbose = [:verbose] == true ? true : nil @nodes = Node.create_nodes(data) @centroids = Centroid.create_centroids(k, @nodes) perform_cluster_process end |