Sha256: f81a6cc574bdf7294adfcc3e64114a30b49159b806a72902df249443d9fa4de5
Contents?: true
Size: 836 Bytes
Versions: 7
Compression:
Stored size: 836 Bytes
Contents
# frozen_string_literal: true require 'rumale/base/evaluator' module Rumale module EvaluationMeasure # MedianAbsoluteError is a class that calculates the median absolute error. # # @example # require 'rumale/evaluation_measure/median_absolute_error' # # evaluator = Rumale::EvaluationMeasure::MedianAbsoluteError.new # puts evaluator.score(ground_truth, predicted) class MedianAbsoluteError include ::Rumale::Base::Evaluator # Calculate median absolute error. # # @param y_true [Numo::DFloat] (shape: [n_samples]) Ground truth target values. # @param y_pred [Numo::DFloat] (shape: [n_samples]) Estimated target values. # @return [Float] Median absolute error. def score(y_true, y_pred) (y_true - y_pred).abs.median end end end end
Version data entries
7 entries across 7 versions & 1 rubygems