Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Add a new class for Absolute Bias involving the function
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekiiest authored Jun 27, 2018
1 parent 4fd7d49 commit 8104a2b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ocw/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,28 @@ def run(self, ref_dataset, target_dataset):
:rtype: :class:`numpy.ndarray`
'''
return calc_bias(target_dataset.values, ref_dataset.values)


class AbsoluteBias(BinaryMetric):
'''Calculate the absolute bias between a reference and target dataset.'''

def run(self, ref_dataset, target_dataset):
'''Calculate the absolute bias between a reference and target dataset.
.. note::
Overrides BinaryMetric.run()
:param ref_dataset: The reference dataset to use in this metric run.
:type ref_dataset: :class:`dataset.Dataset`
:param target_dataset: The target dataset to evaluate against the
reference dataset in this metric run.
:type target_dataset: :class:`dataset.Dataset`
:returns: The absolute difference between the reference and target datasets.
:rtype: :class:`numpy.ndarray`
'''
return calc_absbias(target_dataset.values, ref_dataset.values)


class SpatialPatternTaylorDiagram(BinaryMetric):
Expand Down

0 comments on commit 8104a2b

Please sign in to comment.