agent Package¶
- class explauto.agent.agent.Agent(conf, sm_model, im_model, n_bootstrap=0)[source]¶
Bases: explauto.utils.observer.Observable
- classmethod from_classes(im_model_cls, im_model_config, expl_dims, sm_model_cls, sm_model_config, inf_dims, m_mins, m_maxs, s_mins, s_maxs, n_bootstrap=0)[source]¶
Initialize agent class
Parameters: - im_model_cls (class) – a subclass of InterestedModel, as those registered in the interest_model package
- im_model_config (dict) – a configuration dict as those registered in the interest_model package
- expl_dims (list) – the sensorimotor dimensions where exploration is driven in the interest model
- inf_dims (list) – the output sensorimotor dimensions of the sensorimotor model (input being expl_dims)
- sm_model_cls (class) – a subclass of SensorimotorModel, as those registered in the sensorimotor_model package
- sensorimotor_model_config (dict) – a configuration dict as those registered in the sensorimotor_model package
- m_mins, m_maxs, s_mins, s_max (list) – lower and upper bounds of motor and sensory values on each dimension
- infer(expl_dims, inf_dims, x)[source]¶
Use the sensorimotor model to compute the expected value on inf_dims given that the value on expl_dims is x.
Note
This corresponds to a prediction if expl_dims=self.conf.m_dims and inf_dims=self.conf.s_dims and to inverse prediction if expl_dims=self.conf.s_dims and inf_dims=self.conf.m_dims.
- extract_ms(x, y)[source]¶
Returns the motor and sensory parts from a point in the exploration space (expl_dims) and a point in the inference space (inf_dims).
- motor_primitive(m)[source]¶
Prepare the movement from a command m. To be overridded in order to generate more complex movement (tutorial to come). This version simply bounds the command.
- sensory_primitive(s)[source]¶
Extract features from a sensory effect s. To be overridded in order to process more complex feature extraction (tutorial to come). This version simply bounds the sensory effect.
- produce()[source]¶
Exploration (see the Explauto introduction for more detail):
- Choose a value x on expl_dims according to the interest model
- Infer a value y on inf_dims from x using the infer() method
- Extract the motor m and sensory s parts of x, y
- generate a movement from m
Returns: the generated movement Note
This correspond to motor babbling if expl_dims=self.conf.m_dims and inf_dims=self.conf.s_dims and to goal babbling if expl_dims=self.conf.s_dims and inf_dims=self.conf.m_dims.
- perceive(s_)[source]¶
Learning (see the Explauto introduction for more detail):
- update the sensorimotor model with (m, s)
- update the interest model with (x, y, m, s) (x, y are stored in self.ms in production())