Source code for core.trainable_agent

from .agent import Agent


[docs]class TrainableAgent(Agent): ''' Class that extends the functionality of a normal agent. This is necessary because agents are bound to a particular player, but for some algorithms the agent is really being trained to play optimally for both plays, so we have this class house the training data and then pass it into the agents when they are instantiated to avoid duplicated work '''
[docs] def train(self, g, **kwargs): ''' Train the agent. As a convenience this should return :code:`self.training_params()` at the end of training Args: g (Game): The game the agent is training on Returns: tuple: The training params of the agent ''' raise NotImplementedError
[docs] def train_episode(self, g, **kwargs): ''' Single training iteration Args: g (Game): The game the agent is training on ''' raise NotImplementedError
[docs] def training_params(self, g): ''' Return the params that result from training Args: g (Game): The game the agent is training on ''' raise NotImplementedError