PYTHON   51

Untitled

Guest on 25th June 2022 02:15:47 AM

  1.     def filter_episodes(self, rewards: List[float], episodes: List[Tuple[Any, Any]], percentile: float) -> Tuple[np.ndarray, np.ndarray, float]:
  2.         reward_bound = np.percentile(rewards, percentile)
  3.         x_train = []
  4.         y_train = []
  5.         for reward, episode in zip(rewards, episodes):
  6.             if reward >= reward_bound:
  7.                 observation = [step[0] for step in episode]
  8.                 action = [step[1] for step in episode]
  9.                 x_train.extend(observation)
  10.                 y_train.exten# print(f"this is y_train {y_train}")
  11. rray(x_train)
  12.         # print(f"this is y_train {y_train}")
  13.         y_train = to_categorical(y_train, num_

Raw Paste


Login or Register to edit or fork this paste. It's free.