Skip to main content

Put a description

Project description

Forecasting Basics

Documentation and Code is hosted on Github

Generate and Plot Forecasts for Time Series Data

Includes:SMA, WMA and Single and Double Exponential Smoothing

Install

pip install time-series-model-basics

Simple Moving Average

Plot a Simulated Time Series with two or any number of Simple Moving Averages as follows:

from time_series_model_basics.moving_average import SMA

df, fig = SMA(1, 4)

fig.write_image("images/sma.png")

When running on a notebook you may alternatively use

fig.show()

Forecast with dataframe as follows:

import pandas as pd

df = pd.read_csv(
    '../data/Electric_Production.csv',
    index_col='DATE',
    parse_dates=['DATE'],
)
ts_col = 'Electric Production'
df.columns = [ts_col]
_, fig = SMA(
    4,
    df=df,
    ts_col=ts_col,
)
fig.update_layout(
    autosize=False,
    width=1100,
    height=450,
)
fig.update_traces(line=dict(width=0.8))
fig.write_image("images/elec_prod_sma.png",)

Weighted Moving Average

For the case of Weighted Moving Averages, pass the weights as lists:

from time_series_model_basics.moving_average import WMA

df,fig = WMA([1,1,2],[3,2])

fig.write_image("images/wma.png")

Simple Smoothing

Plot a Simulated Time Series with two or any number of simple exponential smoothing as follows:

from time_series_model_basics.smoothing import SINGLE

df, fig = SINGLE(.15, .5)
fig.write_image("images/single.png",)

Double Smoothing

from time_series_model_basics.smoothing import DOUBLE

df, fig = DOUBLE(
    [.25, .3],
    [.5, .6],
)
fig.write_image("images/double.png")

Author

  • Enrique Jimenez

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

time_series_model_basics-0.0.5.tar.gz (15.6 kB view hashes)

Uploaded Source

Built Distribution

time_series_model_basics-0.0.5-py3-none-any.whl (15.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page