|
4 | 4 | In order to better understand the components implemented in this file, one
|
5 | 5 | needs to understand their relationship to one another.
|
6 | 6 |
|
7 |
| -The only relevant public API for end users are the ``set_{method}_request``, |
| 7 | +The only relevant public API for end users are the ``set_{method}_request`` methods, |
8 | 8 | e.g. ``estimator.set_fit_request(sample_weight=True)``. However, third-party
|
9 | 9 | developers and users who implement custom meta-estimators, need to deal with
|
10 | 10 | the objects implemented in this file.
|
|
59 | 59 |
|
60 | 60 | To give the above representation some structure, we use the following objects:
|
61 | 61 |
|
62 |
| -- ``(caller, callee)`` is a namedtuple called ``MethodPair`` |
| 62 | +- ``(caller=..., callee=...)`` is a namedtuple called ``MethodPair`` |
63 | 63 |
|
64 |
| -- The list of ``MethodPair`` stored in the ``mapping`` field is a |
65 |
| - ``MethodMapping`` object |
| 64 | +- The list of ``MethodPair`` stored in the ``mapping`` field of a `RouterMappingPair` is |
| 65 | + a ``MethodMapping`` object |
66 | 66 |
|
67 | 67 | - ``(mapping=..., router=...)`` is a namedtuple called ``RouterMappingPair``
|
68 | 68 |
|
@@ -686,25 +686,26 @@ def __str__(self):
|
686 | 686 | # This section includes all objects required for MetadataRouter which is used
|
687 | 687 | # in routers, returned by their ``get_metadata_routing``.
|
688 | 688 |
|
689 |
| -# This namedtuple is used to store a (mapping, routing) pair. Mapping is a |
690 |
| -# MethodMapping object, and routing is the output of `get_metadata_routing`. |
691 |
| -# MetadataRouter stores a collection of these namedtuples. |
| 689 | +# `RouterMappingPair` is used to store a (mapping, router) tuple where `mapping` is a |
| 690 | +# `MethodMapping` object and `router` is the output of `get_metadata_routing`. |
| 691 | +# `MetadataRouter` stores a collection of `RouterMappingPair` objects in its |
| 692 | +# `_route_mappings` attribute. |
692 | 693 | RouterMappingPair = namedtuple("RouterMappingPair", ["mapping", "router"])
|
693 | 694 |
|
694 |
| -# A namedtuple storing a single method route. A collection of these namedtuples |
695 |
| -# is stored in a MetadataRouter. |
| 695 | +# `MethodPair` is used to store a single method routing. `MethodMapping` stores a list |
| 696 | +# of `MethodPair` objects in its `_routes` attribute. |
696 | 697 | MethodPair = namedtuple("MethodPair", ["caller", "callee"])
|
697 | 698 |
|
698 | 699 |
|
699 | 700 | class MethodMapping:
|
700 | 701 | """Stores the mapping between caller and callee methods for a router.
|
701 | 702 |
|
702 | 703 | This class is primarily used in a ``get_metadata_routing()`` of a router
|
703 |
| - object when defining the mapping between a sub-object (a sub-estimator or a |
704 |
| - scorer) to the router's methods. It stores a collection of namedtuples. |
| 704 | + object when defining the mapping between the router's methods and a sub-object (a |
| 705 | + sub-estimator or a scorer). |
705 | 706 |
|
706 |
| - Iterating through an instance of this class will yield named |
707 |
| - ``MethodPair(caller, callee)`` tuples. |
| 707 | + Iterating through an instance of this class yields |
| 708 | + ``MethodPair(caller, callee)`` instances. |
708 | 709 |
|
709 | 710 | .. versionadded:: 1.3
|
710 | 711 | """
|
|
0 commit comments