lib/eps/evaluators/linear_regression.rb in eps-0.4.1 vs lib/eps/evaluators/linear_regression.rb in eps-0.5.0
- old
+ new
@@ -2,11 +2,11 @@
module Evaluators
class LinearRegression
attr_reader :features
def initialize(coefficients:, features:, text_features:)
- @coefficients = Hash[coefficients.map { |k, v| [k.is_a?(Array) ? [k[0].to_s, k[1]] : k.to_s, v] }]
+ @coefficients = coefficients.to_h { |k, v| [k.is_a?(Array) ? [k[0].to_s, k[1]] : k.to_s, v] }
@features = features
@text_features = text_features || {}
end
def predict(x, probabilities: false)
@@ -48,10 +48,10 @@
scores
end
def coefficients
- Hash[@coefficients.map { |k, v| [Array(k).join.to_sym, v] }]
+ @coefficients.to_h { |k, v| [Array(k).join.to_sym, v] }
end
end
end
end