Skip to content

Commit

Permalink
Addressed #444, but the test still doesn't follow the text
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethshsu committed Apr 24, 2024
1 parent 304f465 commit 228952b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions chainladder/core/correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,18 @@ def pZlower(z: int, n: int, p: float = 0.5) -> float:
lr = triangle.link_ratio

# Rank link ratios for each column
m1 = xp.apply_along_axis(func1d=rankdata, axis=2, arr=lr.values) * (
lr.values * 0 + 1
m1 = xp.apply_along_axis(
func1d=rankdata,
axis=2,
arr=lr.values,
) * (lr.values * 0 + 1)

med = xp.nanmedian(
a=m1,
axis=2,
keepdims=True,
)

med = xp.nanmedian(a=m1, axis=2, keepdims=True, nan_policy="omit")
print("med:\n", med)
# print("med:\n", med)

m1large = (xp.nan_to_num(m1) > med) + (lr.values * 0)
m1small = (xp.nan_to_num(m1) < med) + (lr.values * 0)
Expand Down

0 comments on commit 228952b

Please sign in to comment.