scml.experiment
Attributes
Classes
Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Extracts variable name and value allowing for multiple names separated by semicolon |
|
Runs a single configuration and returns values of all functions for that configuration |
|
Tests whether the constraints are all satisfied in the config or not |
|
Generates all configs for an experiment with a factorial design |
|
Generates all configs for an experiment with a factorial design |
|
|
|
Runs an experiment |
|
Module Contents
- scml.experiment.bankruptcy_level(world: scml.SCML2020World)[source]
- scml.experiment.relative_productivity(world: scml.SCML2020World)[source]
- scml.experiment.n_bankrupt(world: scml.SCML2020World)[source]
- scml.experiment.relative_welfare_all(world: scml.SCML2020World)[source]
- scml.experiment.relative_welfare_non_bankrupt(world: scml.SCML2020World)[source]
- scml.experiment.welfare_all(world: scml.SCML2020World)[source]
- scml.experiment.welfare_non_bankrupt(world: scml.SCML2020World)[source]
- scml.experiment.productivity(world: scml.SCML2020World)[source]
- scml.experiment.bankruptcy_rate(world: scml.SCML2020World)[source]
- scml.experiment.contract_execution(world: scml.SCML2020World)[source]
- scml.experiment.breach_rate(world: scml.SCML2020World)[source]
- scml.experiment.get_var_vals(var: str, val: Any) dict[str, Any] [source]
Extracts variable name and value allowing for multiple names separated by semicolon
- scml.experiment.run_config(world_config: dict[str, Any], funcs: list[str])[source]
Runs a single configuration and returns values of all functions for that configuration
- scml.experiment.satisfied(config: dict[str, Any], constraints: Iterable[Constraint]) bool [source]
Tests whether the constraints are all satisfied in the config or not
- Parameters:
config
constraints
Returns:
- scml.experiment.generate_configs_factorial(ind_vars: dict[str, list], fixed_vars: dict[str, Any], n_worlds_per_condition=5, constraints: tuple[Constraint, Ellipsis] = tuple()) list[dict[str, Any]] [source]
Generates all configs for an experiment with a factorial design
- Parameters:
ind_vars – Independent variables and their list of values
fixed_vars – Fixed variables to be passed directly to the world generator
n_worlds_per_condition – Number of simulations for each config
constraints – list of constraints that must be satisfied by all configs tested
- Returns:
list of configs
- scml.experiment.generate_configs_single(ind_var: str, ind_values: list[Any], fixed_vars: dict[str, Any], n_worlds_per_condition=5) list[dict[str, Any]] [source]
Generates all configs for an experiment with a factorial design
- Parameters:
ind_var – The independent variable. Note that multiple variables can be passed by separating them with semicolons
ind_values – The values to try for that independent variable. Note that multiple values can be passed in a tuple
fixed_vars – Fixed variables to be passed directly to the world generator
n_worlds_per_condition – Number of simulations for each config
- Returns:
list of configs
- scml.experiment.run_configs(configs: Iterable[dict[str, Any]], n_jobs: int) pandas.DataFrame [source]
- scml.experiment.run(ind_vars: dict[str, list], fixed_vars: dict[str, Any], n_worlds_per_condition=5, factorial: bool = True, constraints: tuple[Constraint, Ellipsis] = tuple(), n_jobs: float | int = 0) pandas.DataFrame [source]
Runs an experiment :param ind_vars: The independent variables :param fixed_vars: Variables not tested but passed to the world generator :param n_worlds_per_condition: Number of simulations to run for each condition :param factorial: If true run all possibilities, otherwise test each ind_var in an experiment (much faster) :param constraints: list of constraints for world generation each specifying the feasible values of an independent
variable given that a condition is met
- Parameters:
n_jobs – Number of jobs to use. If 1, processing will be serial. If zero all processes will be used. If a a fraction between zero and one, this fraction of CPU count will be used
- Returns:
A dataframe with the results