ruby-em_algorithm 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/Gemfile +6 -0
  2. data/Gemfile.lock +30 -0
  3. data/README.md +44 -0
  4. data/Rakefile +7 -0
  5. data/example/.ex1.rb.swp +0 -0
  6. data/example/.ex2.rb.swp +0 -0
  7. data/example/.ex3-tmp.rb.swp +0 -0
  8. data/example/.ex3.rb.swp +0 -0
  9. data/example/data/2dim-gmm-new.txt +1267 -0
  10. data/example/data/2dim-gmm-simple.txt +676 -0
  11. data/example/data/2dim-gmm-test.txt +6565 -0
  12. data/example/data/2dim-gmm-test2.txt +2782 -0
  13. data/example/data/2dim-gmm-test3.csv +1641 -0
  14. data/example/data/2dim-gmm-test3.txt +2782 -0
  15. data/example/data/2dim-gmm-test4.csv +868 -0
  16. data/example/data/2dim-gmm-test4.txt +4924 -0
  17. data/example/data/2dim-gmm-without_weight-small.txt +2401 -0
  18. data/example/data/2dim-gmm-without_weight.txt +18001 -0
  19. data/example/data/2dim-gmm.txt +1267 -0
  20. data/example/data/gmm-new.txt +10001 -0
  21. data/example/data/gmm-simple.txt +676 -0
  22. data/example/data/gmm.txt +10001 -0
  23. data/example/data/old-gmm.txt +10000 -0
  24. data/example/ex1.rb +20 -0
  25. data/example/ex1.rb~ +20 -0
  26. data/example/ex2.rb +33 -0
  27. data/example/ex2.rb~ +33 -0
  28. data/example/ex3-tmp.rb +23 -0
  29. data/example/ex3-tmp.rb~ +25 -0
  30. data/example/ex3.rb +43 -0
  31. data/example/ex3.rb~ +43 -0
  32. data/example/tools/.2dim.rb.swp +0 -0
  33. data/example/tools/2dim.rb +69 -0
  34. data/example/tools/2dim.rb~ +69 -0
  35. data/example/tools/boxmuller.rb +28 -0
  36. data/example/tools/boxmuller.rb~ +28 -0
  37. data/example/tools/conv_from_yaml.rb +8 -0
  38. data/example/tools/conv_from_yaml_to_csv.rb +8 -0
  39. data/example/tools/conv_to_yaml.rb +17 -0
  40. data/example/tools/ellipsoid.gnuplot +63 -0
  41. data/example/tools/ellipsoid.gnuplot~ +64 -0
  42. data/example/tools/histogram.rb +19 -0
  43. data/example/tools/histogram2d.rb +20 -0
  44. data/example/tools/histogram2d.rb~ +18 -0
  45. data/example/tools/kmeans.rb +34 -0
  46. data/example/tools/mean.rb +19 -0
  47. data/example/tools/table.data +4618 -0
  48. data/example/tools/tmp.txt +69632 -0
  49. data/example/tools/xmeans.R +608 -0
  50. data/example/tools/xmeans.rb +35 -0
  51. data/lib/em_algorithm/.base.rb.swp +0 -0
  52. data/lib/em_algorithm/base.rb +116 -0
  53. data/lib/em_algorithm/base.rb~ +116 -0
  54. data/lib/em_algorithm/convergence/.chi_square.rb.swp +0 -0
  55. data/lib/em_algorithm/convergence/.likelihood.rb.swp +0 -0
  56. data/lib/em_algorithm/convergence/check_method.rb +4 -0
  57. data/lib/em_algorithm/convergence/check_method.rb~ +0 -0
  58. data/lib/em_algorithm/convergence/chi_square.rb +40 -0
  59. data/lib/em_algorithm/convergence/chi_square.rb~ +40 -0
  60. data/lib/em_algorithm/convergence/likelihood.rb +35 -0
  61. data/lib/em_algorithm/convergence/likelihood.rb~ +35 -0
  62. data/lib/em_algorithm/models/.gaussian.rb.swp +0 -0
  63. data/lib/em_algorithm/models/.md_gaussian.rb.swp +0 -0
  64. data/lib/em_algorithm/models/.mixture.rb.swp +0 -0
  65. data/lib/em_algorithm/models/.model.rb.swp +0 -0
  66. data/lib/em_algorithm/models/gaussian.rb +47 -0
  67. data/lib/em_algorithm/models/gaussian.rb~ +47 -0
  68. data/lib/em_algorithm/models/md_gaussian.rb +67 -0
  69. data/lib/em_algorithm/models/md_gaussian.rb~ +67 -0
  70. data/lib/em_algorithm/models/mixture.rb +122 -0
  71. data/lib/em_algorithm/models/mixture.rb~ +122 -0
  72. data/lib/em_algorithm/models/model.rb +19 -0
  73. data/lib/em_algorithm/models/model.rb~ +19 -0
  74. data/lib/ruby-em_algorithm.rb +3 -0
  75. data/lib/ruby-em_algorithm/version.rb +3 -0
  76. data/ruby-em_algorithm.gemspec +21 -0
  77. data/spec/spec_helper.rb +9 -0
  78. metadata +178 -0
