Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use _check_sample_weight to consistently validate sample_weight #15358

Closed
@NicolasHug

Description

@NicolasHug

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions