lib/eps/evaluators/linear_regression.rb in eps-0.3.2 vs lib/eps/evaluators/linear_regression.rb in eps-0.3.3
- old
+ new
@@ -17,13 +17,14 @@
raise "Missing data in #{k}" if !x.columns[k] || x.columns[k].any?(&:nil?)
case type
when "categorical"
x.columns[k].each_with_index do |xv, i|
- scores[i] += @coefficients[[k, xv]].to_f
+ # TODO clean up
+ scores[i] += (@coefficients[[k, xv]] || @coefficients[[k, xv.to_s]]).to_f
end
when "text"
- encoder = TextEncoder.new(@text_features[k])
+ encoder = TextEncoder.new(**@text_features[k])
counts = encoder.transform(x.columns[k])
coef = {}
@coefficients.each do |k2, v|
next unless k2.is_a?(Array) && k2.first == k
coef[k2.last] = v