unique_id
with a unique identifier for each time serie *
ds
with the datestamp and a column * y
with the values of the
serie.
Every other column is considered a static feature unless stated
otherwise in TimeSeries.fit
unique_id | ds | y | static_0 | static_1 | |
---|---|---|---|---|---|
0 | id_00 | 2000-01-01 | 7.404529 | 27 | 53 |
1 | id_00 | 2000-01-02 | 35.952624 | 27 | 53 |
2 | id_00 | 2000-01-03 | 68.958353 | 27 | 53 |
3 | id_00 | 2000-01-04 | 84.994505 | 27 | 53 |
4 | id_00 | 2000-01-05 | 113.219810 | 27 | 53 |
… | … | … | … | … | … |
4869 | id_19 | 2000-03-25 | 400.606807 | 97 | 45 |
4870 | id_19 | 2000-03-26 | 538.794824 | 97 | 45 |
4871 | id_19 | 2000-03-27 | 620.202104 | 97 | 45 |
4872 | id_19 | 2000-03-28 | 20.625426 | 97 | 45 |
4873 | id_19 | 2000-03-29 | 141.513169 | 97 | 45 |
unique_id | ds | y | static_0 | static_1 | |
---|---|---|---|---|---|
0 | id_00 | 2000-01-01 | 7.404529 | 27 | 53 |
1 | id_00 | 2000-01-02 | 35.952624 | 27 | 53 |
2 | id_00 | 2000-01-03 | 68.958353 | 27 | 53 |
3 | id_00 | 2000-01-04 | 84.994505 | 27 | 53 |
4 | id_00 | 2000-01-05 | 113.219810 | 27 | 53 |
… | … | … | … | … | … |
217 | id_00 | 2000-08-05 | 13.263188 | 27 | 53 |
218 | id_00 | 2000-08-06 | 38.231981 | 27 | 53 |
219 | id_00 | 2000-08-07 | 59.555183 | 27 | 53 |
220 | id_00 | 2000-08-08 | 86.986368 | 27 | 53 |
221 | id_00 | 2000-08-09 | 119.254810 | 27 | 53 |
Utility class for storing and transforming time series data. The
TimeSeries
class takes care of defining the transformations to be performed
(lags
, lag_transforms
and date_features
). The transformations can
be computed using multithreading if num_threads > 1
.
build_transform_name
and the
value is a tuple where the first element is the lag it is applied to,
then the function and then the function arguments.
lags
we define the transformation as the identity
function applied to its corresponding lag. This is because
_transform_series
takes the lag as an argument and shifts the array before computing the
transformation.
*Add the features to
data
and save the required information for the
predictions step.
If not all features are static, specify which ones are in
static_features
. If you don’t want to drop rows with null values after
the transformations set dropna=False
If keep_last_n
is not None then
that number of observations is kept across all series for updates.*
ga
. If
the data type of the series values is an int then it is converted to
np.float32
, this is because lags generate np.nan
s so we need a float
data type for them.
uids
attribute.
y
and ds
columns are taken
as static features.
static_features
to
TimeSeries.fit_transform
then only these are kept.
TimeSeries.fit_transform
requires that the y column doesn’t have any null values. This is
because the transformations could propagate them forward, so if you have
null values in the y column you’ll get an error.
Once we have a trained model we can use
TimeSeries.predict
passing the model and the horizon to get the predictions back.
X_df
.
Update the values of the stored series.