Utils

get_init_states(dataset)[source]

Get the initial states of a MushroomRL dataset

Parameters:dataset (Dataset) – a MushroomRL dataset.
extract_arguments(args, method)[source]

Extract the arguments from a dictionary that fit to a methods parameters.

Parameters:
  • args (dict) – dictionary of arguments;
  • method (function) – method for which the arguments should be extracted.
object_to_primitive(obj)[source]

Converts an object into a string using the class name

Parameters:obj – the object to convert.
Returns:A string representing the object.
dictionary_to_primitive(data)[source]

Function that converts a dictionary by transforming any objects inside into strings

Parameters:data (dict) – the dictionary to convert.
Returns:The converted dictionary.
get_mean_and_confidence(data)[source]

Compute the mean and 95% confidence interval

Parameters:data (np.ndarray) – Array of experiment data of shape (n_runs, n_epochs).
Returns:The mean of the dataset at each epoch along with the confidence interval.
plot_mean_conf(data, ax, color='blue', line='-', facecolor=None, alpha=0.4, label=None)[source]

Method to plot mean and confidence interval for data on pyplot axes.

build_sweep_list(algs, sweep_conf, base_name='c_')[source]

Build the sweep list, from a compact dictionary specification, for every considered algorithm.

Parameters:
  • algs (list) – list of algorithms to be considered;
  • sweep_conf (dict) – dictionary with a compact sweep configuration for every algorithm;
  • base_name (str, 'c_') – base name for the sweep configuiration.
Returns:

The sweep list to be used with the suite.

build_sweep_dict(base_name='c_', **kwargs)[source]

Build the sweep dictionary, from a set of variable specifications.

Parameters:
  • base_name (str, 'c_') – base name for the sweep configuiration;
  • **kwargs – the parameter specifications for the sweep.
Returns:

The sweep dictionary, where the key is the sweep name and the value is a dictionary with the sweep parameters.

generate_sweep(base_name='c_', **kwargs)[source]

Generator that returns tuples with sweep name and parameters

Parameters:
  • base_name (str, 'c_') – base name for the sweep configuiration;
  • **kwargs – the parameter specifications for the sweep.
generate_sweep_params(**kwargs)[source]

Generator that returns sweep parameters

Parameters:**kwargs – the parameter specifications for the sweep.