Sha256: d5ba9f65bdf0a404ef2d93671b7b6e0182c8200d111c0959df34c2650b3c76cf
Contents?: true
Size: 510 Bytes
Versions: 2
Compression:
Stored size: 510 Bytes
Contents
module Eps class Metrics attr_reader :errors def initialize(actual, estimated) @errors = actual.zip(estimated).map { |yi, yi2| yi - yi2 } end def all { rmse: rmse, mae: mae, me: me } end private def me mean(errors) end def mae mean(errors.map { |v| v.abs }) end def rmse Math.sqrt(mean(errors.map { |v| v**2 })) end def mean(arr) arr.inject(0, &:+) / arr.size.to_f end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eps-0.1.1 | lib/eps/metrics.rb |
eps-0.1.0 | lib/eps/metrics.rb |