entropy 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ == Version 0.1.0
2
+
3
+ * Add a test to verify a metric space degenerating in
4
+ discrete case (distance = Infinity) and modified the examples
5
+
6
+ == Version 0.0.3
7
+
8
+ * Specify more clearly that requires ruby 1.9.x
9
+
10
+ == Version 0.0.2
11
+
12
+ * Specifiy the requirements of ruby 1.9.x
13
+
14
+ == Version 0.0.1
15
+
16
+ * Initial commit
17
+
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ desc 'generate API documentation to doc/rdocs/index.html'
14
14
  RDoc::Task.new do |rdoc|
15
15
  rdoc.main = 'README.txt'
16
16
  rdoc.rdoc_dir = 'doc/rdocs'
17
- rdoc.rdoc_files.include("README.txt", "LICENSE.txt", "lib/**/*.rb")
17
+ rdoc.rdoc_files.include("README.txt", "LICENSE.txt", "CHANGELOG.txt", "lib/**/*.rb")
18
18
  end
19
19
 
20
20
  desc "Run tests"
@@ -31,7 +31,7 @@ puts obj.renyi_entropy(:infinite)
31
31
 
32
32
  # setting infinite distance means having a discrete set
33
33
  puts "setting infinite distance means having a discrete set"
34
- distance = Matrix[[:infinite, :infinite], [:infinite, :infinite]]
34
+ distance = Matrix[[0, :infinite], [:infinite, 0]]
35
35
  obj.define_distance(distance)
36
36
  pp obj.prob_space # [0.25, 0.25, 0.25, 0.25]
37
37
  pp distance
@@ -1,3 +1,3 @@
1
1
  module Entropy
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -17,7 +17,7 @@ class TestEntropy < Test::Unit::TestCase
17
17
  assert_equal obj.prob_space.sort, [0.25, 0.75]
18
18
  end
19
19
 
20
- def test_distance_metr
20
+ def test_distance_metr_3
21
21
  obj = Entropy::ProbabilityMetricSpace.new
22
22
  obj.add_stream("0123")
23
23
  obj.define_distance {|i, j| Math.sqrt(i*i + j*j) }
@@ -25,12 +25,20 @@ class TestEntropy < Test::Unit::TestCase
25
25
  assert_equal obj.distance_matrix, m
26
26
  end
27
27
 
28
- def test_entropy_metr
28
+ def test_entropy_metr_4
29
29
  obj = Entropy::ProbabilityMetricSpace.new
30
30
  obj.add_stream("0123")
31
31
  obj.define_distance {|i, j| 1 }
32
32
  assert_equal obj.diversity(1), 1
33
33
  end
34
34
 
35
+ def test_entropy_metr_5
36
+ obj = Entropy::ProbabilityMetricSpace.new
37
+ obj.add_stream("01")
38
+ m = Matrix[[0, :infinite], [:infinite, 0]]
39
+ obj.define_distance(m)
40
+ assert_equal obj.cardinality(2), 2
41
+ assert_equal obj.cardinality(42), 2
42
+ end
35
43
  end
36
44
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: entropy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 3
10
- version: 0.0.3
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - hiraedd
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-27 00:00:00 Z
18
+ date: 2011-09-29 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: This little gem calculates the entropy and ( the cardinality) of a finite probability space, defined by a probability vector; and of a finite probability metric space, defined by a probability vector and metric function. Requires ruby 1.9.x
@@ -29,6 +29,7 @@ extra_rdoc_files: []
29
29
 
30
30
  files:
31
31
  - .gitignore
32
+ - CHANGELOG.txt
32
33
  - Gemfile
33
34
  - LICENSE.txt
34
35
  - README.txt