lib/eps/evaluators/naive_bayes.rb in eps-0.3.2 vs lib/eps/evaluators/naive_bayes.rb in eps-0.3.3
- old
+ new
@@ -36,10 +36,11 @@
@features.each do |k, type|
case type
when "categorical"
x.columns[k].each_with_index do |xi, i|
- vc = probabilities[:conditional][k][xi]
+ # TODO clean this up
+ vc = probabilities[:conditional][k][xi] || probabilities[:conditional][k][xi.to_s]
# unknown value if not vc
if vc
denom = probabilities[:conditional][k].map { |k, v| v[c] }.sum.to_f
p2 = vc[c].to_f / denom