everyday-cli-utils 1.8.6 → 1.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -16
- data/lib/everyday-cli-utils/safe/kmeans.rb +6 -3
- data/lib/everyday-cli-utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c8addfde28034bfb3b2f496426de71097bd2917
|
4
|
+
data.tar.gz: 29e23d43981b44536e065cd1dd90090fe0b2ca2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5c8f1efe45af026438fd8f4cbae18896291cb7944aae19f0e4d2354c222623d573e0d3757f89faf75bf16f4a3eda19785a09ab18add2b940744d27658140dc1
|
7
|
+
data.tar.gz: 9be4ca7586afa5b6edee95e911f0c99718a9a4a362a7375f4a14af27ee6042a65c83be8a9a42d482e1e7ee37ab97b8ecdc09d639bdc98847f921af3f56772ac6
|
data/Gemfile.lock
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
everyday-cli-utils (1.8.
|
4
|
+
everyday-cli-utils (1.8.6)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
codeclimate-test-reporter (0.
|
9
|
+
codeclimate-test-reporter (0.5.0)
|
10
10
|
simplecov (>= 0.7.1, < 1.0.0)
|
11
11
|
diff-lcs (1.2.5)
|
12
12
|
docile (1.1.5)
|
13
13
|
json (1.8.3)
|
14
|
-
rake (10.
|
15
|
-
rspec (3.
|
16
|
-
rspec-core (~> 3.
|
17
|
-
rspec-expectations (~> 3.
|
18
|
-
rspec-mocks (~> 3.
|
19
|
-
rspec-core (3.3
|
20
|
-
rspec-support (~> 3.
|
21
|
-
rspec-expectations (3.
|
14
|
+
rake (10.5.0)
|
15
|
+
rspec (3.4.0)
|
16
|
+
rspec-core (~> 3.4.0)
|
17
|
+
rspec-expectations (~> 3.4.0)
|
18
|
+
rspec-mocks (~> 3.4.0)
|
19
|
+
rspec-core (3.4.3)
|
20
|
+
rspec-support (~> 3.4.0)
|
21
|
+
rspec-expectations (3.4.0)
|
22
22
|
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
-
rspec-support (~> 3.
|
24
|
-
rspec-mocks (3.
|
23
|
+
rspec-support (~> 3.4.0)
|
24
|
+
rspec-mocks (3.4.1)
|
25
25
|
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
-
rspec-support (~> 3.
|
27
|
-
rspec-support (3.
|
28
|
-
simplecov (0.
|
26
|
+
rspec-support (~> 3.4.0)
|
27
|
+
rspec-support (3.4.1)
|
28
|
+
simplecov (0.11.2)
|
29
29
|
docile (~> 1.1.0)
|
30
30
|
json (~> 1.8)
|
31
31
|
simplecov-html (~> 0.10.0)
|
@@ -42,4 +42,4 @@ DEPENDENCIES
|
|
42
42
|
rspec (~> 3.3)
|
43
43
|
|
44
44
|
BUNDLED WITH
|
45
|
-
1.
|
45
|
+
1.11.2
|
@@ -51,8 +51,8 @@ module EverydayCliUtils
|
|
51
51
|
cluster = false
|
52
52
|
distance = false
|
53
53
|
(0...means.count).each { |i|
|
54
|
-
diff = (means[i] - item)
|
55
|
-
if distance == false || diff
|
54
|
+
diff = (means[i] - item) ** 2
|
55
|
+
if distance == false || diff <= distance
|
56
56
|
cluster = i
|
57
57
|
distance = diff
|
58
58
|
end
|
@@ -111,7 +111,10 @@ module EverydayCliUtils
|
|
111
111
|
kso = ks
|
112
112
|
clusters = EverydayCliUtils::KmeansUtil.get_clusters(collection, kso)
|
113
113
|
ks = []
|
114
|
-
clusters.each_with_index { |val, key| ks[key] = (val.count <= 0) ?
|
114
|
+
clusters.each_with_index { |val, key| ks[key] = (val.count <= 0) ? false : (val.sum / val.count) }
|
115
|
+
min = collection.min
|
116
|
+
max = collection.max
|
117
|
+
ks = ks.map { |k| k || ((Random.rand * (max-min)) + min) }
|
115
118
|
ks.sort
|
116
119
|
return kso, ks
|
117
120
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: everyday-cli-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Henderson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|