AI4Finance-Foundation / AI4Finance-Foundation/FinRL

Full dataset normalization biases test set

オープン
#1,238 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
Jupyter Notebook
スター
16.3k
フォーク
3.5k
PR マージ指標
30日以内にマージされた PR はありません

説明

In [FinRL_PortfolioOptimizationEnv_Demo.ipynb](https://github.com/AI4Finance-Foundation/FinRL/blob/master/examples/FinRL_PortfolioOptimizationEnv_Demo.ipynb) all data used for training and testing are normalised at once:
```
portfolio_norm_df = GroupByScaler(by="tic", scaler=MaxAbsScaler).fit_transform(portfolio_raw_df)
```
By doing so we tell the model when across all our observations (training + test) the stock price of a given position in the portfolio has been the highest.

@C4i0kun should we not instead normalize only the batch of observations for a given time step? Avoiding to introduce forward looking information, that is supposed to be unknown.
For example, we could delegate the normalisation to env_portfolio_optimization.py:

```
# define data to be used in this time step
self._data_raw = self._df[
(self._df[self._time_column] >= start_time)
& (self._df[self._time_column] <= end_time)
][[self._time_column, self._tic_column] + self._features]

# normalise observations
self._data = GroupByScaler(by="tic", scaler=MaxAbsScaler, columns=['close','high','low']).fit_transform(self._data_raw)
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。