Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
21 lines (18 sloc) 688 Bytes
"""Median Absolute Error for regression"""
import typing
import numpy as np
from h2oaicore.metrics import CustomScorer
from sklearn.metrics import median_absolute_error
class MyMedianAbsoluteError(CustomScorer):
_description = "My Median Absolute Error Scorer for Regression."
_regression = True
_maximize = False
_perfect_score = 0
_display_name = "MEDAE"
_supports_sample_weight = False
def score(self,
actual: np.array,
predicted: np.array,
sample_weight: typing.Optional[np.array] = None,
labels: typing.Optional[np.array] = None) -> float:
return median_absolute_error(actual, predicted)
You can’t perform that action at this time.