-
-
Notifications
You must be signed in to change notification settings - Fork 26.4k
Description
For metadata routing, meta-estimators define method mappings through this API:
router = MetadataRouter(...).add(
method_mapping=MethodMapping()
.add(callee="fit", caller="fit")
.add(callee="transform", caller="fit")
.add(callee="transform", caller="predict"),
)Currently, we have a shortcut to map every available method dynamically:
MetadataRouter(...).add(method_mapping="one-to-one")And a shortcut to do a single "one-to-one" mapping:
MetadataRouter(...).add(method_mapping="score")#28422 proposes to remove both theses shortcuts. The proposal makes sense as it forces everything to be explicit and there is only one way to define the method mappings.
On the other hand, I think a majority of the time a meta-estimator does "one-to-one" method mappings. In #28422 (comment), I proposed this API:
# Single string for a single mapping:
MethodMapping().add_one_to_one("score")
# Add a second mapping by using a list:
MethodMapping().add_one_to_one(["score", "predict"])I'm mostly considering third party meta-estimator developers and how to make it easier for them to adopt the metadata routing API and define these mappings. If add_one_to_one handles a majority of the use cases, I think it's worth introducing even if it a second way to specify the mappings.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status