Batchrunner¶
Batchrunner¶
A single class to manage a batch run or parameter sweep of a given model.
-
class
batchrunner.
BatchRunner
(model_cls, variable_parameters=None, fixed_parameters=None, iterations=1, max_steps=1000, model_reporters=None, agent_reporters=None, display_progress=True)[source]¶ This class is instantiated with a model class, and model parameters associated with one or more values. It is also instantiated with model and agent-level reporters, dictionaries mapping a variable name to a function which collects some data from the model or its agents at the end of the run and stores it.
Note that by default, the reporters only collect data at the end of the run. To get step by step data, simply have a reporter store the model’s entire DataCollector object.
-
class
batchrunner.
BatchRunnerMP
(model_cls, nr_processes=None, **kwargs)[source]¶ Child class of BatchRunner, extended with multiprocessing support.
-
class
batchrunner.
FixedBatchRunner
(model_cls, parameters_list=None, fixed_parameters=None, iterations=1, max_steps=1000, model_reporters=None, agent_reporters=None, display_progress=True)[source]¶ This class is instantiated with a model class, and model parameters associated with one or more values. It is also instantiated with model and agent-level reporters, dictionaries mapping a variable name to a function which collects some data from the model or its agents at the end of the run and stores it.
Note that by default, the reporters only collect data at the end of the run. To get step by step data, simply have a reporter store the model’s entire DataCollector object.
-
get_agent_vars_dataframe
()[source]¶ Generate a pandas DataFrame from the agent-level variables collected.
-
get_collector_agents
()[source]¶ Passes pandas dataframes from datacollector module in dictionary format of agent reporters :return: dict {(Param1, Param2,…,iteration): <DataCollector Pandas DataFrame>}
-
get_collector_model
()[source]¶ Passes pandas dataframes from datacollector module in dictionary format of model reporters :return: dict {(Param1, Param2,…,iteration): <DataCollector Pandas DataFrame>}
-