lib/eps.rb in eps-0.2.1 vs lib/eps.rb in eps-0.3.0

- old
+ new

@@ -1,19 +1,43 @@ # dependencies -require "matrix" +require "bigdecimal" require "json" +require "lightgbm" +require "matrix" +require "nokogiri" # modules require "eps/base" require "eps/base_estimator" +require "eps/data_frame" +require "eps/evaluators/linear_regression" +require "eps/evaluators/lightgbm" +require "eps/evaluators/naive_bayes" +require "eps/evaluators/node" +require "eps/label_encoder" +require "eps/lightgbm" require "eps/linear_regression" +require "eps/metrics" require "eps/model" require "eps/naive_bayes" +require "eps/statistics" +require "eps/text_encoder" +require "eps/utils" require "eps/version" module Eps - def self.metrics(actual, estimated) - Eps::Model.metrics(actual, estimated) + def self.metrics(y_true, y_pred) + if Utils.column_type(y_true, "actual") == "numeric" + { + rmse: Metrics.rmse(y_true, y_pred), + mae: Metrics.mae(y_true, y_pred), + me: Metrics.me(y_true, y_pred) + } + else + { + accuracy: Metrics.accuracy(y_true, y_pred) + } + end end # backwards compatibility Regressor = Model end