Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: cannot copy sequence with size 176 to array axis with dimension 181 #29

Open
zcy-4747 opened this issue Feb 20, 2021 · 2 comments

Comments

@zcy-4747
Copy link

I wonder how 181 was calculated?

@zcy-4747
Copy link
Author

I tried to use this model with other stock data, but failed

@emjay032
Copy link

emjay032 commented Jun 5, 2021

maybe a little late, but 181 is the dimension of the state space:

balance + num_stocks+holdings +technichal indiactors
1+30+30+4*30 (4 technical indicators for each 30 stocks) = 181
balance = [balance]
num_stcosk = [stock_1,stock_2+...+stock_30]
technicahl indicators = [TI_1,stock_1,TI_2,stock_1,TI_3,stock_1,TI_4_stock_1,+...+TI_1,stock_30,TI_2,stock_30,TI_3,stock_30,TI_4_stock_30]
if you have a state space of dimension 176 change self.observation_space = spaces.Box(low=0, high=np.inf, shape = (181,)) to self.observation_space = spaces.Box(low=0, high=np.inf, shape = (176,))

low depends on the input of your data if you have negartive values i would recomend low = -np.inf

additionally when training and testing you should normalize the input to[-1,1] for your neural net by VecNormalize follwoing the Stable Basleine Documentation (training also the reward)
https://stable-baselines.readthedocs.io/en/master/guide/vec_envs.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants