Ceruleanacg / Personae

📈 Personae is a repo of implements and environment of Deep Reinforcement Learning & Supervised Learning for Quantitative Trading.
MIT License
1.33k stars 335 forks source link

In the RL algorithms, why label in training set is at t+2 while which in validate set is at time t+1 ? #21

Closed xtyangjie closed 6 years ago

xtyangjie commented 6 years ago

As asked in the title, in base/env/market.py, when generating sequences from orignal dataset, the label of training set is at time of t+2(data_index + 1) compared to x(from data_index - seq_len to data_index, a semi-closed interval), while when choosing label for the validate set, it is at t+1 instead.

Note that there is a tiny bug in master in the statement of instruments_y assiginment and I fixed in according to the code in dev branch.

` if date_index < self.bound_index:

    # Get y, y is not at date index, but plus 1. (Training Set)

    instruments_y = scaled_frame.iloc[date_index + 1]['close']

else:

    # Get y, y is at date index. (Test Set)

    instruments_y = scaled_frame.iloc[date_index]['close'] # data_index + 1 --> data_index here

`

Thanks for your answer :)

xtyangjie commented 6 years ago

In addition, I had post an email to @Ceruleanacg before, while it may be a better approach to send the question here (to make a record). It could help owners to collect information about my question, too.

Another question in the mail is posted in the next issue seperately.

Ceruleanacg commented 6 years ago

We had a talk in WeChat.