You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2013/09/10 18:10:28 UTC
svn commit: r1521536 - /incubator/climate/trunk/ocw/metrics.py
Author: joyce
Date: Tue Sep 10 16:10:28 2013
New Revision: 1521536
URL: http://svn.apache.org/r1521536
Log:
CLIMATE-285, 286 - Add BinaryMetric base class. Remove __init__ from UnaryMetric base class.
Modified:
incubator/climate/trunk/ocw/metrics.py
Modified: incubator/climate/trunk/ocw/metrics.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw/metrics.py?rev=1521536&r1=1521535&r2=1521536&view=diff
==============================================================================
--- incubator/climate/trunk/ocw/metrics.py (original)
+++ incubator/climate/trunk/ocw/metrics.py Tue Sep 10 16:10:28 2013
@@ -55,10 +55,7 @@ class UnaryMetric():
'''Abstract Base Class from which all unary metrics inherit.'''
__metaclass__ = ABCMeta
- def __init__(self):
- pass
-
- @abstactmethod
+ @abstractmethod
def run(self, target_dataset):
'''Run the metric for a given target dataset.
@@ -69,6 +66,25 @@ class UnaryMetric():
'''
+class BinaryMetric():
+ '''Abstract Base Class from which all binary metrics inherit.'''
+ __metaclass__ = ABCMeta
+
+ @abstractmethod
+ def run(self, ref_dataset, target_dataset):
+ '''Run the metric for the given reference and target datasets.
+
+ :param ref_dataset: The Dataset to use as the reference dataset when
+ running the evaluation.
+ :type ref_dataset: Dataset
+ :param target_dataset: The Dataset to use as the target dataset when
+ running the evaluation.
+
+ :returns: The result of evaluation the metric on the reference and
+ target dataset.
+ '''
+
+
class Bias(Metric):
'''Calculate the bias between a reference and target dataset.'''