date_features
function.
👍 Use an Azure AI endpoint To use an Azure AI endpoint, remember to set also thebase_url
argument:nixtla_client = NixtlaClient(base_url="you azure ai endpoint", api_key="your api_key")
month | chocolate | |
---|---|---|
0 | 2004-01-31 | 35 |
1 | 2004-02-29 | 45 |
2 | 2004-03-31 | 28 |
3 | 2004-04-30 | 30 |
4 | 2004-05-31 | 29 |
month | US_New Year’s Day | US_Memorial Day | US_Juneteenth National Independence Day | US_Independence Day | US_Labor Day | US_Veterans Day | US_Thanksgiving | US_Christmas Day | US_Martin Luther King Jr. Day | US_Washington’s Birthday | US_Columbus Day | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 2024-05-31 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | 2024-06-30 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2 | 2024-07-31 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
3 | 2024-08-31 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
4 | 2024-09-30 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
month | chocolate | US_New Year’s Day | US_New Year’s Day (observed) | US_Memorial Day | US_Independence Day | US_Independence Day (observed) | US_Labor Day | US_Veterans Day | US_Thanksgiving | US_Christmas Day | US_Christmas Day (observed) | US_Martin Luther King Jr. Day | US_Washington’s Birthday | US_Columbus Day | US_Veterans Day (observed) | US_Juneteenth National Independence Day | US_Juneteenth National Independence Day (observed) | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
239 | 2023-12-31 | 90 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
240 | 2024-01-31 | 64 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
241 | 2024-02-29 | 66 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
242 | 2024-03-31 | 59 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
243 | 2024-04-30 | 51 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
📘 Available models in Azure AI If you are using an Azure AI endpoint, please be sure to setmodel="azureai"
:nixtla_client.forecast(..., model="azureai")
For the public API, we support two models:timegpt-1
andtimegpt-1-long-horizon
. By default,timegpt-1
is used. Please see this tutorial on how and when to usetimegpt-1-long-horizon
.
date_features
parameter works:
date_features
(bool or list of str or callable): This
parameter specifies which date attributes to consider.
True
, the model will automatically add the most
common date features related to the frequency of the given
dataframe (df
). For a daily frequency, this could include
features like day of the week, month, and year.date_features=['weekday', 'month']
will only add the day of
the week and month as features.date_features_to_one_hot
(bool or list of str): After
determining the date features, one might want to one-hot encode
them, especially if they are categorical in nature (like weekdays).
One-hot encoding transforms these categorical features into a binary
matrix, making them more suitable for many machine learning
algorithms.
date_features=True
, then by default, all computed date
features will be one-hot encoded.date_features
and date_features_to_one_hot
parameters, one can efficiently incorporate the temporal effects of date
attributes into their forecasting model, potentially enhancing its
accuracy and interpretability.