changjingzhi / RL_DQN_stock

2 stars 0 forks source link

Code Run Error #1

Open whyhw-code opened 3 months ago

whyhw-code commented 3 months ago

Hello, I am able to have partial success in the first round of the game when I run it on my dataset using your test_DQN.py.

barpos: 3397 sell:not enough stock store_transition index: 97 episode 0 profits -258917.04 avg profits -258739.44 epsilon 0.03 barpos: 3398 sell:not enough stock store_transition index: 98 episode 0 profits -258870.77 avg profits -258690.19 epsilon 0.03 barpos: 3399 sell:not enough stock store_transition index: 99 episode 0 profits -258558.04 avg profits -258644.00 epsilon 0.03

It was a poor result, but it was only the first round of play. However, after this, it suddenly reported an error,

barpos: 3399 sell:not enough stock store_transition index: 99 episode 0 profits -258558.04 avg profits -258644.00 epsilon 0.03 barpos: 0 Traceback (most recent call last): File "D:\py_code\DQN_base-main\stock\DQN.py", line 251, in action = agent.choose_action(observation) File "D:\py_code\DQN_base-main\stock\DQN.py", line 186, in choose_action state = T.tensor(observation).to(self.Q_eval.device) ValueError: too many dimensions 'str'

I don't understand why this is so, first of all, my data total is 3,401.It looks like a mistake was made at the start of the second round. I hope to get your answer.

changjingzhi commented 1 month ago

I'm sorry to you , my code is based on the repository code https://github.com/wangshub/RL-Stock, and you may find the answer from issus in the repository.