question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use _check_sample_weight to consistently validate sample_weight

See original GitHub issue

We 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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:29 (27 by maintainers)

github_iconTop GitHub Comments

1reaction
MDouriezcommented, Nov 2, 2019
1reaction
salliewaleckacommented, Nov 2, 2019

Picking up KernelDensity with @fbchow

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found