Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add weights for the pearson, spearman, and r2_score #1235

Open
DomInvivo opened this issue Sep 23, 2022 · 5 comments · May be fixed by #1759
Open

Add weights for the pearson, spearman, and r2_score #1235

DomInvivo opened this issue Sep 23, 2022 · 5 comments · May be fixed by #1759
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@DomInvivo
Copy link

🚀 Feature

We can provide a weight Tensor to the regression coefficients, such as pearson, spearman, and r2_score

Motivation

It should be relatively simple to add weights to these computations. And it can be useful in many contexts, including masking by providing 0-weights, or adding more weights to the relevant sample/target pairs.

Pitch

Adding weights parameter in pearson, spearman, and r2_score. The parameter weights should be either None, 1D ,or 2D.

Alternatives

None

Additional context

See weighted pearsonr. For the spearmanr, it should be identical, since spearman is the correlation of the rank.

For the r2_score, there exist some implementations for example in sklearn, but it would be better to provide either a 1D or 2D matrix, and it would be broadcasted to the same shape as preds / target. instead of forcing sample_weight to be 1D.

@DomInvivo DomInvivo added the enhancement New feature or request label Sep 23, 2022
@Borda
Copy link
Member

Borda commented Oct 19, 2022

Sounds good to me, @DomInvivo would you interested in implementing it?
cc: @SkafteNicki

@DomInvivo
Copy link
Author

@Borda It's no longer a priority for me, I found a way to achieve what I needed since I only needed weights of 1 and 0. Unfortunately, I do not have time at the moment but could consider it later.

@stale stale bot added the wontfix label Jan 7, 2023
@Lightning-AI Lightning-AI deleted a comment from stale bot Jan 8, 2023
@Borda Borda added the good first issue Good for newcomers label Jan 8, 2023
@stale stale bot removed wontfix labels Jan 8, 2023
@matsumotosan
Copy link
Member

@Borda is this still available? I would be interested in working on it.

@justusschock
Copy link
Member

@matsumotosan Yes it is. Feel free to gibe it a shot and we would appreciate a contribution. If you're getting stuck somewhere let us know. Also open a draft PR as early as possible so that we can review early on :)

@stale stale bot added the wontfix label Mar 18, 2023
@Lightning-AI Lightning-AI deleted a comment from stale bot Mar 18, 2023
@stale stale bot removed the wontfix label Mar 18, 2023
@matsumotosan matsumotosan linked a pull request May 6, 2023 that will close this issue
4 tasks
@stale
Copy link

stale bot commented Aug 12, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@Borda @justusschock @matsumotosan @DomInvivo and others