Optimize Objective Functions
ts_df = simulate_data.pandas_time_series()
alpha = minimize_simple_smoothing(ts=ts_df.time_series.to_numpy(),)
_, fig = smoothing.SINGLE(
alpha,
df=ts_df,
ts_col='time_series',
)
ts_df = simulate_data.pandas_time_series()
res = minimize_double_smoothing(ts=ts_df.time_series.to_numpy(),)
res
_, fig = smoothing.DOUBLE(
res,
df=ts_df,
ts_col='time_series',
)
fig.show()
datafile = '../data/superstore_sales.csv'
url = "https://raw.githubusercontent.com/" + \
"BigDataGal/Python-for-Data-Science/master/Superstore-Sales.csv"
if not path.isfile(datafile):
with open(datafile, 'w') as file:
r = requests.get(url)
file.write(r.text)
df = pd.read_csv(
datafile,
index_col='Order Date',
dtype={
'Row ID': str,
'Order ID': str,
},
parse_dates=['Order Date', 'Ship Date'],
)
df.columns = ['_'.join(x.lower().split(' ')) for x in df.columns]
dff = df.head(int(0.4 * len(df)))
minimize_simple_smoothing(dff.sales.to_numpy())
_, fig = smoothing.SINGLE(1., df=dff.copy(), ts_col='sales')
fig.show()
del sma(**args):
ar