-
Notifications
You must be signed in to change notification settings - Fork 409
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
Comments
Sounds good to me, @DomInvivo would you interested in implementing it? |
@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. |
@Borda is this still available? I would be interested in working on it. |
@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 :) |
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. |
🚀 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 inpearson
,spearman
, andr2_score
. The parameterweights
should be eitherNone
, 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.The text was updated successfully, but these errors were encountered: