Class: SameSame::MergeGoodnessMeasure

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(th) ⇒ MergeGoodnessMeasure

th should be >= 0 and <= 1

0 means all datapoints are neighbours
1 means no datapoints are neighbours
(proximity)


10
11
12
13
# File 'lib/same_same/merge_goodness_measure.rb', line 10

def initialize( th )
  @th = th
  @p = 1.0 + 2.0 * f( th )
end

Instance Attribute Details

#pObject (readonly)

Returns the value of attribute p.



4
5
6
# File 'lib/same_same/merge_goodness_measure.rb', line 4

def p
  @p
end

#thObject (readonly)

Returns the value of attribute th.



4
5
6
# File 'lib/same_same/merge_goodness_measure.rb', line 4

def th
  @th
end

Instance Method Details

#g(number_of_links, size_x, size_y) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/same_same/merge_goodness_measure.rb', line 15

def g(number_of_links, size_x, size_y)
  a = (size_x + size_y) ** p
  b = size_x ** p
  c = size_x ** p

  number_of_links / (a - b - c)
end