Skip to content

SLEP006: default routing #26179

@adrinjalali

Description

@adrinjalali

In the context of:

we've also discussed the possibility of developing a default routing strategy for certain metadata. In most cases this is sample_weight and probably groups in scikit-learn itself.

This would mean, after the introduction of SLEP006, this code would work, and route sample_weight to every object which accepts it (since that's what we think is suitable in this case):

# The exact API is TBD
sklearn.set_config(enable_auto_routing=True)

GridSearchCV(
	LogisticRegression(), 
	scorer=a_scorer_supporting_sample_weight, ...
).fit(..., sample_weight=sw)

We can then decide whether or not we want the auto-routing to be enabled by default. One major thing to consider here is that with auto-routing enabled, behavior of the same code can change from version to version for two main reasons:

  • we change our mind / find bugs / etc in the routing, and how we want to route things
  • estimator A might not support sample_weight in version x, but starts supporting it in version x+1, and with default routing the behavior of the same code changes

Notes

  • auto-routing can always be overridden by the user, for more advanced usecases.
  • third party developers can use the same mechanism, for sample_weight or other metadata if they see fit
  • we might deem SLEP006: globally setting request values #26050 unnecessary if we develop this feature

cc @scikit-learn/core-devs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions