AI4Finance-Foundation / AI4Finance-Foundation/FinRL-Meta
[DEBUGGING HELP] ValueError: could not broadcast input array from shape (14,6) into shape (22,14)
- Ngôn ngữ chính
- Python
- Star
- 1.9k
- Fork
- 751
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
In refernce to https://github.com/AI4Finance-Foundation/FinRL-Meta/blob/master/tutorials/1-Introduction/FinRL_PortfolioAllocation_NeurIPS_2020.ipynb
The train data is shaped as `(7812, 19) `
Passing the data to the env runs without any errors
`cryptoEnv = cryptoPortfolioAllocationEnvironment(dataFrame=trainData, **envKwargs)`
And when I call `cryptoEnv.observation_space`, the shape is (22, 14), which assume is a combination of the price and indicators:
_14 tickers, 8 indicators_
running `activeEnv, _ = cryptoEnv.stableBaselineEnv()`
returns
```
ValueError Traceback (most recent call last)
[](https://localhost:8080/#) in
----> 1 activeEnv, _ = cryptoEnv.stableBaselineEnv()
2 frames
[](https://localhost:8080/#) in stableBaselineEnv(self)
189 def stableBaselineEnv(self):
190 sb = DummyVecEnv([lambda: self])
--> 191 obs = sb.reset()
192 return sb, obs
193
[/usr/local/lib/python3.7/dist-packages/stable_baselines3/common/vec_env/dummy_vec_env.py](https://localhost:8080/#) in reset(self)
62 for env_idx in range(self.num_envs):
63 obs = self.envs[env_idx].reset()
---> 64 self._save_obs(env_idx, obs)
65 return self._obs_from_buf()
66
[/usr/local/lib/python3.7/dist-packages/stable_baselines3/common/vec_env/dummy_vec_env.py](https://localhost:8080/#) in _save_obs(self, env_idx, obs)
92 for key in self.keys:
93 if key is None:
---> 94 self.buf_obs[key][env_idx] = obs
95 else:
96 self.buf_obs[key][env_idx] = obs[key]
ValueError: could not broadcast input array from shape (14,6) into shape (22,14)
```
What am I missing ?
Please let me know if you require any additional info.The function to generate the env is as follows
```
def stableBaselineEnv(self):
sb = DummyVecEnv([lambda: self])
obs = sb.reset()
return sb, obs
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.