Class: Hiccup::Inferable::Score
- Inherits:
-
Struct
- Object
- Struct
- Hiccup::Inferable::Score
- Defined in:
- lib/hiccup/inferable/score.rb
Instance Attribute Summary collapse
-
#brick_rate ⇒ Object
Returns the value of attribute brick_rate.
-
#complexity_rate ⇒ Object
Returns the value of attribute complexity_rate.
-
#prediction_rate ⇒ Object
Returns the value of attribute prediction_rate.
Instance Method Summary collapse
-
#brick_penalty ⇒ Object
as brick rate rises, our confidence in this guess drops.
-
#complexity_penalty ⇒ Object
as the complexity rises, our confidence in this guess drops this hash table is a stand-in for a proper formala.
-
#confidence ⇒ Object
our confidence is weakened by bricks and complexity.
-
#to_f ⇒ Object
a number between 0 and 1.
Instance Attribute Details
#brick_rate ⇒ Object
Returns the value of attribute brick_rate
4 5 6 |
# File 'lib/hiccup/inferable/score.rb', line 4 def brick_rate @brick_rate end |
#complexity_rate ⇒ Object
Returns the value of attribute complexity_rate
4 5 6 |
# File 'lib/hiccup/inferable/score.rb', line 4 def complexity_rate @complexity_rate end |
#prediction_rate ⇒ Object
Returns the value of attribute prediction_rate
4 5 6 |
# File 'lib/hiccup/inferable/score.rb', line 4 def prediction_rate @prediction_rate end |
Instance Method Details
#brick_penalty ⇒ Object
as brick rate rises, our confidence in this guess drops
7 8 9 10 11 |
# File 'lib/hiccup/inferable/score.rb', line 7 def brick_penalty brick_penalty = brick_rate * 0.33 brick_penalty = 1 if brick_penalty > 1 brick_penalty end |
#complexity_penalty ⇒ Object
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.
18 19 20 |
# File 'lib/hiccup/inferable/score.rb', line 18 def complexity_penalty complexity_rate end |
#confidence ⇒ Object
our confidence is weakened by bricks and complexity
23 24 25 26 27 28 |
# File 'lib/hiccup/inferable/score.rb', line 23 def confidence confidence = 1.0 confidence *= (1 - brick_penalty) confidence *= (1 - complexity_penalty) confidence end |
#to_f ⇒ Object
a number between 0 and 1
31 32 33 |
# File 'lib/hiccup/inferable/score.rb', line 31 def to_f prediction_rate * confidence end |