-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Issues with negative values in sample_weight #12464
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
We had people from high energy physics argue strongly in the other direction. |
also ping @alexpearce |
Apologies I missed that other thread; I did a quick search but it didn't show up. Please feel free to close this issue and continue the discussion on the other one should you wish to. |
Thanks for the ping @amueller. I still think the feature is very useful. Samples with negative weights play a critical role in the area of high energy physics that I work in. But one does need to understand that one can easily arrive at nonsensical results when using them, so having a warning/error is probably a good sanity check for many use-cases. I think a global flag is a nice idea, as then the user has to admit "I think I know what I'm doing" and has to interpret any results accordingly. |
Would like to check the status of this open item, having a global flag enabling negative sample weight is helpful in my use case. Alternatively, I uses a direct implementation to allow -ve weights:
|
Description
I am not sure what the interpretation of a negative value in
sample_weight
might be and why this should be supported, but I believe that there should be constraints in using non-negative values in several cases; the use of negative ones can lead to some very strange results.See an example below for
r2_score
where the use of negative weights yields a value larger than one, which really does not make sense.Steps/Code to Reproduce
Expected Results
Something smaller or equal to 1.0
Actual Results
1.1919195778883198
Versions
System:
python: 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 11:27:44) [MSC v.1900 64 bit (AMD64)]
executable: C:\Users\nak142\Miniconda3\envs\sklearn_contrib\pythonw.exe
machine: Windows-10-10.0.17134-SP0
BLAS:
macros: SCIPY_MKL_H=None, HAVE_CBLAS=None
lib_dirs: C:/Users/nak142/Miniconda3/envs/sklearn_contrib\Library\lib
cblas_libs: mkl_rt
Python deps:
pip: 10.0.1
setuptools: 40.0.0
sklearn: 0.21.dev0
numpy: 1.15.0
scipy: 1.1.0
Cython: 0.28.5
pandas: None
The text was updated successfully, but these errors were encountered: