Skip to content

Commit

Permalink
Update README.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-j-l2f authored and deatinor committed Dec 20, 2019
1 parent 025ad71 commit 8bea403
Showing 1 changed file with 59 additions and 6 deletions.
65 changes: 59 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ Time Series Forecasting Model

Giotto-time provide the GAR class (Generalize Auto Regressive model). It operates in a similar way to the standard AR, but with an arbitrary number of features and with an arbitrary underlying regression model.

.. image:: https://storage.googleapis.com/l2f-open-models/giotto-time/images/gar.png
:height: 100px
:width: 200 px
:scale: 50 %
:alt: alternate text
:align: center
.. raw:: html

<p align="center">
<img width="460" src="https://storage.googleapis.com/l2f-open-models/giotto-time/images/gar.png">
</p>

This model allows the full force of machine learning regressors (compatible with the fit-transform framework ok scikit-learn) to be combined with advanced feature creation stratagies to forecast time series in a convienent api.

Expand All @@ -52,6 +51,7 @@ This model allows the full force of machine learning regressors (compatible with
>>> horizon=4,
>>> features = [ShiftFeature(1), ShiftFeature(2), MovingAverageFeature(5)]
>>> )
>>>
>>> train_test_splitter = TrainTestSplitter()
>>> time_series_model = GAR(base_model=LinearRegressor())
>>>
Expand All @@ -67,6 +67,15 @@ Time Series Preparation

To transform an input array-like structure into a DataFrame with a PeriodIndex we provide the classes:

To transform an input array-like structure into a DataFrame with a PeriodIndex we provide the classes:

* TimeSeriesPreparation
* TimeSeriesConversion
* SequenceToTimeIndexSeries
* PandasSeriesToTimeIndexSeries
* TimeIndexSeriesToPeriodIndexSeries


Feature Creation
================

Expand All @@ -84,4 +93,48 @@ These features all have a scikit-learn-like interface and behave as transformers

The class FeatureCreation wraps a list of features together and returns the X and y matrices from a time series given as input.

Time Series Trend Model
=======================

We provide main classes to analyze and remove trends from time series in order to create trend stationary time series.

Specifically, giotto-time includes ExponentialTrend, PolynomialTrend model classes and de-trending transformers.

>>> import numpy as np
>>> import pandas as pd
>>>
>>> import matplotlib.pyplot as plt
>>>
>>> from giottotime.models.regressors.linear_regressor import LinearRegressor
>>> from giottotime.loss_functions.loss_functions import max_error, smape
>>>
>>> from giottotime.models.trend_models.polynomial_trend import PolynomialTrend
>>>
>>> from math import pi
>>>
>>> d = pd.read_csv('trend.csv', index_col=0, parse_dates=True)
>>> tm = PolynomialTrend(order=3)
>>>
>>> tm.fit(d)
>>>
>>> d.plot(figsize=(10, 10))
>>> plt.show()
>>>
>>> detrended = tm.transform(d)
>>>
>>> detrended.plot(figsize=(10, 10))
>>> plt.show()

.. raw:: html

<table style="width:100%">
<tr>
<th><img width="460" src="https://storage.googleapis.com/l2f-open-models/giotto-time/images/trend.png"></th>
<th><img width="460" src="https://storage.googleapis.com/l2f-open-models/giotto-time/images/no_trend.png"></th>
</tr>
</table>

Before the detrending tranformer, a clear quadratic trend is present in the data. For additional information on trend stationarity, see: Trend stationarity: Wikipedia - https://en.wikipedia.org/wiki/Trend_stationary.



0 comments on commit 8bea403

Please sign in to comment.