tiny_outcome 2.0.1 → 2.1.0
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 +4 -2
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccac5bae17f87452576130e604477b25fbaaa70785e0a41894077e8896521a28
|
4
|
+
data.tar.gz: f108cdf6533898223d088a169645d2b0ddc897c857c725c713086f42519a9d74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12b256504992f76ca4e6a22af2b5a9e24699062765f3bf1acb6f9d1e24f9fceefcbf865e856371ab4bf85c9a20fef6923e8582bb9c87b37571bbdba4d1271752
|
7
|
+
data.tar.gz: fedc09804f2e2c2007cf05e83f0971a2f54a5e9dcb18a2cf245fd5d907e60813f83de23e55024b323bd065cda7acc08d6504928ea1706871b465831326ac33fe
|
data/lib/tiny_outcome.rb
CHANGED
@@ -86,7 +86,8 @@ class TinyOutcome
|
|
86
86
|
# probabilty = ---------------
|
87
87
|
# total samples
|
88
88
|
def probability
|
89
|
-
|
89
|
+
return 0.0 if samples == 0
|
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
|
@@ -111,7 +112,8 @@ class TinyOutcome
|
|
111
112
|
[:value,
|
112
113
|
:samples,
|
113
114
|
:warmth,
|
114
|
-
:warmup
|
115
|
+
:warmup,
|
116
|
+
:warm?,
|
115
117
|
:probability,
|
116
118
|
].each_with_object({}) do |attr, memo|
|
117
119
|
memo[attr] = send(attr)
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Lunt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2023-09-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: m
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
description: a tiny outcome tracker with almost no features
|
14
42
|
email: jefflunt@gmail.com
|
15
43
|
executables: []
|