Various utilities for time series forecasting.
Project description
TSUtilities v0.0.2
Recent Changes
pip install TSUtilities:
pip install TSUtilities
Example of trend dampening:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
sns.set_style('darkgrid')
y = np.linspace(0, 100, 100)
plt.plot(y)
plt.show()
y_train = y[:80]
future_y = y[80:]
future_trend = future_y
from TSUtilities.TSTrend.trend_dampen import TrendDampen
dampener = TrendDampen(damp_factor=.7,
damp_style='smooth')
dampened_trend = dampener.dampen(future_trend)
Example of Prophet Trend Dampening helper function where ts is your input to prophet:
from TSUtilities.functions import dampen_prophet
prophet = Prophet()
prophet.fit(ts)
fitted = prophet.predict()
# create a future data frame
future = prophet.make_future_dataframe(periods=len(y_test))
forecast = prophet.predict(future)
#get predictions and required data inputs for auto-damping
predictions = forecast.tail(len(y_test))
predicted_trend = predictions['trend'].values
trend_component = fitted['trend'].values
seasonality_component = fitted['additive_terms'].values
forecasts_no_dampen = predictions['yhat'].values
forecasts_damped = dampen_prophet(y=y.values,
fit_df=fitted,
forecast_df=forecast)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file TSUtilities-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: TSUtilities-0.0.5-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db57afd25cb7e7757214445c98105c5575318c11f9a411ace5267ca503becb30 |
|
MD5 | 479582a04424612e63ba674a73115316 |
|
BLAKE2b-256 | f2ccd8244868f24dc0c2e90a21755ebac962128c5505cd1dca4139db973589e2 |