Factories

todo intro text

ScenarioFactory

class algomancy_scenario.scenariofactory.ScenarioFactory(kpis, algorithms, data_manager, logger=None)[source]

Bases: object

Creates scenarios, builds algorithms and KPIs, and performs parameter validation.

property available_algorithms: List[str]
property available_kpis: List[str]
property algorithms: Dict[str, Type[ALGORITHM]]
log(msg)[source]
create(tag, dataset_key, algo_name, algo_params=None, data_params=None)[source]
get_associated_parameters(algo_name, dataset_key=None)[source]

Return the (algo_params, data_params) templates for a scenario.

The algo params template comes from the algorithm class; the data params template comes from the selected data source’s initialize_data_parameters. dataset_key is optional only so callers that don’t yet know the dataset can still introspect the algo side — the data side falls back to EmptyParameters.

AlgorithmFactory

class algomancy_scenario.algorithmfactory.AlgorithmFactory(templates, logger=None)[source]

Bases: Generic[ALGORITHM]

Creates algorithm objects

property available_algorithms: List[str]
property templates: Dict[str, Type[ALGORITHM]]
create(input_name, input_params)[source]
Parameters:
  • input_name (str)

  • input_params (Dict[str, Any])

Raises:

AssertionError – Either algorithm template is not found or parameter validation fails.

Returns:

Return type:

ALGORITHM

get_parameters(algo_name)[source]