Skip to content

declearn.aggregator.list_aggregators

Return a mapping of registered Aggregator subclasses.

This function aims at making it easy for end-users to list and access all available Aggregator classes at any given time. The returned dict uses unique identifier keys, which may be used to specify the desired algorithm as part of a federated learning process without going through the fuss of importing and instantiating it manually.

Note that the mapping will include all declearn-provided plug-ins, but also registered plug-ins provided by user or third-party code.

See also

Returns:

Name Type Description
mapping Dict[str, Type[Aggregator]]

Dictionary mapping unique str identifiers to Aggregator class constructors.

Source code in declearn/aggregator/_api.py
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
def list_aggregators() -> Dict[str, Type[Aggregator]]:
    """Return a mapping of registered Aggregator subclasses.

    This function aims at making it easy for end-users to list and access
    all available Aggregator classes at any given time. The returned dict
    uses unique identifier keys, which may be used to specify the desired
    algorithm as part of a federated learning process without going through
    the fuss of importing and instantiating it manually.

    Note that the mapping will include all declearn-provided plug-ins,
    but also registered plug-ins provided by user or third-party code.

    See also
    --------
    * [declearn.aggregator.Aggregator][]:
        API-defining abstract base class for the aggregation algorithms.

    Returns
    -------
    mapping:
        Dictionary mapping unique str identifiers to `Aggregator` class
        constructors.
    """
    return access_types_mapping("Aggregator")