@@ -0,0 +1,19 @@
1
+ module EMAlgorithm
2
+ class Model
3
+ # round digit for gnuplot
4
+ DIGIT = 6
5
+
6
+ def pdf(x)
7
+ # method "probability_density_function" must be implemented
8
+ probability_density_function(x)
9
+ end
10
+
11
+ def value_distribution(const, x)
12
+ const * pdf(x)
13
+ end
14
+
15
+ def value_distribution_to_gnuplot(const)
16
+ "#{const.round(DIGIT)}*(#{to_gnuplot(:mixture_only)})"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module EMAlgorithm
2
+ class Model
3
+ # round digit for gnuplot
4
+ DIGIT = 6
5
+
6
+ def pdf(x)
7
+ # method "probability_density_function" must be implemented
8
+ probability_density_function(x)
9
+ end
10
+
11
+ def value_distribution(const, x)
12
+ const * pdf(x)
13
+ end
14
+
15
+ def value_distribution_to_gnuplot(const)
16
+ "#{const.round(DIGIT)}*(#{to_gnuplot(:mixture_only)})"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ require 'gsl'
2
+ require "ruby-em_algorithm/version"
3
+ require 'em_algorithm/base'
@@ -0,0 +1,3 @@
1
+ module EMAlgorithm
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/ruby-em_algorithm/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.add_development_dependency 'rake'
6
+ gem.add_development_dependency 'rspec', '~> 2.8'
7
+ gem.add_development_dependency 'gsl'
8
+
9
+ gem.authors = ["Jun Sugahara", "Toyokazu Akiyama"]
10
+ gem.email = ["toyokazu@gmail.com"]
11
+ gem.description = %q{EMAlgorithm for Ruby}
12
+ gem.summary = %q{EMAlgorithm for Ruby}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `find . -not \\( -regex ".*\\.git.*" -o -regex "\\./pkg.*" -o -regex "\\./spec.*" \\)`.split("\n").map{ |f| f.gsub(/^.\//, '') }
16
+ gem.test_files = `find spec/*`.split("\n")
17
+ gem.name = "ruby-em_algorithm"
18
+ gem.require_paths = ["lib"]
19
+ gem.version = EMAlgorithm::VERSION
20
+
21
+ end
@@ -0,0 +1,9 @@
1
+ require 'rspec'
2
+ require 'rack/test'
3
+ require 'ruby-em_algorithm/version'
4
+ require 'ruby-em_algorithm'
5
+
6
+ RSpec.configure do |config|
7
+ config.include Rack::Test::Methods
8
+ config.color_enabled = true
9
+ end
metadata ADDED
@@ -0,0 +1,178 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-em_algorithm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jun Sugahara
9
+ - Toyokazu Akiyama
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-01-22 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rake
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: rspec
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: '2.8'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '2.8'
47
+ - !ruby/object:Gem::Dependency
48
+ name: gsl
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ description: EMAlgorithm for Ruby
64
+ email:
65
+ - toyokazu@gmail.com
66
+ executables: []
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - example/.ex1.rb.swp
71
+ - example/.ex2.rb.swp
72
+ - example/.ex3-tmp.rb.swp
73
+ - example/.ex3.rb.swp
74
+ - example/data/2dim-gmm-new.txt
75
+ - example/data/2dim-gmm-simple.txt
76
+ - example/data/2dim-gmm-test.txt
77
+ - example/data/2dim-gmm-test2.txt
78
+ - example/data/2dim-gmm-test3.csv
79
+ - example/data/2dim-gmm-test3.txt
80
+ - example/data/2dim-gmm-test4.csv
81
+ - example/data/2dim-gmm-test4.txt
82
+ - example/data/2dim-gmm-without_weight-small.txt
83
+ - example/data/2dim-gmm-without_weight.txt
84
+ - example/data/2dim-gmm.txt
85
+ - example/data/gmm-new.txt
86
+ - example/data/gmm-simple.txt
87
+ - example/data/gmm.txt
88
+ - example/data/old-gmm.txt
89
+ - example/ex1.rb
90
+ - example/ex1.rb~
91
+ - example/ex2.rb
92
+ - example/ex2.rb~
93
+ - example/ex3-tmp.rb
94
+ - example/ex3-tmp.rb~
95
+ - example/ex3.rb
96
+ - example/ex3.rb~
97
+ - example/tools/.2dim.rb.swp
98
+ - example/tools/2dim.rb
99
+ - example/tools/2dim.rb~
100
+ - example/tools/boxmuller.rb
101
+ - example/tools/boxmuller.rb~
102
+ - example/tools/conv_from_yaml.rb
103
+ - example/tools/conv_from_yaml_to_csv.rb
104
+ - example/tools/conv_to_yaml.rb
105
+ - example/tools/ellipsoid.gnuplot
106
+ - example/tools/ellipsoid.gnuplot~
107
+ - example/tools/histogram.rb
108
+ - example/tools/histogram2d.rb
109
+ - example/tools/histogram2d.rb~
110
+ - example/tools/kmeans.rb
111
+ - example/tools/mean.rb
112
+ - example/tools/table.data
113
+ - example/tools/tmp.txt
114
+ - example/tools/xmeans.R
115
+ - example/tools/xmeans.rb
116
+ - Gemfile
117
+ - Gemfile.lock
118
+ - lib/em_algorithm/.base.rb.swp
119
+ - lib/em_algorithm/base.rb
120
+ - lib/em_algorithm/base.rb~
121
+ - lib/em_algorithm/convergence/.chi_square.rb.swp
122
+ - lib/em_algorithm/convergence/.likelihood.rb.swp
123
+ - lib/em_algorithm/convergence/check_method.rb
124
+ - lib/em_algorithm/convergence/check_method.rb~
125
+ - lib/em_algorithm/convergence/chi_square.rb
126
+ - lib/em_algorithm/convergence/chi_square.rb~
127
+ - lib/em_algorithm/convergence/likelihood.rb
128
+ - lib/em_algorithm/convergence/likelihood.rb~
129
+ - lib/em_algorithm/models/.gaussian.rb.swp
130
+ - lib/em_algorithm/models/.md_gaussian.rb.swp
131
+ - lib/em_algorithm/models/.mixture.rb.swp
132
+ - lib/em_algorithm/models/.model.rb.swp
133
+ - lib/em_algorithm/models/gaussian.rb
134
+ - lib/em_algorithm/models/gaussian.rb~
135
+ - lib/em_algorithm/models/md_gaussian.rb
136
+ - lib/em_algorithm/models/md_gaussian.rb~
137
+ - lib/em_algorithm/models/mixture.rb
138
+ - lib/em_algorithm/models/mixture.rb~
139
+ - lib/em_algorithm/models/model.rb
140
+ - lib/em_algorithm/models/model.rb~
141
+ - lib/ruby-em_algorithm/version.rb
142
+ - lib/ruby-em_algorithm.rb
143
+ - Rakefile
144
+ - README.md
145
+ - ruby-em_algorithm.gemspec
146
+ - spec/spec_helper.rb
147
+ homepage: ''
148
+ licenses: []
149
+ post_install_message:
150
+ rdoc_options: []
151
+ require_paths:
152
+ - lib
153
+ required_ruby_version: !ruby/object:Gem::Requirement
154
+ none: false
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ segments:
160
+ - 0
161
+ hash: -1323721423323207439
162
+ required_rubygems_version: !ruby/object:Gem::Requirement
163
+ none: false
164
+ requirements:
165
+ - - ! '>='
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ segments:
169
+ - 0
170
+ hash: -1323721423323207439
171
+ requirements: []
172
+ rubyforge_project:
173
+ rubygems_version: 1.8.24
174
+ signing_key:
175
+ specification_version: 3
176
+ summary: EMAlgorithm for Ruby
177
+ test_files:
178
+ - spec/spec_helper.rb