GPy/benchmarks/regression/evaluation.py

23 lines
498 B
Python
Raw Normal View History

2015-08-27 17:04:52 +01:00
# Copyright (c) 2015, Zhenwen Dai
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import abc
import numpy as np
2023-10-16 18:53:11 +02:00
2015-08-27 17:04:52 +01:00
class Evaluation(object):
__metaclass__ = abc.ABCMeta
2023-10-16 18:53:11 +02:00
2015-08-27 17:04:52 +01:00
@abc.abstractmethod
def evaluate(self, gt, pred):
"""Compute a scalar for access the performance"""
return None
2023-10-16 18:53:11 +02:00
2015-08-27 17:04:52 +01:00
class RMSE(Evaluation):
"Rooted Mean Square Error"
2023-10-16 18:53:11 +02:00
name = "RMSE"
2015-08-27 17:04:52 +01:00
def evaluate(self, gt, pred):
2023-10-16 18:53:11 +02:00
return np.sqrt(np.square(gt - pred).astype(float).mean())