experiment Package¶
- class explauto.experiment.experiment.Experiment(environment, agent)[source]¶
Bases: explauto.utils.observer.Observer
This class is used to setup, run and log the results of an experiment.
Parameters: - environment (Environment) – an environment
- agent (Agent) – an agent
- evaluate_at(eval_at, testcases)[source]¶
Sets the evaluation interation indices.
Parameters: - eval_at (list) – iteration indices where an evaluation should be performed
- testcases (numpy.array) – testcases used for evaluation
- classmethod from_settings(settings)[source]¶
Creates a Experiment object thanks to the given settings.
- class explauto.experiment.pool.ExperimentPool(settings, evaluate_at, testcases=None, same_testcases=False)[source]¶
Bases: object
Pool of experiments running in parallel.
Parameters: - settings (list) – list of settings used to create the pool of experiments.
- evaluate_at (list) – iteration indices where an evaluation should be performed.
- testcases (numpy.array) – specify a pre-defined testcases, by default a testcases will be generated.
- same_testcases (bool) – whether to use the same testcases for all experiments.
The Pool will create Experiment using the from_settings() constructor for each combination of parameters given.
Note
If you set same_testcases to True the first experiment will generate a testcase used by all the others experiment. Otherwise, each experiment will generate its own testcase.
- classmethod from_settings_product(environments, babblings, interest_models, sensorimotor_models, evaluate_at, testcases=None, same_testcases=False)[source]¶
Creates a ExperimentPool with the product of all the given settings.
Parameters: - environments (list of (environment name, config name)) – e.g. [(‘simple_arm’, ‘default’), (‘simple_arm’, ‘high_dimensional’)]
- babblings – e.g. [‘motor’, ‘goal’]
- interest_models (list of (interest model name, config name)) – e.g. [(‘random’, ‘default’)]
- sensorimotor_models (list of (sensorimotor model name, config name)) – e.g. [(‘non_parametric’, ‘default’)]
- evaluate_at (list of int) – indices defining when to evaluate
- same_testcases (bool) – whether to use the same testcases for all experiments
- run(repeat=1, processes=None, use_thread=False)[source]¶
Runs all experiments using a multiprocessing.Pool.
Parameters:
- logs[source]¶
Returns the list of ExperimentLog.
Note
The logs will be returned as a vector if repeat was set as one in the run() method else it will be a matrix where each rows represents the n repetitions of an experiment.
- class explauto.experiment.log.ExperimentLog(conf, expl_dims, inf_dims)[source]¶
Bases: object
- pack(topic_dims, t)[source]¶
Packs selected logs into a numpy array :param list topic_dims: list of (topic, dims) tuples, where topic is a string and dims a list dimensions to be packed for that topic :param int t: time indexes to be packed
- scatter_plot(ax, topic_dims, t=None, ms_limits=True, **kwargs_plot)[source]¶
2D or 3D scatter plot.
Parameters: - ax (axes) – matplotlib axes (use Axes3D if 3D data)
- topic_dims (tuple) – list of (topic, dims) tuples, where topic is a string and dims is a list of dimensions to be plotted for that topic.
- t (int) – time indexes to be plotted
- kwargs_plot (dict) – argument to be passed to matplotlib’s plot function, e.g. the style of the plotted points ‘or’
- ms_limits (bool) – if set to True, automatically set axes boundaries to the sensorimotor boundaries (default: True)