From 9e91f417c8c0bfafea219a7dda5e08f9ab1c921d Mon Sep 17 00:00:00 2001 From: sachetz Date: Wed, 11 Dec 2024 20:03:59 -0600 Subject: [PATCH] Fixes for issue #28 - MultiDatasetTradingEnv incompatibility with gymnasium==1.0.0 and issues in selection of multi-dataset --- src/gym_trading_env/environments.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gym_trading_env/environments.py b/src/gym_trading_env/environments.py index 7736c9b..3e994c7 100644 --- a/src/gym_trading_env/environments.py +++ b/src/gym_trading_env/environments.py @@ -381,14 +381,14 @@ def next_dataset(self): # Find the indexes of the less explored dataset potential_dataset_pathes = np.where(self.dataset_nb_uses == self.dataset_nb_uses.min())[0] # Pick one of them - random_int = np.random.randint(potential_dataset_pathes.size) + random_int = np.random.choice(potential_dataset_pathes) dataset_path = self.dataset_pathes[random_int] self.dataset_nb_uses[random_int] += 1 # Update nb use counts self.name = Path(dataset_path).name return self.preprocess(pd.read_pickle(dataset_path)) - def reset(self, seed=None): + def reset(self, seed=None, options=None): self._episodes_on_this_dataset += 1 if self._episodes_on_this_dataset % self.episodes_between_dataset_switch == 0: self._set_df(