class_docstr: Relative Entropy Policy Search.
  
  References
  ----------
  [1] J. Peters, K. Mulling, and Y. Altun, "Relative Entropy Policy Search,"
      Artif. Intell., pp. 1607-1612, 2008.
  
  Example:
      $ python garage/examples/tf/reps_gym_cartpole.py
  
  Args:
      env_spec (EnvSpec): Environment specification.
      policy (garage.tf.policies.StochasticPolicy): Policy.
      baseline (garage.tf.baselines.Baseline): The baseline.
      sampler (garage.sampler.Sampler): Sampler.
      scope (str): Scope for identifying the algorithm.
          Must be specified if running multiple algorithms
          simultaneously, each using different environments
          and policies.
      discount (float): Discount.
      gae_lambda (float): Lambda used for generalized advantage
          estimation.
      center_adv (bool): Whether to rescale the advantages
          so that they have mean 0 and standard deviation 1.
      positive_adv (bool): Whether to shift the advantages
          so that they are always positive. When used in
          conjunction with center_adv the advantages will be
          standardized before shifting.
      fixed_horizon (bool): Whether to fix horizon.
      epsilon (float): Dual func parameter.
      l2_reg_dual (float): Coefficient for dual func l2 regularization.
      l2_reg_loss (float): Coefficient for policy loss l2 regularization.
      optimizer (object): The optimizer of the algorithm. Should be the
          optimizers in garage.tf.optimizers.
      optimizer_args (dict): Arguments of the optimizer.
      dual_optimizer (object): Dual func optimizer.
      dual_optimizer_args (dict): Arguments of the dual optimizer.
      name (str): Name of the algorithm.
docstr: Get valid view features based on samples data.
  
  Args:
      episodes (EpisodeBatch): Batch of episodes.
  
  Returns:
      numpy.ndarray: Features for training.
docstr_tok: ["Get","valid","view","features","based","on","samples","data",".","Args",":","episodes","(","EpisodeBatch",")",":","Batch","of","episodes",".","Returns",":","numpy.ndarray",":","Features","for","training","."]
code: def _features(self, episodes):
      """Get valid view features based on samples data.
  
      Args:
          episodes (EpisodeBatch): Batch of episodes.
  
      Returns:
          numpy.ndarray: Features for training.
  
      """
      start = 0
      feat_diff = []
      for length in episodes.lengths:
          stop = start + length
          o = np.clip(
              episodes.observations[start:stop],
              self._env_spec.observation_space.low,
              self._env_spec.observation_space.high,
          )
          lr = length
          al = np.arange(lr).reshape(-1, 1) / self.max_episode_length
          feats = np.concatenate(
              [o, o**2, al, al**2, al**3, np.ones((lr, 1))],
              axis=1,
          )
          # pylint: disable=unsubscriptable-object
          feats = np.vstack([feats, np.zeros(feats.shape[1])])
          feat_diff.append(feats[1:] - feats[:-1])
          start = stop
  
      return np.vstack(feat_diff)
  
imports: import collections
  from dowel import logger, tabular
  import numpy
  import scipy.optimize
  import tensorflow
  from garage import _Default, log_performance, make_optimizer
  from garage.np import pad_batch_array
  from garage.np.algos import RLAlgorithm
  from garage.tf import compile_function, flatten_inputs, graph_inputs, new_tensor
  from garage.tf.optimizers import LBFGSOptimizer
label_desc: Use image node_id 12 for calling the REPS obj's underlying member method code with example usage: obj._features(episodes) and returns: np