Class: SVMKit::EvaluationMeasure::MeanAbsoluteError
- Inherits:
-
Object
- Object
- SVMKit::EvaluationMeasure::MeanAbsoluteError
- Includes:
- Base::Evaluator
- Defined in:
- lib/svmkit/evaluation_measure/mean_absolute_error.rb
Overview
MeanAbsoluteError is a class that calculates the mean absolute error.
Instance Method Summary collapse
-
#score(y_true, y_pred) ⇒ Float
Calculate mean absolute error.
Instance Method Details
#score(y_true, y_pred) ⇒ Float
Calculate mean absolute error.
21 22 23 24 25 26 27 |
# File 'lib/svmkit/evaluation_measure/mean_absolute_error.rb', line 21 def score(y_true, y_pred) SVMKit::Validation.check_tvalue_array(y_true) SVMKit::Validation.check_tvalue_array(y_pred) raise ArgumentError, 'Expect to have the same size both y_true and y_pred.' unless y_true.shape == y_pred.shape (y_true - y_pred).abs.mean end |