Class: KMeansPP::Point

Inherits:
BasePoint show all
Defined in:
lib/k_means_pp/point.rb

Overview

Point of the data set.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x = 0.0, y = 0.0, group = nil) ⇒ Point

Create a new point (data set point or a centroid).

Parameters:

  • x (Float) (defaults to: 0.0)

    X coordinate of the point.

  • y (Float) (defaults to: 0.0)

    Y coordinate of the point.

  • group (Centroid) (defaults to: nil)

    Group is a centroid point.



49
50
51
52
53
# File 'lib/k_means_pp/point.rb', line 49

def initialize(x = 0.0, y = 0.0, group = nil)
  self.x     = x
  self.y     = y
  self.group = group
end

Instance Attribute Details

#groupCentroid

Group is a centroid point.

Returns:



37
38
39
# File 'lib/k_means_pp/point.rb', line 37

def group
  @group
end

#originalObject

The original object (could be anything from Hash to an Object).

Returns:

  • (Object)


42
43
44
# File 'lib/k_means_pp/point.rb', line 42

def original
  @original
end