Ejemplo n.º 1
0
 def init_prediction(self, session, trick_prediction, featurizer=None):
     self.session = session
     self.trick_prediction = trick_prediction
     if featurizer is None:
         self.featurizer = Featurizers.Featurizer()
     else:
         self.featurizer = featurizer
Ejemplo n.º 2
0
    def __init__(self,
                 estimator=None,
                 policy=None,
                 featurizer=None,
                 trick_prediction=None,
                 session=None,
                 path=None):
        if featurizer is None:
            featurizer = Featurizers.Featurizer()
        if estimator is None:
            assert session is not None
            estimator = PolicyGradient(session,
                                       featurizer.get_state_size(),
                                       path=path)
        else:
            assert isinstance(estimator, PolicyGradient)
        if policy is None:
            policy = Policies.MaxPolicy(estimator)

        super(PGAgent, self).__init__(estimator=estimator,
                                      policy=policy,
                                      featurizer=featurizer,
                                      trick_prediction=trick_prediction,
                                      session=session,
                                      path=path)
Ejemplo n.º 3
0
    def __init__(self,
                 estimator=None,
                 policy=None,
                 featurizer=None,
                 trick_prediction=None,
                 session=None,
                 path=None):
        if featurizer is None:
            featurizer = Featurizers.Featurizer()

        if estimator is None:
            assert session is not None
            estimator = ValueEstimators.DuelingDQNEstimator(
                session, input_shape=featurizer.get_state_size(), path=path)
        super(DuelingAgent, self).__init__(estimator=estimator,
                                           policy=policy,
                                           featurizer=featurizer,
                                           trick_prediction=trick_prediction,
                                           session=session,
                                           path=path)
Ejemplo n.º 4
0
 def init_player(self,
                 session,
                 path,
                 estimator=None,
                 policy=None,
                 featurizer=None):
     self.session = session
     self.path = path
     if featurizer is None:
         self.featurizer = Featurizers.Featurizer()
     else:
         self.featurizer = featurizer
     if estimator is None:
         assert session is not None
         self.estimator = ValueEstimators.DQNEstimator(
             session,
             input_shape=self.featurizer.get_state_size(),
             path=path)
     else:
         self.estimator = estimator
     if policy is None:
         self.policy = Policies.EGreedyPolicy(self.estimator, epsilon=0.1)
     else:
         self.policy = policy