This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
opt.best_estimator_.steps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
opt.best_estimator_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
opt.fit(X_train, y_train) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df.info() | |
df['result'].value_counts() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pmdarima as pm | |
auto_arima = pm.auto_arima(df_train, stepwise=False, seasonal=False) | |
auto_arima |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msk = (df.index < len(df)-30) | |
df_train = df[msk].copy() | |
df_test = df[~msk].copy() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.metrics import mean_absolute_error, mean_absolute_percentage_error, mean_squared_error | |
mae = mean_absolute_error(df_test, forecast_test) | |
mape = mean_absolute_percentage_error(df_test, forecast_test) | |
rmse = np.sqrt(mean_squared_error(df_test, forecast_test)) | |
print(f'mae - manual: {mae}') | |
print(f'mape - manual: {mape}') | |
print(f'rmse - manual: {rmse}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
forecast_test_auto = auto_arima.predict(n_periods=len(df_test)) | |
df['forecast_auto'] = [None]*len(df_train) + list(forecast_test_auto) | |
df.plot() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mae = mean_absolute_error(df_test, forecast_test_auto) | |
mape = mean_absolute_percentage_error(df_test, forecast_test_auto) | |
rmse = np.sqrt(mean_squared_error(df_test, forecast_test_auto)) | |
print(f'mae - auto: {mae}') | |
print(f'mape - auto: {mape}') | |
print(f'rmse - auto: {rmse}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto_arima.summary() |