API Reference#
- class expttools.Experiment(experiment_function, parameter_grid, name_func=None, parameter_string={}, name_format=None)[source]#
-
- get_name_list()[source]#
generate list of all names
- Returns:
name_list – names of all folders to be created
- Return type:
list of str
- restart_batch(full_path=None, base_path=None, date_stamp_name=None, expt_name=None, verbose=False)[source]#
restart a run, uses default ‘results’ dir and most recent one that matches the experiment_function if no path is named or fills in from parts.
- Parameters:
full_path (string or path) – use this to specify the full path to the results, specifying this overrides other input parameters of this method
date_stamp_name (string) – specify the particular previous run you want to re-start
base_path (string or path) – directory to search for previous runs
expt_name (string) – name to filter on; uses experiment_function.__name__ if None
- run_batch(base_path='results', name_func=None, expt_name=None, datestamp_file=True, nested=False, verbose=False, restart=False, full_path=None)[source]#
run a batch of experiments over the parameter grid and save all results in a structured file system with naming conventions that protect from overwriting
- Parameters:
base_path (path or string) – base path to create subfolders in for ths set of experiments
name_func (function or None) – a function that creates a file name from parameter values
expt_name (string, default None) – meaningful name for the batch to prepend to the date to, if None, uses the __name__ attribute of the experiment function
datestamp_file (boolean, default True) – flag to datestamp or not, typically should not be changed
nested (boolean, default false) – flag to treat parameters as nested
verbose (boolean, default False) – flag to display debugging output
restart (boolean, default False) – is this a restart
full_path (path or string, default None) – uesd for restart; generally should not be used
- Returns:
success_list (list of string) – experiment names that succeed
failed_list (list of strings) – experiment names that threw an exception
- run_test(param_i=None, verbose=False)[source]#
Call the function with a single (default first) value of each parameter and return the result. throws warnings if save format is incompatible with ExperimentResult
- Parameters:
param_i (list) – list of ints to use as the index for each parameter in order they appear in the parameter grid
verbose (boolean) – display maximum outputs
- Returns:
cur_name (string) – name of the tested case
expt_result ((df)) – what the experiment function returns