Class: Hiccup::Inferable::Guesser::Score

Inherits:
Struct
  • Object
show all
Defined in:
lib/hiccup/inferable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#brick_rateObject

Returns the value of attribute brick_rate

Returns:

  • (Object)

    the current value of brick_rate



334
335
336
# File 'lib/hiccup/inferable.rb', line 334

def brick_rate
  @brick_rate
end

#complexity_rateObject

Returns the value of attribute complexity_rate

Returns:

  • (Object)

    the current value of complexity_rate



334
335
336
# File 'lib/hiccup/inferable.rb', line 334

def complexity_rate
  @complexity_rate
end

#prediction_rateObject

Returns the value of attribute prediction_rate

Returns:

  • (Object)

    the current value of prediction_rate



334
335
336
# File 'lib/hiccup/inferable.rb', line 334

def prediction_rate
  @prediction_rate
end

Instance Method Details

#brick_penaltyObject

as brick rate rises, our confidence in this guess drops



337
338
339
340
341
# File 'lib/hiccup/inferable.rb', line 337

def brick_penalty
  brick_penalty = brick_rate * 0.33
  brick_penalty = 1 if brick_penalty > 1
  brick_penalty
end

#complexity_penaltyObject

as the complexity rises, our confidence in this guess drops this hash table is a stand-in for a proper formala

A complexity of 1 means that 1 rule is required per input date. This means we haven’t really discovered a pattern.



348
349
350
# File 'lib/hiccup/inferable.rb', line 348

def complexity_penalty
  complexity_rate
end

#confidenceObject

our confidence is weakened by bricks and complexity



353
354
355
356
357
358
# File 'lib/hiccup/inferable.rb', line 353

def confidence
  confidence = 1.0
  confidence *= (1 - brick_penalty)
  confidence *= (1 - complexity_penalty)
  confidence
end

#to_fObject

a number between 0 and 1



361
362
363
# File 'lib/hiccup/inferable.rb', line 361

def to_f
  prediction_rate * confidence
end