Skip to content

ENH: Implement Kendall discordance#110

Open
fbourgey wants to merge 3 commits intoscipy:mainfrom
fbourgey:kendall_dis
Open

ENH: Implement Kendall discordance#110
fbourgey wants to merge 3 commits intoscipy:mainfrom
fbourgey:kendall_dis

Conversation

@fbourgey
Copy link
Copy Markdown
Member

Reference issue

Toward #98

What does this implement/fix?

Implement Kendall discordance from _kendall_dis

Comment thread tests/xsf_tests/test_kendall_dis.cpp Outdated
Copy link
Copy Markdown
Contributor

@mdhaber mdhaber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a faithful translation, and the tests are OK with my if they're ok with @steppi.

The tests are a little light, so I would suggest a few larger, non-trivial examples (probably randomly generated), and also checking behavior when there are tied elements. Maybe run kendalltau with randomly generated x and y (with and without the possibilities of ties in x, ties in y, and both) up until you get to dis = _kendall_dis(x, y) # discordant pairs to see what sort of input _kendall_dis can receive.

Thank you!

@steppi if we use this in SciPy, can it automatically be vectorized to work along the last axis?

@fbourgey
Copy link
Copy Markdown
Member Author

This looks like a faithful translation, and the tests are OK with my if they're ok with @steppi.

The tests are a little light, so I would suggest a few larger, non-trivial examples (probably randomly generated), and also checking behavior when there are tied elements. Maybe run kendalltau with randomly generated x and y (with and without the possibilities of ties in x, ties in y, and both) up until you get to dis = _kendall_dis(x, y) # discordant pairs to see what sort of input _kendall_dis can receive.

Thank you!

@steppi if we use this in SciPy, can it automatically be vectorized to work along the last axis?

Thanks @mdhaber, I'll improve the tests.

@fbourgey fbourgey changed the title ENH: Implement Kendall discordance kendall_dis ENH: Implement Kendall discordance Mar 19, 2026
@fbourgey
Copy link
Copy Markdown
Member Author

@mdhaber I have improved the tests with randomly-generated and tie/no-tie scenarios for x and y.

Can you detail exactly what you meant with

[...] up until you get to dis = _kendall_dis(x, y) # discordant pairs to see what sort of input _kendall_dis can receive.

@mdhaber
Copy link
Copy Markdown
Contributor

mdhaber commented Mar 23, 2026

Can you detail exactly what you meant with...

It's probably not very important. I just couldn't remember exactly what could happen with the input to _kendall_dis - I think both x and y are ranks, but I couldn't remember whether there could be tied ranks within x, tied ranks within y, and tied ranks between the two. A little bit of thinking / reading code could help remind me, but the option I was suggesting was generating random input (with ties) to scipy.stats.kendalltau and seeing what data gets passed to _kendall_dis.

@fbourgey
Copy link
Copy Markdown
Member Author

fbourgey commented Apr 3, 2026

Can you detail exactly what you meant with...

It's probably not very important. I just couldn't remember exactly what could happen with the input to _kendall_dis - I think both x and y are ranks, but I couldn't remember whether there could be tied ranks within x, tied ranks within y, and tied ranks between the two. A little bit of thinking / reading code could help remind me, but the option I was suggesting was generating random input (with ties) to scipy.stats.kendalltau and seeing what data gets passed to _kendall_dis.

@mdhaber OK, thanks. Do you think the current test is sufficient? Happy to expand on it if needed.

@fbourgey fbourgey added the enhancement New feature or request label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants