Assumes $x^{t+1} = x^{t}$ :param df: :param n_forward: :param test_ratio: :return:
(df, n_forward, test_ratio=0.2)
| 37 | |
| 38 | |
| 39 | def static_predict(df, n_forward, test_ratio=0.2): |
| 40 | """ |
| 41 | Assumes $x^{t+1} = x^{t}$ |
| 42 | :param df: |
| 43 | :param n_forward: |
| 44 | :param test_ratio: |
| 45 | :return: |
| 46 | """ |
| 47 | test_num = int(round(df.shape[0] * test_ratio)) |
| 48 | y_test = df[-test_num:] |
| 49 | y_predict = df.shift(n_forward).iloc[-test_num:] |
| 50 | return y_predict, y_test |
| 51 | |
| 52 | |
| 53 | def var_predict(df, n_forwards=(1, 3), n_lags=4, test_ratio=0.2): |