-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
Add sample weight support to more metrics #3450
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
Comments
I want to get involved in contributing to scikit-learn. This seems straightforward, would like to take it up. Let me know if this works and if this is still an issue that we want to be implemented. |
You can take any metric and add sample_weight support. Thanks @jatinshah ! |
But for any multilabel metrics, you may be better off waiting for #3395, On 28 July 2014 21:01, Arnaud Joly [email protected] wrote:
|
Thanks to @jatinshah, jaccard similarity support sample weight! |
I am working on adding sample_weight to log_loss. The implementation is straightforward, but tests are failing. log_loss input parameters are y_true as labels and y_pred as probabilities. However, the tests for sample_weights assume that both y_true and y_pred are labels. Is there a simple way to resolve this issue? |
I would say that the test need to be enhance/modify to take this new case into account. |
OK, modified the tests. Here is the pull request: #3531 |
For matthews_corrcoef_score, I need to replace numpy.corrcoef with a weighted correlation function. Since numpy does not have a weighted version, I am planning to place the function in utils/wcorrcoef.py and related unit tests in utils/tests/test_wcorrcoef.py. Does that work? Is there a better way to organize the code?
|
IMO keep it locally in metrics, unless you get a patch supporting sample On 6 August 2014 04:10, Jatin Shah [email protected] wrote:
|
Sample weight added to the log_loss thanks to @jatinshah in #3531. |
I am trying to add Second, I am unable to change
|
Those metrics doesn't support multi-class either by definition (samples averaged metrics) or it's not implemented. |
The micro-averaged roc auc doesn't support binary output (only multilabel output).
|
In order to use the average argument, you need to have multilabel data |
Here is a pull request for median_absolute_error. #3784 |
I am working on this issue, and currently focusing on the If we define normal hamming distance as: \sum_t \delta(y_t, z_t) we can add a transition weight, \sum weight(y_t, z_t) \delta(y_t, z_t) It would be nicer to add it to the as and then add it to the see example of this being used in |
If I understand correctly, what you suggest is to weight differently each dimension (here label) differently. The issue is about sample-wise weight. For instance,
While with
|
I'd like to begin contributing to scikit-learn, and I'm interested in adding sample weights to the confusion matrix, however I'd like to clarify how sample weights are applied here. Is it done by simply apllying the weight to each sample's corresponding cell (sample |
Yes, I think that's the correct understanding. On 24 December 2014 at 07:05, Bernardo Vecchia Stein <
|
Thanks @jnothman! I have finished changing the code, however the tests in |
I think confusion matrix is currently excluded from other invariance tests. On 25 December 2014 at 04:56, Bernardo Vecchia Stein <
|
@jatinshah Do you plan to go ahead with adding sample weight support to the |
@ragv I don't intend to work on it at the moment. Please go ahead and submit a PR |
Thanks! now that completes the todo ( counting the PRs raised for respective metrics ) |
@othersParticipantsOfParisSprint : I'm working on this one |
[MRG+1] partly fixed issue #3450 for hamming loss
Can somebody please explain the difference between:
I understand 'weighted'. It multiplies weight for each label to the accuracy for that label before taking the average. |
Your question does not belong on a development issue tracker. Please ask in
another forum, such as stack overflow.
|
@jnothman @glemaitre I think this issue can be closed as #17225 was the last piece of the puzzle. |
Thanks @lorentzenchr for pointing this out. Closing. |
Uh oh!
There was an error while loading. Please reload this page.
Most metrics now supports
sample_weights
except for the following one:Note that there is already a general test in
sklearn/metrics/tests/test_common.py
forsample_weight
.Ideally, it would be one pull request per metric to ease review.
The text was updated successfully, but these errors were encountered: