sensorimotor_model Package

class explauto.sensorimotor_model.sensorimotor_model.SensorimotorModel(conf)[source]

Bases: object

This abstract class provides the common interface for sensorimotor models.

classmethod from_configuration(conf, sm_name, config_name='default')[source]
infer(in_dims, out_dims, x)[source]

Performs inference in the sensorimotor space.

Parameters:
  • in_dims (list) – list of input dimensions. For example, use self.conf.m_dims to perform forward prediction (i.e. infer the expected sensory effect for a given input motor command) or self.conf.s_dims to perform inverse prediction (i.e. infer a motor command in order to reach an input sensory goal).
  • out_dims (list) – list of output dimensions. For example, use self.conf.s_dims to perform forward prediction (i.e. infer the expected output sensory effect for a given input motor command) or self.conf.m_dims to perform inverse prediction (i.e. infer a output motor command in order to reach an input sensory goal).
  • x (numpy.array) – value array for input dimensions. For example, if in_dims = self.conf.m_dims, x is the value of the motor configuration for which we want to predict a sensory effect.
Returns:

an array of size len(out_dims) containing the forward or inverse prediction

Note

Although it is especially used to perform either forward or inverse predictions, Explauto’s sensorimotor models are generally suitable to do all kind of general prediction from X (input) to Y (output), where X and Y are to distinct subspaces of the sensorimotor space.

update(m, s)[source]

Update the sensorimotor model given a new (m, s) pair, where m is a motor command and s is the corresponding observed sensory effect.

forward_prediction(m)[source]

Compute the expected sensory effect of the motor command m. It is a shortcut for self.infer(self.conf.m_dims, self.conf.s_dims, m)

inverse_prediction(s_g)[source]

Compute a motor command to reach the sensory goal s_g. It is a shortcut for self.infer(self.conf.s_dims, self.conf.m_dims, s_g)

class explauto.sensorimotor_model.nearest_neighbor.NearestNeighbor(conf, sigma_ratio)[source]

Bases: explauto.sensorimotor_model.sensorimotor_model.SensorimotorModel

This class implements a simple sensorimotor model based on nearest neighbor look-up. Used as a forward model, it simply returns the image in S of nearest neighbor in M. Used as an inverse model, it looks at the nearest neighbor in S, then explore during the n_explore following calls to self.infer around that neighborhood. It is inspired by the experiment in the section 4.4.1 and 4.4.2 of Baranes and Oudeyer (2013).

Parameters:
  • conf (Configuration) – a Configuration instance
  • n_explore (int) – the number of exploration trials for each goal
  • sigma_ratio (float) – the standard deviation of the exploration will be (conf.m_maxs - conf.m_mins) * sigma_ratio. Hence, high values of this parameters means larger exploration
infer(in_dims, out_dims, x)[source]
update(m, s)[source]