-
Notifications
You must be signed in to change notification settings - Fork 472
Description
🚀 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.