Skip to content

Commit

Permalink
Fix remaining issues in docs-dev branch (#1294)
Browse files Browse the repository at this point in the history
* Fix pydocstyle error in benchmarking methods

* Fix docstring indentation
  • Loading branch information
RNKuhns committed Aug 14, 2021
1 parent 53a3022 commit cafb5e5
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions sktime/benchmarking/metrics.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
"""Implements metrics for pairwise and aggregate comparison."""
__all__ = ["PairwiseMetric", "AggregateMetric"]
__author__ = ["Viktor Kazakov", "Markus Löning"]

Expand All @@ -8,12 +9,24 @@


class PairwiseMetric(BaseMetric):
"""Compute metric pairwise.
Parameters
----------
func : function
Function that computes the pairwise metric.
name : str
Name of the metric
"""

def __init__(self, func, name=None, **kwargs):
name = func.__name__ if name is None else name
self.func = func
super(PairwiseMetric, self).__init__(name=name, **kwargs)

def compute(self, y_true, y_pred):
"""Compute metric and standard error."""
# compute mean
mean = self.func(y_true, y_pred)

Expand All @@ -30,6 +43,17 @@ def compute(self, y_true, y_pred):


class AggregateMetric(BaseMetric):
"""Compute metric pairwise.
Parameters
----------
func : function
Function that computes the pairwise metric.
name : str
Name of the metric
"""

def __init__(self, func, method="jackknife", name=None, **kwargs):
allowed_methods = ("jackknife",)
if method not in allowed_methods:
Expand All @@ -45,7 +69,7 @@ def __init__(self, func, method="jackknife", name=None, **kwargs):
super(AggregateMetric, self).__init__(name=name, **kwargs)

def compute(self, y_true, y_pred):
"""Compute metric and standard error
"""Compute metric and standard error.
References
----------
Expand Down Expand Up @@ -83,7 +107,7 @@ def compute(self, y_true, y_pred):

@staticmethod
def _compute_jackknife_stderr(x):
"""Compute standard error of jacknife samples
"""Compute standard error of jacknife samples.
References
----------
Expand All @@ -95,7 +119,7 @@ def _compute_jackknife_stderr(x):

@staticmethod
def _jackknife_resampling(x):
"""Performs jackknife resampling on numpy arrays.
"""Perform jackknife resampling on numpy arrays.
Jackknife resampling is a technique to generate 'n' deterministic
samples
Expand Down

0 comments on commit cafb5e5

Please sign in to comment.