Sha256: ec94a590e87760b318eaa88cc03a2147f1344be37e1e9a02aeab458d389031d0
Contents?: true
Size: 1.01 KB
Versions: 17
Compression:
Stored size: 1.01 KB
Contents
module Hiccup module Inferable class Score < Struct.new(:prediction_rate, :brick_rate, :complexity_rate) # as brick rate rises, our confidence in this guess drops def brick_penalty brick_penalty = brick_rate * 0.33 brick_penalty = 1 if brick_penalty > 1 brick_penalty end # 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. def complexity_penalty complexity_rate end # our confidence is weakened by bricks and complexity def confidence confidence = 1.0 confidence *= (1 - brick_penalty) confidence *= (1 - complexity_penalty) confidence end # a number between 0 and 1 def to_f prediction_rate * confidence end end end end
Version data entries
17 entries across 17 versions & 1 rubygems