original_docstring: 
          Optimize controller's parameter's
          
docstring: Optimize controller's parameter's
docstring_tokens: Optimize controller ' s parameter ' s
code: def optimize_policy(self, maxiter=50, restarts=1):
          '''
          Optimize controller's parameter's
          '''
          start = time.time()
          if not self.optimizer:
              self.optimizer = gpflow.train.ScipyOptimizer(method="L-BFGS-B")
              start = time.time()
              self.optimizer.minimize(self, maxiter=maxiter)
              end = time.time()
              print("Controller's optimization: done in %.1f seconds with reward=%.3f." % (end - start, self.compute_reward()))
              restarts -= 1
  
          session = self.optimizer._model.enquire_session(None)
          best_parameters = self.read_values(session=session)
          best_reward = self.compute_reward()
          for restart in range(restarts):
              self.controller.randomize()
              start = time.time()
              self.optimizer._optimizer.minimize(session=session,
                          feed_dict=self.optimizer._gen_feed_dict(self.optimizer._model, None),
                          step_callback=None)
              end = time.time()
              reward = self.compute_reward()
              print("Controller's optimization: done in %.1f seconds with reward=%.3f." % (end - start, self.compute_reward()))
              if reward > best_reward:
                  best_parameters = self.read_values(session=session)
                  best_reward = reward
  
          self.assign(best_parameters)
  
          end = time.time()
code_tokens: def optimize_policy ( self , maxiter = 50 , restarts = 1 ) : start = time . time ( ) if not self . optimizer : self . optimizer = gpflow . train . ScipyOptimizer ( method = "L-BFGS-B" ) start = time . time ( ) self . optimizer . minimize ( self , maxiter = maxiter ) end = time . time ( ) print ( "Controller's optimization: done in %.1f seconds with reward=%.3f." % ( end - start , self . compute_reward ( ) ) ) restarts -= 1 session = self . optimizer . _model . enquire_session ( None ) best_parameters = self . read_values ( session = session ) best_reward = self . compute_reward ( ) for restart in range ( restarts ) : self . controller . randomize ( ) start = time . time ( ) self . optimizer . _optimizer . minimize ( session = session , feed_dict = self . optimizer . _gen_feed_dict ( self . optimizer . _model , None ) , step_callback = None ) end = time . time ( ) reward = self . compute_reward ( ) print ( "Controller's optimization: done in %.1f seconds with reward=%.3f." % ( end - start , self . compute_reward ( ) ) ) if reward > best_reward : best_parameters = self . read_values ( session = session ) best_reward = reward self . assign ( best_parameters ) end = time . time ( )
short_docstring: Optimize controller's parameter's
short_docstring_tokens: Optimize controller ' s parameter ' s
comment: '''
          Optimize controller's parameter's
          '''