FutureSharks/ml-finance

gym MultiDiscrete's 'nvec'

paulobreviglieri opened this issue · 3 comments

When running the "deep-q-learning-agent-simulated-prices.ipynb" Jupyter notebook an error pops up when SimpleTradingEnvironment is instantiated.
If my understanding is correct, envs.py creates 'observation_space' instantiating gym's MultiDiscrete class with

[data_max] + data_range + position_range

as the argument for the MultiDiscrete's 'nvec' variable.
Upon execution, this argument takes the following values (a list of lists):

[[100.0, 400.0], [0, 100.0], [0, 400.0], [0, 2]]

The following error message is displayed:

AssertionError: nvec (counts) have to be positive

Can you indicate what must be fixed (in envs.py?) so that this error is corrected?
Thank you!

Hey @pcbreviglieri

Can you first install gym==0.9.4:

pip3 installl gym==0.9.4

Then retry. If that doesn't work, then please test this in examples/1-deep-q-learning-simulated/requirements.txt:

numpy==1.16.2
pandas==0.25.1
Keras==2.2.5
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0
keras-rl==0.4.2
tensorboard==1.14.0
tensorflow==1.14.0
tensorflow-estimator==1.14.0
sklearn==0.0
h5py==2.10.0
matplotlib==2.0.2
gym==0.9.4

Thanks 🙏

Hi @FutureSharks, thanks for your reply and apologies for my delay (I was moving to a new home...).
The gym downgrade to 0.9.4 was sufficient, the notebook ran smoothly after that.
Feel free to close this issue.
Thank you!!

OK great