gym-anytrading icon indicating copy to clipboard operation
gym-anytrading copied to clipboard

Unable to evaluate models

Open ShinyOrbThing opened this issue 1 year ago • 2 comments

I have trained an A2C model on some simulated stock data, following the same steps as are shown in this notebook.

On the line containing "obs = obs[np.newaxis, ...]"

I get the following error: TypeError: tuple indices must be integers or slices, not tuple

env = gym.make('stocks-v0', df=df, frame_bound=(90,110), window_size=5)
obs = env.reset()

while True: 
    obs = obs[np.newaxis, ...]
    action, _states = model.predict(obs)
    obs, rewards, done, info = env.step(action)
    if done:
        print("info", info)
        break

ShinyOrbThing avatar Feb 05 '24 16:02 ShinyOrbThing

This code is based on an older version of gym-anytrading. You can install gym-anytrading<2.0.0, or change your code according to these examples.

AminHP avatar Feb 06 '24 00:02 AminHP

Thanks @AminHP.

ShinyOrbThing avatar Feb 06 '24 17:02 ShinyOrbThing