Skip to content

Commit

Permalink
Forcing the sum over a 2d array, otherwise the sum does not do what w…
Browse files Browse the repository at this point in the history
…e want.
  • Loading branch information
drewoldag committed Mar 2, 2024
1 parent 6a1dbae commit 7c39546
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/qp/metrics/concrete_metric_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def accumulate(self, estimate, reference):
def finalize(self, tuples):
# tuples is a list of tuples. The first value in the tuple is the Brier sum
# The second value is the number of PDFs
summed_terms = np.sum(tuples, axis=0)
summed_terms = np.sum(np.atleast_2d(tuples), axis=0)

# calculate the mean from the summed terms
return summed_terms[0] / summed_terms[1]
Expand Down Expand Up @@ -341,7 +341,7 @@ def accumulate(self, estimate, reference):
return (term1_sum, term2_sum, npdf)

def finalize(self, tuples):
summed_terms = np.sum(tuples, axis=0)
summed_terms = np.sum(np.atleast_2d(tuples), axis=0)
term1 = summed_terms[0] / summed_terms[2]
term2 = summed_terms[1] / summed_terms[2]
return term1 - 2 * term2

0 comments on commit 7c39546

Please sign in to comment.