Пример #1
0
 def __init__(self, module, learner = None):
     LearningAgent.__init__(self, module, learner)
     
     # exploration module (linear flat network)
     self.explorationmodule = buildNetwork(self.indim, self.outdim, bias=False)
     
     # state dependent exploration layer
     self.explorationlayer = StateDependentLayer(self.outdim, self.explorationmodule, 'explore')
             
     # add exploration layer to top of network through identity connection
     out = self.module.outmodules.pop()
     self.module.addOutputModule(self.explorationlayer)
     self.module.addConnection(IdentityConnection(out, self.module['explore'], self.module))
     self.module.sortModules()
     
     # tell learner the new module
     self.learner.setModule(self.module)
     
     # add the log likelihood (loglh) to the dataset and link it to the others
     self.history.addField('loglh', self.module.paramdim)
     self.history.link.append('loglh')
     self.loglh = None
     
     # if this flag is set to True, random weights are drawn after each reward,
     # effectively acting like the vanilla policy gradient alg.
     self.actaspg = False
Пример #2
0
 def __init__(self, module, learner = None):
     assert isinstance(module, FeedForwardNetwork)
     assert len(module.outmodules) == 1
     
     LearningAgent.__init__(self, module, learner)
     
     # create gaussian layer
     self.explorationlayer = GaussianLayer(self.outdim, name='gauss')
     self.explorationlayer.setSigma([-2] * self.outdim)
     
     # add gaussian layer to top of network through identity connection
     out = self.module.outmodules.pop()
     self.module.addOutputModule(self.explorationlayer)
     self.module.addConnection(IdentityConnection(out, self.module['gauss']))
     self.module.sortModules()
     
     # tell learner the new module
     self.learner.setModule(self.module)
     
     # add the log likelihood (loglh) to the dataset and link it to the others
     self.history.addField('loglh', self.module.paramdim)
     self.history.link.append('loglh')
     self.loglh = None
Пример #3
0
    def __init__(self, module, learner=None):
        assert isinstance(module, FeedForwardNetwork)
        assert len(module.outmodules) == 1

        LearningAgent.__init__(self, module, learner)

        # create gaussian layer
        self.explorationlayer = GaussianLayer(self.outdim, name='gauss')
        self.explorationlayer.setSigma([-2] * self.outdim)

        # add gaussian layer to top of network through identity connection
        out = self.module.outmodules.pop()
        self.module.addOutputModule(self.explorationlayer)
        self.module.addConnection(IdentityConnection(out,
                                                     self.module['gauss']))
        self.module.sortModules()

        # tell learner the new module
        self.learner.setModule(self.module)

        # add the log likelihood (loglh) to the dataset and link it to the others
        self.history.addField('loglh', self.module.paramdim)
        self.history.link.append('loglh')
        self.loglh = None
Пример #4
0
 def __init__(self, indim, outdim):        
     LearningAgent.__init__(self, buildNetwork(indim, outdim))
Пример #5
0
 def __init__(self, indim, outdim):
     LearningAgent.__init__(self, buildNetwork(indim, outdim))
Пример #6
0
 def __init__(self, module, learner):
     LearningAgent.__init__(self, module, learner)
     
     self.epsilon = 0.5
     self.epsilondecay = 0.9999