tiny_outcome 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tiny_outcome.rb +5 -4
- 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: 8f59aa2f60029e67a708ba51b4606394a230ced1f2dbea6c001f01a9012499eb
|
4
|
+
data.tar.gz: 3e9158d65ccbc0a0d47646684fbe5379fbfd4b3c55b5b17725dde691ac8e9852
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 898c64f22f9c0b4b193f06097ddd6a23e135088b33bb594123a20b2acc4ea8bada2fdfdda0998d25e5818a6cf4a1051f1eeb46a628b1bdafb84e4800d207ff60
|
7
|
+
data.tar.gz: 63a96dea1d7cbf4d768a4701048307e6feb61a4cced5fb56a80cba84986be0790931c3d20a3c7cd0f1a4a3be7683240f3fae876d6e91da04ad371dbf74fb41b6
|
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,14 @@ class TinyOutcome
|
|
85
86
|
# probabilty = ---------------
|
86
87
|
# total samples
|
87
88
|
def probability
|
88
|
-
return
|
89
|
+
return 0.0 if samples == 0
|
89
90
|
value.to_s(2).count('1') / samples.to_f
|
90
91
|
end
|
91
92
|
|
92
93
|
# true if we've received at least warmup number of samples
|
93
94
|
# false otherwise
|
94
95
|
def warm?
|
95
|
-
warmth
|
96
|
+
warmth >= warmup
|
96
97
|
end
|
97
98
|
|
98
99
|
# the opposite of warm: a TinyOutcome can only be cold or warm
|
@@ -122,6 +123,6 @@ class TinyOutcome
|
|
122
123
|
# L10 = last 10 samples
|
123
124
|
def to_s
|
124
125
|
max_backward = [value.to_s(2).length, 10].min
|
125
|
-
"L10 #{value.to_s(2)[-max_backward..-1].rjust(10, '?')} #{warm? ? '
|
126
|
+
"L10 #{value.to_s(2)[-max_backward..-1].rjust(10, '?')} #{warm? ? 'W' : 'c'} #{'%.2f' % probability} #{warmth}/#{warmup}::#{samples}/#{precision}"
|
126
127
|
end
|
127
128
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Lunt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-04 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
|