AminHP / gym-anytrading

The most simple, flexible, and comprehensive OpenAI Gym trading environment (Approved by OpenAI Gym)
MIT License
2.1k stars 465 forks source link

flatten() #22

Closed jabowery closed 4 years ago

jabowery commented 4 years ago

I'm finding it difficult to use this because of the need to flatten the signal_features into a single vector so as to simplify later shapes for higher order matrix multiplications.

AminHP commented 4 years ago

What do you mean by "need to flatten the signal features" exactly? Can you give an example?

jabowery commented 4 years ago

I figured out how to do what I wanted by strategic placement of the flatten() call. I was taking the signal_features, flatten()ing them into a single state vector and feeding them into a pytorch Linear layer in parallel, rather than treating them as a time series of features. So the number of dimensions in the state space is a factor of window_size larger than normal. Where the "higher order" matrix multiplications come in is an optimization I was doing to use the same feed forward call I used on single instances to do batch instances all at once in the same call by adding a dimension.