A computer-implemented method for generating actions to be performed by an electromechanical agent interacting with a real-world environment, the real-world environment taking at successive times a corresponding one of a plurality of states, the method comprising successively modifying a neural network which is operative to generate the actions and defined by a plurality of network parameters, by, at each of a plurality of successive time steps: (a) using the neural network to generate an action based on a current observation of the real-world environment at the time step; (b) causing the electromechanical agent to perform the generated action on the real-world environment; (c) obtaining a further observation of the state of the real-world environment following the performance of the generated action by the electromechanical agent; (d) generating a reward value as a measure of the divergence between (i) the likelihood of the further observation under a first statistical model of the real-world environment and (ii) the likelihood of the further observation under a second statistical model of the real-world environment, wherein: the first statistical model is based on a first history of past observations of the state of the real-world environment and actions, the second statistical model is based on a second history of past observations of the state of the real-world environment and actions, and the most recent observation in the first history is more recent than the most recent observation in the second history; and (e) modifying one or more said network parameters of the neural network based on the reward value; wherein the first and second statistical models are respective first and second probability distributions for the further observation, the most recent observation in the first history being H time steps into the past compared to the time step, where H is an integer greater than zero. the method comprising successively modifying a neural network which is operative to generate the actions and defined by a plurality of network parameters, by, at each of a plurality of successive time steps: (a) using the neural network to generate an action based on a current observation of the real-world environment at the time step; (b) causing the electromechanical agent to perform the generated action on the real-world environment; (c) obtaining a further observation of the state of the real-world environment following the performance of the generated action by the electromechanical agent; (d) generating a reward value as a measure of the divergence between (i) the likelihood of the further observation under a first statistical model of the real-world environment and (ii) the likelihood of the further observation under a second statistical model of the real-world environment, wherein: the first statistical model is based on a first history of past observations of the state of the real-world environment and actions, the second statistical model is based on a second history of past observations of the state of the real-world environment and actions, and the most recent observation in the first history is more recent than the most recent observation in the second history; and (e) modifying one or more said network parameters of the neural network based on the reward value; wherein (a) using the neural network to generate an action based on a current observation of the real-world environment at the time step; (b) causing the electromechanical agent to perform the generated action on the real-world environment; (c) obtaining a further observation of the state of the real-world environment following the performance of the generated action by the electromechanical agent; (d) generating a reward value as a measure of the divergence between (i) the likelihood of the further observation under a first statistical model of the real-world environment and (ii) the likelihood of the further observation under a second statistical model of the real-world environment, wherein: the first statistical model is based on a first history of past observations of the state of the real-world environment and actions, the second statistical model is based on a second history of past observations of the state of the real-world environment and actions, and the most recent observation in the first history is more recent than the most recent observation in the second history; and the first statistical model is based on a first history of past observations of the state of the real-world environment and actions, the second statistical model is based on a second history of past observations of the state of the real-world environment and actions, and the most recent observation in the first history is more recent than the most recent observation in the second history; and (e) modifying one or more said network parameters of the neural network based on the reward value; wherein the first and second statistical models are respective first and second probability distributions for the further observation, the most recent observation in the first history being H time steps into the past compared to the time step, where H is an integer greater than zero.