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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37be28a98c638cefab8500bce8bf60248a03c157
4
- data.tar.gz: 33a7d6af9267664b6b4c2cd8dd11a06eced84e6f
3
+ metadata.gz: 4c8addfde28034bfb3b2f496426de71097bd2917
4
+ data.tar.gz: 29e23d43981b44536e065cd1dd90090fe0b2ca2e
5
5
  SHA512:
6
- metadata.gz: 3541ed73a73bd9a8bcf41feea5ec42013e42af0825701db74a02a0bfa259c1eeb683708435c506905ca6a5d08678cc712b4fcf8fd443868eed9ce83cb8eae1fc
7
- data.tar.gz: 72bac74af59b8f76e11ed6ecb94ea59d8db3594de307c33336cf84e44a8942aea2ab62c075bf5cca3d3320fc98cecd0b56ae19191119efc1deb48aa8058dc9c3
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.2)
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.4.7)
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.4.2)
15
- rspec (3.3.0)
16
- rspec-core (~> 3.3.0)
17
- rspec-expectations (~> 3.3.0)
18
- rspec-mocks (~> 3.3.0)
19
- rspec-core (3.3.1)
20
- rspec-support (~> 3.3.0)
21
- rspec-expectations (3.3.0)
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.3.0)
24
- rspec-mocks (3.3.1)
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.3.0)
27
- rspec-support (3.3.0)
28
- simplecov (0.10.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.10.4
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).abs
55
- if distance == false || diff < distance
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) ? kso[key] : (val.sum / val.count) }
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
@@ -1,3 +1,3 @@
1
1
  module EverydayCliUtils
2
- VERSION = '1.8.6'
2
+ VERSION = '1.8.7'
3
3
  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.6
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: 2015-12-28 00:00:00.000000000 Z
11
+ date: 2016-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler