Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Probability Evaluation Function #30

Open
mariajmolina opened this issue Jan 6, 2020 · 0 comments
Open

Issue with Probability Evaluation Function #30

mariajmolina opened this issue Jan 6, 2020 · 0 comments

Comments

@mariajmolina
Copy link
Contributor

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]
@mariajmolina mariajmolina changed the title Issue with Probability Evaluation Metric Logical Function Issue with Probability Evaluation Function Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant