You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ampersand (&) symbol in the /hagelslag/evaluation/ProbabilityMetrics.py module's DictributedROC class update() function did not produce expected behavior. My interpretation is that np.count_nonzero((forecasts >= threshold) & (observations >= self.obs_threshold)) should yield the frequency of values where boolean values are true and intersect, but instead this yields for me the frequency of times either boolean array is true. I added a np.logical_and and it fixed this issue for me. Please let me know if you can replicate this issue, and if so, I can submit a pull request of my fix.
def update(self, forecasts, observations):
"""
Update the ROC curve with a set of forecasts and observations
Args:
forecasts: 1D array of forecast values
observations: 1D array of observation values.
"""
for t, threshold in enumerate(self.thresholds):
tp = np.count_nonzero((forecasts >= threshold) & (observations >= self.obs_threshold))
fp = np.count_nonzero((forecasts >= threshold) &
(observations < self.obs_threshold))
fn = np.count_nonzero((forecasts < threshold) &
(observations >= self.obs_threshold))
tn = np.count_nonzero((forecasts < threshold) &
(observations < self.obs_threshold))
self.contingency_tables.iloc[t] += [tp, fp, fn, tn]
The text was updated successfully, but these errors were encountered:
mariajmolina
changed the title
Issue with Probability Evaluation Metric Logical Function
Issue with Probability Evaluation Function
Jan 6, 2020
The ampersand (
&
) symbol in the /hagelslag/evaluation/ProbabilityMetrics.py module's DictributedROC class update() function did not produce expected behavior. My interpretation is thatnp.count_nonzero((forecasts >= threshold) & (observations >= self.obs_threshold))
should yield the frequency of values where boolean values are true and intersect, but instead this yields for me the frequency of times either boolean array is true. I added anp.logical_and
and it fixed this issue for me. Please let me know if you can replicate this issue, and if so, I can submit a pull request of my fix.The text was updated successfully, but these errors were encountered: