Experiment Factory#

class ExperimentFactory(algorithm_config: AlgorithmCollection, categorical_features: Dict[str, List[str]])[source]#

Factory for creating Experiment instances from ExperimentGroups.

Takes a list of ExperimentGroup and creates a queue of Experiment instances. Applies specific configuration for each ExperimentGroup when creating the Experiment instances.

Parameters:
algorithm_configAlgorithmCollection

List of AlgorithmWrapper instances defining available algorithms

categorical_featuresdict

Dict mapping categorical features to dataset names

Attributes:
algorithm_configAlgorithmCollection

Available algorithms

categorical_featuresdict

Mapping of categorical features to datasets

create_experiments(group: ExperimentGroup, n_splits: int) Deque[Experiment][source]#

Create queue of experiments from an experiment group.

Parameters:
groupExperimentGroup

Configuration for the experiment group

n_splits: int

The number of data splits to create for this ExperimentGroup

Returns:
collections.deque

Queue of Experiment instances ready to run

Examples

>>> from brisk.utility.algorithm_wrapper import AlgorithmCollection
>>> from brisk.configuration.experiment_group import ExperimentGroup
>>> from brisk.configuration.experiment_factory import ExperimentFactory
>>>
>>> algorithms = AlgorithmCollection([
...     AlgorithmWrapper(
...         name="linear",
...         display_name="Linear Regression",
...         algorithm_class=LinearRegression
...     )
... ])
>>>
>>> categorical_features = {
...     "data.csv": ["category1", "category2"]
... }
>>>
>>> factory = ExperimentFactory(
...     algorithm_config=algorithms,
...     categorical_features=categorical_features
... )
>>>
>>> group = ExperimentGroup(
...     name="baseline",
...     datasets=["data.csv"],
...     algorithms=["linear"]
... )
>>>
>>> experiments = factory.create_experiments(group)