second method: Sarimax sarimax is a statistic method which using previous input and learn its pattern to predict future data input : training data (total_user, with exog data = total_event) in list of float output : list of total user prediction in float >>> sarimax_predicto
(train_user: list, train_match: list, test_match: list)
| 38 | |
| 39 | |
| 40 | def sarimax_predictor(train_user: list, train_match: list, test_match: list) -> float: |
| 41 | """ |
| 42 | second method: Sarimax |
| 43 | sarimax is a statistic method which using previous input |
| 44 | and learn its pattern to predict future data |
| 45 | input : training data (total_user, with exog data = total_event) in list of float |
| 46 | output : list of total user prediction in float |
| 47 | >>> sarimax_predictor([4,2,6,8], [3,1,2,4], [2]) |
| 48 | 6.6666671111109626 |
| 49 | """ |
| 50 | # Suppress the User Warning raised by SARIMAX due to insufficient observations |
| 51 | simplefilter("ignore", UserWarning) |
| 52 | order = (1, 2, 1) |
| 53 | seasonal_order = (1, 1, 1, 7) |
| 54 | model = SARIMAX( |
| 55 | train_user, exog=train_match, order=order, seasonal_order=seasonal_order |
| 56 | ) |
| 57 | model_fit = model.fit(disp=False, maxiter=600, method="nm") |
| 58 | result = model_fit.predict(1, len(test_match), exog=[test_match]) |
| 59 | return float(result[0]) |
| 60 | |
| 61 | |
| 62 | def support_vector_regressor(x_train: list, x_test: list, train_user: list) -> float: |