AI4Finance-Foundation / FinRL-Trading

For trading. Please star.
https://ai4finance.org
MIT License
2.03k stars 735 forks source link

DRL_prediction error #28

Open vadim7s opened 3 years ago

vadim7s commented 3 years ago

Hi, great article once again,

I am trying to predict using trained models but get the same error in both single and multi stock scenarios. When I run prediction:

trade = data_split(processed_full, '2019-01-01','2021-01-01') e_trade_gym = StockTradingEnv(df = trade, turbulence_threshold = 332, **env_kwargs) df_account_value, df_actions = DRLAgent.DRL_prediction(model=model_sac, environment = e_trade_gym)

the code above gives this error ValueError: Length mismatch: Expected axis has 0 elements, new values have 1 elements

the error happens in this location: ~\Anaconda3\envs\py36\lib\site-packages\finrl\model\models.py in DRL_prediction(model, environment) 78 action, _states = model.predict(test_obs) 79 account_memory = test_env.env_method(method_name="save_asset_memory") ---> 80 actions_memory = test_env.env_method(method_name="save_action_memory") 81 test_obs, rewards, dones, info = test_env.step(action) 82 if dones[0]:

I am using Jupyter notebook downloaded as of Feb 9, 2021, something must have changed in the modules since you ran it Thanks Vadim