AI4Finance-Foundation / FinRL

FinRL: Financial Reinforcement Learning. 🔥
https://ai4finance.org
MIT License
9.36k stars 2.27k forks source link

TypeError: DRLEnsembleAgent.run_ensemble_strategy() #1217

Closed mrkangwon closed 2 months ago

mrkangwon commented 2 months ago

Describe the bug I was trying the code in FinRL_Ensemble_StockTrading_ICAIF_2020.ipynb. In Part 6, when I tried to run the following code snippet.

A2C_model_kwargs = { 'n_steps': 5, 'ent_coef': 0.005, 'learning_rate': 0.0007 }

PPO_model_kwargs = { "ent_coef":0.01, "n_steps": 2, #2048 "learning_rate": 0.00025, "batch_size": 128 }

DDPG_model_kwargs = {

"action_noise":"ornstein_uhlenbeck",

                  "buffer_size": 1, #10_000
                  "learning_rate": 0.0005,
                  "batch_size": 64
                }

timesteps_dict = {'a2c' : 1, #10_000 each 'ppo' : 1, 'ddpg' : 1, }

df_summary = ensemble_agent.run_ensemble_strategy(A2C_model_kwargs, PPO_model_kwargs, DDPG_model_kwargs, timesteps_dict)

I am getting the following error message:


TypeError Traceback (most recent call last) in <cell line: 32>() 30 } 31 ---> 32 df_summary = ensemble_agent.run_ensemble_strategy(A2C_model_kwargs, 33 PPO_model_kwargs, 34 DDPG_model_kwargs,

TypeError: DRLEnsembleAgent.run_ensemble_strategy() missing 2 required positional arguments: 'TD3_model_kwargs' and 'timesteps_dict'

When I looked at the function definition of run_ensemble_strategy() in models.py, it looks like this:

def run_ensemble_strategy( self, A2C_model_kwargs, PPO_model_kwargs, DDPG_model_kwargs, SAC_model_kwargs, TD3_model_kwargs, timesteps_dict, ):

I wonder if the code or the example is outdated. Can you provide any help? I ran it in a google colab environment.

mrkangwon commented 2 months ago

I found the fix in a previously posted issue. So I am closing it.