rb_prob 0.0.2 → 0.0.3

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.
Files changed (2) hide show
  1. data/lib/prob.rb +8 -8
  2. metadata +3 -3
@@ -90,9 +90,9 @@ module Probably
90
90
  # to compute normalization of bayes theorem
91
91
  def normalize
92
92
  if @map[nil] > 0.0
93
- filter { |value| value != nil }
93
+ self.filter { |value| value != nil }
94
94
  else
95
- @self
95
+ self
96
96
  end
97
97
  end
98
98
 
@@ -131,17 +131,17 @@ module Probably
131
131
  @map.each do |value, prob|
132
132
  tmp[yield(value)] += prob
133
133
  end
134
- Distribution.new(:MAP, tmp)
134
+ self.class.new(:MAP, tmp)
135
135
  end
136
136
 
137
137
  def filter
138
- Distribution.new :MAP, @map.reject { |value,prob|
138
+ self.class.new :MAP, @map.reject { |value,prob|
139
139
  !(yield value)
140
140
  }
141
141
  end
142
142
 
143
143
  def reject
144
- Distribution.new :MAP, @map.reject { |value, prob|
144
+ self.class.new :MAP, @map.reject { |value, prob|
145
145
  yield value
146
146
  }
147
147
  end
@@ -161,11 +161,11 @@ module Probably
161
161
  tmp[value] += p1 * p2
162
162
  end
163
163
  end
164
- Distribution.new(:MAP, tmp)
164
+ self.class.new(:MAP, tmp)
165
165
  end
166
166
 
167
167
  def dep
168
- Distribution.new :MAP, block1(Hash.new(0)) {|m|
168
+ self.class.new :MAP, block1(Hash.new(0)) {|m|
169
169
  @map.each do |key, p1|
170
170
  tmp = yield key
171
171
  if tmp != nil
@@ -243,7 +243,7 @@ module Probably
243
243
  self.each do |prob, value|
244
244
  tmp[value] = if prob > new_min then prob else new_min end
245
245
  end
246
- Distribution.new :MAP, tmp
246
+ self.class.new :MAP, tmp
247
247
  end
248
248
  end
249
249
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Steffen Siering
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-24 00:00:00 +01:00
17
+ date: 2010-03-27 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies: []
20
20