Skip to content

Commit

Permalink
Update _stats.py
Browse files Browse the repository at this point in the history
Signed-off-by: Zishen Wang <[email protected]>
  • Loading branch information
zz11ss11zz authored Sep 21, 2024
1 parent b105c39 commit 37adfc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/maml/utils/_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ def power_mean(data: list[float], weights: list[float] | None = None, p: int = 1
assert abs(sum(weights) - 1) < 1e-3

if p == 0:
return np.prod([i**j for i, j in zip(data, weights, strict=False)]).item()
return np.prod([i**j for i, j in zip(data, weights)]).item()

s = np.sum([j * i**p for i, j in zip(data, weights, strict=False)])
s = np.sum([j * i**p for i, j in zip(data, weights)])
return s ** (1.0 / p)

@staticmethod
Expand Down

0 comments on commit 37adfc3

Please sign in to comment.