lite-statistics 1.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +14 -3
- data/.travis.yml +1 -0
- data/CHANGELOG.md +7 -1
- data/Gemfile.lock +66 -59
- data/benchmarks/base.rb +3 -3
- data/benchmarks/descriptive-statistics.rb +3 -3
- data/benchmarks/statistica.rb +4 -4
- data/docs/descriptive/SUMMARY.md +3 -3
- data/lib/lite/statistics/descriptive.rb +8 -8
- data/lib/lite/statistics/enumerable.rb +3 -1
- data/lib/lite/statistics/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8f8f07632fa69ea54418688b58a258e6300fecd15589d9fd81bb6792ab5174a
|
4
|
+
data.tar.gz: 30ef26cef558ef6a9060c302ef27b6b621f71844a4302901df7cc2d9b6308be4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1b5b3f5cb9ae4c5b285fe0b3b6762379a0b6d813c51002e88ddece1bd4fbea03f74958271525d9615a93bbefe138b6aa0021ab1a6a776c7952f4cd7acb72b93
|
7
|
+
data.tar.gz: 19df215b60614feaa471255c1b48ae6df2471ec02dcdfd5d6417f43cd6f0efe919f20936d999ec5c1201830bfadb314c62bbffa58cc11905a8a716908c26125a
|
data/.rubocop.yml
CHANGED
@@ -2,11 +2,14 @@ require:
|
|
2
2
|
- rubocop-performance
|
3
3
|
- rubocop-rspec
|
4
4
|
AllCops:
|
5
|
-
TargetRubyVersion: 2.
|
5
|
+
TargetRubyVersion: 2.7
|
6
|
+
NewCops: enable
|
6
7
|
DisplayCopNames: true
|
7
8
|
DisplayStyleGuide: true
|
8
|
-
|
9
|
-
|
9
|
+
Gemspec/RequiredRubyVersion:
|
10
|
+
Enabled: false
|
11
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
12
|
+
Enabled: true
|
10
13
|
Layout/EmptyLinesAroundBlockBody:
|
11
14
|
Exclude:
|
12
15
|
- 'spec/**/**/*'
|
@@ -14,6 +17,14 @@ Layout/EmptyLinesAroundClassBody:
|
|
14
17
|
EnforcedStyle: empty_lines_except_namespace
|
15
18
|
Layout/EmptyLinesAroundModuleBody:
|
16
19
|
EnforcedStyle: empty_lines_except_namespace
|
20
|
+
Layout/LineLength:
|
21
|
+
Max: 100
|
22
|
+
Layout/SpaceAroundMethodCallOperator:
|
23
|
+
Enabled: true
|
24
|
+
Lint/RaiseException:
|
25
|
+
Enabled: true
|
26
|
+
Lint/StructNewOverride:
|
27
|
+
Enabled: true
|
17
28
|
Metrics/BlockLength:
|
18
29
|
Enabled: false
|
19
30
|
Metrics/ClassLength:
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,9 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.1.0] - 2019-06-06
|
10
|
+
### Changed
|
11
|
+
- Removed underscore of quartile numbers
|
12
|
+
|
9
13
|
## [1.0.5] - 2019-08-24
|
14
|
+
### Added
|
15
|
+
- Added ruby 2.7 support
|
10
16
|
### Changed
|
11
|
-
-
|
17
|
+
- Improved how configuration works
|
12
18
|
|
13
19
|
## [1.0.4] - 2019-08-17
|
14
20
|
### Changed
|
data/Gemfile.lock
CHANGED
@@ -1,109 +1,116 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lite-statistics (1.0
|
4
|
+
lite-statistics (1.1.0)
|
5
5
|
lite-memoize
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionpack (6.0.
|
11
|
-
actionview (= 6.0.
|
12
|
-
activesupport (= 6.0.
|
13
|
-
rack (~> 2.0)
|
10
|
+
actionpack (6.0.3.4)
|
11
|
+
actionview (= 6.0.3.4)
|
12
|
+
activesupport (= 6.0.3.4)
|
13
|
+
rack (~> 2.0, >= 2.0.8)
|
14
14
|
rack-test (>= 0.6.3)
|
15
15
|
rails-dom-testing (~> 2.0)
|
16
16
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
-
actionview (6.0.
|
18
|
-
activesupport (= 6.0.
|
17
|
+
actionview (6.0.3.4)
|
18
|
+
activesupport (= 6.0.3.4)
|
19
19
|
builder (~> 3.1)
|
20
20
|
erubi (~> 1.4)
|
21
21
|
rails-dom-testing (~> 2.0)
|
22
22
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
-
activesupport (6.0.
|
23
|
+
activesupport (6.0.3.4)
|
24
24
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
25
|
i18n (>= 0.7, < 2)
|
26
26
|
minitest (~> 5.1)
|
27
27
|
tzinfo (~> 1.1)
|
28
|
-
zeitwerk (~> 2.
|
29
|
-
ast (2.4.
|
30
|
-
builder (3.2.
|
28
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
29
|
+
ast (2.4.1)
|
30
|
+
builder (3.2.4)
|
31
31
|
colorize (0.8.1)
|
32
|
-
concurrent-ruby (1.1.
|
33
|
-
crass (1.0.
|
34
|
-
diff-lcs (1.
|
35
|
-
erubi (1.
|
36
|
-
fasterer (0.
|
32
|
+
concurrent-ruby (1.1.7)
|
33
|
+
crass (1.0.6)
|
34
|
+
diff-lcs (1.4.4)
|
35
|
+
erubi (1.9.0)
|
36
|
+
fasterer (0.8.3)
|
37
37
|
colorize (~> 0.7)
|
38
|
-
ruby_parser (>= 3.
|
38
|
+
ruby_parser (>= 3.14.1)
|
39
39
|
generator_spec (0.9.4)
|
40
40
|
activesupport (>= 3.0.0)
|
41
41
|
railties (>= 3.0.0)
|
42
|
-
i18n (1.
|
42
|
+
i18n (1.8.5)
|
43
43
|
concurrent-ruby (~> 1.0)
|
44
|
-
jaro_winkler (1.5.3)
|
45
44
|
lite-memoize (1.0.3)
|
46
|
-
loofah (2.
|
45
|
+
loofah (2.7.0)
|
47
46
|
crass (~> 1.0.2)
|
48
47
|
nokogiri (>= 1.5.9)
|
49
|
-
method_source (0.
|
48
|
+
method_source (1.0.0)
|
50
49
|
mini_portile2 (2.4.0)
|
51
|
-
minitest (5.
|
52
|
-
nokogiri (1.10.
|
50
|
+
minitest (5.14.2)
|
51
|
+
nokogiri (1.10.10)
|
53
52
|
mini_portile2 (~> 2.4.0)
|
54
|
-
parallel (1.
|
55
|
-
parser (2.
|
56
|
-
ast (~> 2.4.
|
57
|
-
rack (2.
|
53
|
+
parallel (1.19.2)
|
54
|
+
parser (2.7.2.0)
|
55
|
+
ast (~> 2.4.1)
|
56
|
+
rack (2.2.3)
|
58
57
|
rack-test (1.1.0)
|
59
58
|
rack (>= 1.0, < 3)
|
60
59
|
rails-dom-testing (2.0.3)
|
61
60
|
activesupport (>= 4.2.0)
|
62
61
|
nokogiri (>= 1.6)
|
63
|
-
rails-html-sanitizer (1.
|
64
|
-
loofah (~> 2.
|
65
|
-
railties (6.0.
|
66
|
-
actionpack (= 6.0.
|
67
|
-
activesupport (= 6.0.
|
62
|
+
rails-html-sanitizer (1.3.0)
|
63
|
+
loofah (~> 2.3)
|
64
|
+
railties (6.0.3.4)
|
65
|
+
actionpack (= 6.0.3.4)
|
66
|
+
activesupport (= 6.0.3.4)
|
68
67
|
method_source
|
69
68
|
rake (>= 0.8.7)
|
70
69
|
thor (>= 0.20.3, < 2.0)
|
71
70
|
rainbow (3.0.0)
|
72
|
-
rake (
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
rspec-
|
77
|
-
|
78
|
-
rspec-
|
79
|
-
rspec-
|
71
|
+
rake (13.0.1)
|
72
|
+
regexp_parser (1.8.2)
|
73
|
+
rexml (3.2.4)
|
74
|
+
rspec (3.10.0)
|
75
|
+
rspec-core (~> 3.10.0)
|
76
|
+
rspec-expectations (~> 3.10.0)
|
77
|
+
rspec-mocks (~> 3.10.0)
|
78
|
+
rspec-core (3.10.0)
|
79
|
+
rspec-support (~> 3.10.0)
|
80
|
+
rspec-expectations (3.10.0)
|
80
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
-
rspec-support (~> 3.
|
82
|
-
rspec-mocks (3.
|
82
|
+
rspec-support (~> 3.10.0)
|
83
|
+
rspec-mocks (3.10.0)
|
83
84
|
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
-
rspec-support (~> 3.
|
85
|
-
rspec-support (3.
|
86
|
-
rubocop (
|
87
|
-
jaro_winkler (~> 1.5.1)
|
85
|
+
rspec-support (~> 3.10.0)
|
86
|
+
rspec-support (3.10.0)
|
87
|
+
rubocop (1.2.0)
|
88
88
|
parallel (~> 1.10)
|
89
|
-
parser (>= 2.
|
89
|
+
parser (>= 2.7.1.5)
|
90
90
|
rainbow (>= 2.2.2, < 4.0)
|
91
|
+
regexp_parser (>= 1.8)
|
92
|
+
rexml
|
93
|
+
rubocop-ast (>= 1.0.1)
|
91
94
|
ruby-progressbar (~> 1.7)
|
92
|
-
unicode-display_width (>= 1.4.0, <
|
93
|
-
rubocop-
|
94
|
-
|
95
|
-
rubocop-
|
96
|
-
rubocop (>= 0.
|
95
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
96
|
+
rubocop-ast (1.1.1)
|
97
|
+
parser (>= 2.7.1.5)
|
98
|
+
rubocop-performance (1.8.1)
|
99
|
+
rubocop (>= 0.87.0)
|
100
|
+
rubocop-ast (>= 0.4.0)
|
101
|
+
rubocop-rspec (2.0.0)
|
102
|
+
rubocop (~> 1.0)
|
103
|
+
rubocop-ast (>= 1.1.0)
|
97
104
|
ruby-progressbar (1.10.1)
|
98
|
-
ruby_parser (3.
|
105
|
+
ruby_parser (3.15.0)
|
99
106
|
sexp_processor (~> 4.9)
|
100
|
-
sexp_processor (4.
|
101
|
-
thor (0.
|
107
|
+
sexp_processor (4.15.1)
|
108
|
+
thor (1.0.1)
|
102
109
|
thread_safe (0.3.6)
|
103
|
-
tzinfo (1.2.
|
110
|
+
tzinfo (1.2.7)
|
104
111
|
thread_safe (~> 0.1)
|
105
|
-
unicode-display_width (1.
|
106
|
-
zeitwerk (2.1
|
112
|
+
unicode-display_width (1.7.0)
|
113
|
+
zeitwerk (2.4.1)
|
107
114
|
|
108
115
|
PLATFORMS
|
109
116
|
ruby
|
@@ -120,4 +127,4 @@ DEPENDENCIES
|
|
120
127
|
rubocop-rspec
|
121
128
|
|
122
129
|
BUNDLED WITH
|
123
|
-
2.
|
130
|
+
2.1.4
|
data/benchmarks/base.rb
CHANGED
@@ -13,9 +13,9 @@ def ls_baseline_summary(data)
|
|
13
13
|
median: data.median,
|
14
14
|
min: data.min,
|
15
15
|
mode: data.mode,
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
quartile1: data.value_from_percentile(25),
|
17
|
+
quartile2: data.value_from_percentile(50),
|
18
|
+
quartile3: data.value_from_percentile(75),
|
19
19
|
range: data.range,
|
20
20
|
size: data.size,
|
21
21
|
sum: data.sum,
|
@@ -17,9 +17,9 @@ def baseline_summary(data)
|
|
17
17
|
median: data.median,
|
18
18
|
min: data.min,
|
19
19
|
mode: data.mode,
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
quartile1: data.value_from_percentile(25),
|
21
|
+
quartile2: data.value_from_percentile(50),
|
22
|
+
quartile3: data.value_from_percentile(75),
|
23
23
|
range: data.range,
|
24
24
|
size: data.size,
|
25
25
|
sum: data.sum,
|
data/benchmarks/statistica.rb
CHANGED
@@ -17,9 +17,9 @@ def baseline_summary(data)
|
|
17
17
|
median: data.get_median,
|
18
18
|
min: data.min,
|
19
19
|
mode: data.get_mode,
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
quartile1: data.get_percentile(25),
|
21
|
+
quartile2: data.get_percentile(50),
|
22
|
+
quartile3: data.get_percentile(75),
|
23
23
|
range: data.get_range,
|
24
24
|
size: data.size,
|
25
25
|
sum: data.get_sum,
|
@@ -50,7 +50,7 @@ def full_summary(data)
|
|
50
50
|
geometric_mean: data.get_geo_mean,
|
51
51
|
harmonic_mean: data.get_harm_mean,
|
52
52
|
product: data.get_product,
|
53
|
-
|
53
|
+
interquartilerange: data.get_interquartilerange,
|
54
54
|
relative_variance: data.get_relative_variance,
|
55
55
|
coeff_variation: data.get_coeff_variation
|
56
56
|
)
|
data/docs/descriptive/SUMMARY.md
CHANGED
@@ -7,9 +7,9 @@ collection = [1, 1, 2, 3, 10]
|
|
7
7
|
results = {
|
8
8
|
# - all documented calculations - ...
|
9
9
|
# - including value_from_percentile of 25, 50, and 75 (quartile) -
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
quartile1: 2,
|
11
|
+
quartile2: 3,
|
12
|
+
quartile3: 10
|
13
13
|
}
|
14
14
|
|
15
15
|
klass = Lite::Statistics::Descriptive.new(collection)
|
@@ -38,7 +38,7 @@ module Lite
|
|
38
38
|
|
39
39
|
memoize :frequencies
|
40
40
|
|
41
|
-
# rubocop:disable Style/
|
41
|
+
# rubocop:disable Style/RedundantSort
|
42
42
|
def max
|
43
43
|
return if @collection.empty?
|
44
44
|
|
@@ -46,7 +46,7 @@ module Lite
|
|
46
46
|
end
|
47
47
|
|
48
48
|
memoize :max
|
49
|
-
# rubocop:enable Style/
|
49
|
+
# rubocop:enable Style/RedundantSort
|
50
50
|
|
51
51
|
def mean
|
52
52
|
return if @collection.empty?
|
@@ -68,7 +68,7 @@ module Lite
|
|
68
68
|
memoize :median
|
69
69
|
# rubocop:enable Metrics/AbcSize
|
70
70
|
|
71
|
-
# rubocop:disable Style/
|
71
|
+
# rubocop:disable Style/RedundantSort
|
72
72
|
def min
|
73
73
|
return if @collection.empty?
|
74
74
|
|
@@ -76,7 +76,7 @@ module Lite
|
|
76
76
|
end
|
77
77
|
|
78
78
|
memoize :min
|
79
|
-
# rubocop:enable Style/
|
79
|
+
# rubocop:enable Style/RedundantSort
|
80
80
|
|
81
81
|
def mode
|
82
82
|
return if @collection.empty?
|
@@ -192,7 +192,7 @@ module Lite
|
|
192
192
|
def proportions
|
193
193
|
return if @collection.empty?
|
194
194
|
|
195
|
-
frequencies.
|
195
|
+
frequencies.transform_values { |val| val / size.to_f }
|
196
196
|
end
|
197
197
|
|
198
198
|
memoize :proportions
|
@@ -326,9 +326,9 @@ module Lite
|
|
326
326
|
min: min,
|
327
327
|
mode: mode,
|
328
328
|
proportions: proportions,
|
329
|
-
|
330
|
-
|
331
|
-
|
329
|
+
quartile1: value_from_percentile(25),
|
330
|
+
quartile2: value_from_percentile(50),
|
331
|
+
quartile3: value_from_percentile(75),
|
332
332
|
range: range,
|
333
333
|
size: size,
|
334
334
|
sum: sum
|
@@ -3,8 +3,10 @@
|
|
3
3
|
if Lite::Statistics.configuration.monkey_patches
|
4
4
|
module Enumerable
|
5
5
|
|
6
|
+
EXCLUDED_DESCRIPTIVE_CALCULATIONS ||= %i[max min sum].freeze
|
7
|
+
|
6
8
|
Lite::Statistics::Descriptive::CALCULATIONS.each do |name|
|
7
|
-
next if
|
9
|
+
next if EXCLUDED_DESCRIPTIVE_CALCULATIONS.include?(name)
|
8
10
|
|
9
11
|
define_method(name) { |*args| Lite::Statistics::Descriptive.send(name, self, *args) }
|
10
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lite-statistics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lite-memoize
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
description:
|
139
|
+
description:
|
140
140
|
email:
|
141
141
|
- j.gomez@drexed.com
|
142
142
|
executables: []
|
@@ -196,7 +196,7 @@ homepage: http://drexed.github.io/lite-statistics
|
|
196
196
|
licenses:
|
197
197
|
- MIT
|
198
198
|
metadata: {}
|
199
|
-
post_install_message:
|
199
|
+
post_install_message:
|
200
200
|
rdoc_options: []
|
201
201
|
require_paths:
|
202
202
|
- lib
|
@@ -211,8 +211,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
211
|
- !ruby/object:Gem::Version
|
212
212
|
version: '0'
|
213
213
|
requirements: []
|
214
|
-
rubygems_version: 3.
|
215
|
-
signing_key:
|
214
|
+
rubygems_version: 3.1.4
|
215
|
+
signing_key:
|
216
216
|
specification_version: 4
|
217
217
|
summary: Generate statistics from collections of data points
|
218
218
|
test_files: []
|