tiny_outcome 3.1.0 → 3.1.2
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 +9 -9
- 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: c42e1143dcbebc9e17795c5972896594ca2efd105efb6dc57c6994396e2f50a9
|
4
|
+
data.tar.gz: ff222da29f706b0c362b8f6901a10efaf6df4428ee18414e709fc2f9722b94f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8059baa7359247f5c60198d517c8e5d3e05706c75e54347068788f450ea6bf0d438db7ae8c05df7264aaab48083697953e3d13c0f8795d2215b080c1ad3fb26
|
7
|
+
data.tar.gz: e04fbe290c68b7d1226f02cda213044cf0fd0c24784a1359404133b1895d099ff5eae1192d113231ae0ba71fa920d191dd2e8cf2179b5eb2bb6c8e51b02c4b08
|
data/lib/tiny_outcome.rb
CHANGED
@@ -52,9 +52,9 @@ class TinyOutcome
|
|
52
52
|
@probability = 0.0
|
53
53
|
@one_count = 0
|
54
54
|
@samples = 0
|
55
|
-
@min =
|
56
|
-
@max =
|
57
|
-
@avg =
|
55
|
+
@min = 1.0
|
56
|
+
@max = 0.0
|
57
|
+
@avg = 0.0
|
58
58
|
@warmth = 0
|
59
59
|
@value = [0] * @precision
|
60
60
|
@value_index = 0
|
@@ -132,16 +132,16 @@ class TinyOutcome
|
|
132
132
|
sum = 0.0
|
133
133
|
raw = (full? ? @value.rotate(@value_index) : @value)[..(samples-1)]
|
134
134
|
group_size = [@samples, 100].min
|
135
|
-
num_groups = @samples - group_size
|
135
|
+
num_groups = (@samples - group_size) + 1
|
136
136
|
raw.each_cons(group_size) do |samples_group|
|
137
|
-
|
138
|
-
sum +=
|
137
|
+
num_ones = samples_group.count(1) / group_size.to_f
|
138
|
+
sum += num_ones
|
139
139
|
|
140
|
-
@min =
|
141
|
-
@max =
|
140
|
+
@min = num_ones if num_ones < @min
|
141
|
+
@max = num_ones if num_ones > @max
|
142
142
|
end
|
143
143
|
|
144
|
-
@avg = sum /
|
144
|
+
@avg = sum / num_groups.to_f
|
145
145
|
end
|
146
146
|
|
147
147
|
# convenient way to see what's up
|
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: 3.1.
|
4
|
+
version: 3.1.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: 2023-
|
11
|
+
date: 2023-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|