Skip to content

Commit

Permalink
Issue/211/two metric fixes (#212)
Browse files Browse the repository at this point in the history
* cdeloss metric_output_type = MetricOutputType.single_value

* outlier return as np.array instead of a list
  • Loading branch information
eacharles authored Nov 27, 2023
1 parent 8386258 commit 2258988
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/qp/metrics/concrete_metric_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class CDELossMetric(DistToPointMetric):
"""Conditional density loss"""

metric_name = "cdeloss"
metric_output_type = MetricOutputType.one_value_per_distribution
metric_output_type = MetricOutputType.single_value
default_eval_grid = np.linspace(0, 2.5, 301)

def __init__(self, eval_grid: list = default_eval_grid, **kwargs) -> None:
Expand Down
2 changes: 1 addition & 1 deletion src/qp/metrics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def calculate_outlier_rate(p, lower_limit=0.0001, upper_limit=0.9999):
except ValueError: #pragma: no cover - unittest coverage for _check_ensemble_is_not_nested is complete
logging.warning("Each element in the ensemble `p` must be a single distribution.")

outlier_rates = [(dist.cdf(lower_limit) + (1. - dist.cdf(upper_limit)))[0][0] for dist in p]
outlier_rates = np.array([(dist.cdf(lower_limit) + (1. - dist.cdf(upper_limit)))[0][0] for dist in p])
return outlier_rates

def calculate_goodness_of_fit(estimate, reference, fit_metric='ks', num_samples=100, _random_state=None):
Expand Down

0 comments on commit 2258988

Please sign in to comment.