tiny_outcome 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tiny_outcome.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3611d8970ea3a209328e2149c518dc2c8ea0e15c8297ec6951d63c0d2c9d2ce1
|
4
|
+
data.tar.gz: 0bb76d7481157879e2d7a4e0b0d3edfc87bb96af5a85c5c3dc64187e9b53c6af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10d7cea58b4f4bdf02988ff2ab3fcb91ee3f28dea1df19ddaa2e0fff2d3f7090e39dd4f696985926e688ae320128dab7d96708aee3f87c3cb8bff026d075c353
|
7
|
+
data.tar.gz: 5646f503b6998e99df4d68e21a10f70344d3e9e9f0aa363e9b751d2def1664924a286319c022867fc0019cce5f2f40ee74b0792bf18ef67c156af88681805da8
|
data/lib/tiny_outcome.rb
CHANGED
@@ -54,7 +54,8 @@ class TinyOutcome
|
|
54
54
|
when WARM_ONE_THIRD then precision / 3
|
55
55
|
when WARM_NONE then 0
|
56
56
|
else
|
57
|
-
raise "Invalid warmup: #{warmup.inspect}"
|
57
|
+
raise "Invalid warmup: #{warmup.inspect}" if (!warmup.is_a?(Integer) || warmup < 1)
|
58
|
+
warmup
|
58
59
|
end
|
59
60
|
end
|
60
61
|
|
@@ -85,14 +86,13 @@ class TinyOutcome
|
|
85
86
|
# probabilty = ---------------
|
86
87
|
# total samples
|
87
88
|
def probability
|
88
|
-
|
89
|
-
value.to_s(2).count('1') / samples.to_f
|
89
|
+
(value.to_s(2).count('1') / samples.to_f).round(2)
|
90
90
|
end
|
91
91
|
|
92
92
|
# true if we've received at least warmup number of samples
|
93
93
|
# false otherwise
|
94
94
|
def warm?
|
95
|
-
warmth
|
95
|
+
warmth >= warmup
|
96
96
|
end
|
97
97
|
|
98
98
|
# the opposite of warm: a TinyOutcome can only be cold or warm
|
@@ -122,6 +122,6 @@ class TinyOutcome
|
|
122
122
|
# L10 = last 10 samples
|
123
123
|
def to_s
|
124
124
|
max_backward = [value.to_s(2).length, 10].min
|
125
|
-
"L10 #{value.to_s(2)[-max_backward..-1].rjust(10, '?')} #{warm? ? '
|
125
|
+
"L10 #{value.to_s(2)[-max_backward..-1].rjust(10, '?')} #{warm? ? 'W' : 'c'} #{'%.2f' % probability} #{warmth}/#{warmup}::#{samples}/#{precision}"
|
126
126
|
end
|
127
127
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny_outcome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Lunt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: a tiny outcome tracker with almost no features
|
14
14
|
email: jefflunt@gmail.com
|