text_html_output_1.png image_output_1.png
from flaml import AutoML

from flaml import AutoML

import numpy as np

import pandas as pd

train = pd.read_csv('../input/juniper-networks-global-ai-challenge/training_dataset.csv')
test = pd.read_csv('../input/juniper-networks-global-ai-challenge/test_dataset.csv')

train.register__sales_dollar_amt_this_hour.plot.density(color='red')

y_train = train['register__sales_dollar_amt_this_hour']
train = train.drop(['region__peak_sales_dollar_amt_per_hour_v2', 'region__peak_returns_dollar_amt_per_hour_v2', 'Unnamed: 0'], axis=1)
test = test.drop(['region__peak_sales_dollar_amt_per_hour_v2', 'region__peak_returns_dollar_amt_per_hour_v2'], axis=1)

train['observation_timestamp'] = pd.to_datetime(train['observation_timestamp'])
test['observation_timestamp'] = pd.to_datetime(test['observation_timestamp'])

pd.to_datetime(train['observation_timestamp']).dt.month

import datetime as dt
train['weekday'] = pd.to_datetime(train['observation_timestamp']).dt.weekday
train['weekend'] = np.where(train['weekday'] < 5, 0, 1)
test['weekday'] = pd.to_datetime(test['observation_timestamp']).dt.weekday
test['weekend'] = np.where(test['weekday'] < 5, 0, 1)
train['month'] = pd.to_datetime(train['observation_timestamp']).dt.month
test['month'] = pd.to_datetime(train['observation_timestamp']).dt.month
train = train.drop(['observation_id', 'observation_timestamp'], axis=1)
test = test.drop(['observation_id', 'observation_timestamp'], axis=1)

x_train = train.drop('register__sales_dollar_amt_this_hour', axis=1)

(x_train.shape, test.shape)

from flaml import AutoML
automl = AutoML()
automl.fit(x_train, y_train, task='regression', metric='r2', time_budget=180, n_splits=5, ensemble=False, estimator_list=['lgbm'])