Sha256: 47ef780ed143cadfccac59958c24cf4cbe8325d56bf90449cdebe32f166dd575
Contents?: true
Size: 927 Bytes
Versions: 7
Compression:
Stored size: 927 Bytes
Contents
# frozen_string_literal: true require 'rumale/base/evaluator' module Rumale module EvaluationMeasure # MeanSquaredLogError is a class that calculates the mean squared logarithmic error. # # @example # require 'rumale/evaluation_measure/mean_squared_log_error' # # evaluator = Rumale::EvaluationMeasure::MeanSquaredLogError.new # puts evaluator.score(ground_truth, predicted) class MeanSquaredLogError include ::Rumale::Base::Evaluator # Calculate mean squared logarithmic error. # # @param y_true [Numo::DFloat] (shape: [n_samples, n_outputs]) Ground truth target values. # @param y_pred [Numo::DFloat] (shape: [n_samples, n_outputs]) Estimated target values. # @return [Float] Mean squared logarithmic error. def score(y_true, y_pred) ((Numo::NMath.log(y_true + 1) - Numo::NMath.log(y_pred + 1))**2).mean end end end end
Version data entries
7 entries across 7 versions & 1 rubygems