classifier-reborn 2.0.2 → 2.0.3

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: 1219c6a6bbe3f8c2a0820d953da2ef4c85bb5e52
4
- data.tar.gz: 66575a30d03763da10f35ee669942bc111838e6e
3
+ metadata.gz: ca32b9ed7e187b4e3ce9ef622828fb0359a36ec3
4
+ data.tar.gz: 170ada0f042cb00b9aff7668bcc8b1a628b6ed03
5
5
  SHA512:
6
- metadata.gz: 7d8012f760b929a521a03aa43914def24bd2ddcf688c6816c3699d549d584cccf91e5b8499f1c988b8eceb8d4cf767ccad2585cb2cacabcd9092ce040d64b02e
7
- data.tar.gz: 6e6d7e9a50f9ab05d8548b7032c208729c852fa32452a2c411f7ebd50b9ccf53750f0155907a4cfefd697ec12a0dd24fc25e8fd6d9131e7318fbf04350f6b93e
6
+ metadata.gz: 56f7221cfeb08faf996c0fede890d2d96634d6d39b11f975b8c8b3cc2d581bba335aea01492fada34758f4287ea513d78d39b0fbb7d8297975df26e7d14567e5
7
+ data.tar.gz: f74e1a9845b5be429e59b6b5fb44701b5db80a606ebd7c271e81cd881428f7b771a00c6582627b3250f583e1cbe8ac16ef5bcff99adf560a2d73fd732ed374d4
@@ -5,26 +5,6 @@
5
5
 
6
6
  require 'matrix'
7
7
 
8
- class Vector
9
- def magnitude
10
- sumsqs = 0.0
11
- self.size.times do |i|
12
- sumsqs += self[i] ** 2.0
13
- end
14
- Math.sqrt(sumsqs)
15
- end
16
- def normalize
17
- nv = []
18
- mag = self.magnitude
19
- self.size.times do |i|
20
-
21
- nv << (self[i] / mag)
22
-
23
- end
24
- Vector[*nv]
25
- end
26
- end
27
-
28
8
  class Matrix
29
9
  def Matrix.diag(s)
30
10
  Matrix.diagonal(*s)
@@ -44,7 +44,14 @@ module ClassifierReborn
44
44
  end
45
45
 
46
46
  # Perform the scaling transform and force floating point arithmetic
47
- total_words = vec.reduce(0, :+).to_f
47
+ if $GSL
48
+ sum = 0.0
49
+ vec.collect{|v| sum += v}
50
+ total_words = sum
51
+ else
52
+ total_words = vec.reduce(0, :+).to_f
53
+ end
54
+
48
55
  total_unique_words = 0
49
56
 
50
57
  if $GSL
@@ -1,3 +1,3 @@
1
1
  module ClassifierReborn
2
- VERSION = '2.0.2'
2
+ VERSION = '2.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classifier-reborn
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Carlson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-09 00:00:00.000000000 Z
12
+ date: 2014-12-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fast-stemmer