Use _check_sample_weight to consistently validate sample_weight
See original GitHub issueWe recently introduced utils.validation._check_sample_weight
which returns a validated sample_weight
array.
We should use it consistently throughout the code base, instead of relying on custom and adhoc checks like check_consistent_lenght
or check_array
(which are now handled by _check_sample_weight
).
Here’s a list of the estimators/functions that could make use of it (mostly in fit
or partial_fit
):
- CalibratedClassifierCV
- DBSCAN
- DummyClassifier
- DummyRegressor
- BaseBagging
- BaseForest
- BaseGradientBoosting
- IsotonicRegression
- KernelRidge
- GaussianNB
- BaseDiscreteNB
- KernelDensity
- BaseDecisionTree
(I left-out the linear_model module because it seems more involved there)
Could be a decent sprint issue @amueller ?
To know where a given class is defined, use e.g. git grep -n "class DBSCAN"
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:29 (27 by maintainers)
Top Results From Across the Web
When is it appropriate to use sample_weights in keras?
I would suggest you try out unweighted classes, weighted classes and some under/over-sampling and check which gives the best validation results.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I took care of CalibratedClassifierCV (https://github.com/scikit-learn/scikit-learn/pull/15491) and KernelDensity (https://github.com/scikit-learn/scikit-learn/pull/15493) already
Picking up KernelDensity with @fbchow