leaspy.algo.algo_factory.AlgoFactory

class AlgoFactory

Bases: object

Return the wanted algorithm given its name.

Notes

For developers: add your new algorithm in corresponding category of _algos dictionary.

Methods

algo(algorithm_family, settings)

Return the wanted algorithm given its name.

get_class(name)

Get the class of the algorithm identified as name.

classmethod algo(algorithm_family: str, settings) AbstractAlgo

Return the wanted algorithm given its name.

Parameters:
algorithm_familystr

Task name, used to check if the algorithm within the input settings is compatible with this task. Must be one of the following api’s name:

  • fit

  • personalize

  • simulate

settingsAlgorithmSettings

The algorithm settings.

Returns:
algorithmchild class of AbstractAlgo

The wanted algorithm if it exists and is compatible with algorithm family.

Raises:
LeaspyAlgoInputError
  • if the algorithm family is unknown

  • if the algorithm name is unknown / does not belong to the wanted algorithm family

classmethod get_class(name: str) Type[AbstractAlgo]

Get the class of the algorithm identified as name.