Skip to content

Commit

Permalink
fix: ideal description length
Browse files Browse the repository at this point in the history
  • Loading branch information
gottfrois committed Jun 22, 2015
1 parent 5b7a1c3 commit cee982d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/link_thumbnailer/graders/length.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ class Length < ::LinkThumbnailer::Graders::Base
def call
return 0.0 if too_short?

y * 1.0 / get_gaussian_value_for(x_pos)
y * 1.0 / get_gaussian_value_for(ideal_description_length)
end

private

def get_gaussian_value_for(x)
(1.0 / 1.0 * Math.sqrt(2.0 * Math::PI ** 2)) * Math.exp(-(x - x_pos) ** 2 / 2.0 * 0.005 ** 2)
(1.0 / 1.0 * Math.sqrt(2.0 * Math::PI ** 2)) * Math.exp(-(x - ideal_description_length) ** 2 / 2.0 * 0.005 ** 2)
end

def x
Expand All @@ -22,8 +22,8 @@ def y
get_gaussian_value_for(x)
end

def x_pos
80.0
def ideal_description_length
120.0
end

def too_short?
Expand Down

0 comments on commit cee982d

Please sign in to comment.