Skip to content

Commit 2ed9974

Browse files
committed
Fix a bug in the computation of hgr
1 parent baebb29 commit 2ed9974

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fair_forge/_metrics_common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ def renyi_correlation(x: NDArray[np.int32], y: NDArray[np.int32]) -> np.float64:
1515
total = len(x)
1616
assert total == len(y)
1717

18-
joint = np.empty((len(x_vals), len(y_vals)))
18+
joint = np.empty((len(x_vals), len(y_vals)), dtype=np.float64)
1919

2020
for i, x_val in enumerate(x_vals):
2121
for k, y_val in enumerate(y_vals):
2222
# count how often x_val and y_val co-occur
23-
joint[i, k] = np.count_nonzero((x == x_val) & (y == y_val)).item() / total
23+
joint[i, k] = np.count_nonzero((x == x_val) & (y == y_val)) / total
2424

2525
marginal_rows = np.sum(joint, axis=0, keepdims=True)
2626
marginal_cols = np.sum(joint, axis=1, keepdims=True)

0 commit comments

Comments
 (0)