Title: | A Software Development Kit for 'Nixtla''s 'TimeGPT' |
---|---|
Description: | A Software Development Kit for working with 'Nixtla''s 'TimeGPT', a foundation model for time series forecasting. 'API' is an acronym for 'application programming interface'; this package allows users to interact with 'TimeGPT' via the 'API'. You can set and validate 'API' keys and generate forecasts via 'API' calls. It is compatible with 'tsibble' and base R. For more details visit <https://docs.nixtla.io/>. |
Authors: | Mariana Menchero [aut, cre] (First author and maintainer), Nixtla [cph] (Copyright held by 'Nixtla') |
Maintainer: | Mariana Menchero <[email protected]> |
License: | Apache License (>= 2.0) |
Version: | 0.6.2 |
Built: | 2024-10-29 06:54:33 UTC |
Source: | CRAN |
Contains prices of different electricity markets.
electricity
electricity
electricity
A data frame with 8400 rows and 3 columns:
Unique identifiers of the electricity markets.
Date in format YYYY:MM:DD hh:mm:ss.
Price for the given market and date.
Contains prices of different electricity markets with exogenous variables.
electricity_exo_vars
electricity_exo_vars
electricity_exo_vars
A data frame with 8400 rows and 12 columns:
Unique identifiers of the electricity markets.
Date in format YYYY:MM:DD hh:mm:ss.
Price for the given market and date.
An external factor influencing prices. For all markets, some form of day-ahead load forecast.
An external factor influencing prices. For "BE" and "FR" markets, the day-ahead generation forecast. For "NP", the day-ahead wind generation forecast. For "PJM", the day-ahead load forecast in a specific zone. For "DE", the aggregated day-ahead wind and solar generation forecasts.
Binary variable indicating weekday.
Binary variable indicating weekday.
Binary variable indicating weekday.
Binary variable indicating weekday.
Binary variable indicating weekday.
Binary variable indicating weekday.
Binary variable indicating weekday.
Contains the future values of the exogenous variables of the electricity dataset (24 steps-ahead). To be used with electricity_exo_vars
.
electricity_future_exo_vars
electricity_future_exo_vars
electricity_future_exo_vars
A data frame with 120 rows and 11 columns:
Unique identifiers of the electricity markets.
Date in format YYYY:MM:DD hh:mm:ss.
An external factor influencing prices. For all markets, some form of day-ahead load forecast.
An external factor influencing prices. For "BE" and "FR" markets, the day-ahead generation forecast. For "NP", the day-ahead wind generation forecast. For "PJM", the day-ahead load forecast in a specific zone. For "DE", the aggregated day-ahead wind and solar generation forecasts.
Binary variable indicating weekday.
Binary variable indicating weekday.
Binary variable indicating weekday.
Binary variable indicating weekday.
Binary variable indicating weekday.
Binary variable indicating weekday.
Binary variable indicating weekday.
Infer frequency of a data frame.
infer_frequency(df, freq)
infer_frequency(df, freq)
df |
A data frame with time series data. |
freq |
The frequency of the data as specified by the user; NULL otherwise. |
The inferred frequency.
df <- nixtlar::electricity freq <- NULL infer_frequency(df, freq)
df <- nixtlar::electricity freq <- NULL infer_frequency(df, freq)
Sequential version of 'nixtla_client_historic' This is a private function of 'nixtlar'
nixtla_client_historic( df, freq = NULL, id_col = NULL, time_col = "ds", target_col = "y", level = NULL, quantiles = NULL, finetune_steps = 0, finetune_loss = "default", clean_ex_first = TRUE, model = "timegpt-1" )
nixtla_client_historic( df, freq = NULL, id_col = NULL, time_col = "ds", target_col = "y", level = NULL, quantiles = NULL, finetune_steps = 0, finetune_loss = "default", clean_ex_first = TRUE, model = "timegpt-1" )
df |
A tsibble or a data frame with time series data. |
freq |
Frequency of the data. |
id_col |
Column that identifies each series. |
time_col |
Column that identifies each timestep. |
target_col |
Column that contains the target variable. |
level |
The confidence levels (0-100) for the prediction intervals. |
quantiles |
Quantiles to forecast. Should be between 0 and 1. |
finetune_steps |
Number of steps used to finetune 'TimeGPT' in the new data. |
finetune_loss |
Loss function to use for finetuning. Options are: "default", "mae", "mse", "rmse", "mape", and "smape". |
clean_ex_first |
Clean exogenous signal before making the forecasts using 'TimeGPT'. |
model |
Model to use, either "timegpt-1" or "timegpt-1-long-horizon". Use "timegpt-1-long-horizon" if you want to forecast more than one seasonal period given the frequency of the data. |
'TimeGPT”s forecast for the in-sample period.
## Not run: nixtlar::nixtla_set_api_key("YOUR_API_KEY") df <- nixtlar::electricity fcst <- nixtlar::nixtla_client_historic(df, id_col="unique_id", level=c(80,95)) ## End(Not run)
## Not run: nixtlar::nixtla_set_api_key("YOUR_API_KEY") df <- nixtlar::electricity fcst <- nixtlar::nixtla_client_historic(df, id_col="unique_id", level=c(80,95)) ## End(Not run)
Plot the output of the following nixtla_client functions: forecast, historic, anomaly_detection, and cross_validation.
nixtla_client_plot( df, fcst = NULL, h = NULL, id_col = "unique_id", time_col = "ds", target_col = "y", unique_ids = NULL, max_insample_length = NULL, plot_anomalies = FALSE )
nixtla_client_plot( df, fcst = NULL, h = NULL, id_col = "unique_id", time_col = "ds", target_col = "y", unique_ids = NULL, max_insample_length = NULL, plot_anomalies = FALSE )
df |
A tsibble or a data frame with time series data (insample values). |
fcst |
A tsibble or a data frame with the 'TimeGPT' point forecast and the prediction intervals (if available). |
h |
Forecast horizon. |
id_col |
Column that identifies each series. |
time_col |
Column that identifies each timestep. |
target_col |
Column that contains the target variable. |
unique_ids |
Time series to plot. If NULL (default), selection will be random. |
max_insample_length |
Max number of insample observations to be plotted. |
plot_anomalies |
Whether or not to plot anomalies. |
Plot with historical data and 'TimeGPT”s output (if available).
## Not run: nixtlar::nixtla_set_api_key("YOUR_API_KEY") df <- nixtlar::electricity fcst <- nixtlar::nixtla_client_forecast(df, h=8, id_col="unique_id", level=c(80,95)) nixtlar::timegpt_plot(df, fcst, h=8, id_col="unique_id") ## End(Not run)
## Not run: nixtlar::nixtla_set_api_key("YOUR_API_KEY") df <- nixtlar::electricity fcst <- nixtlar::nixtla_client_forecast(df, h=8, id_col="unique_id", level=c(80,95)) nixtlar::timegpt_plot(df, fcst, h=8, id_col="unique_id") ## End(Not run)
Set base 'ULR' and 'API' key in global environment
nixtla_client_setup(base_url = NULL, api_key = NULL)
nixtla_client_setup(base_url = NULL, api_key = NULL)
base_url |
Custom base 'URL'. If NULL, defaults to "https://api.nixtla.io/". |
api_key |
The user's 'API' key. Get yours here: https://dashboard.nixtla.io/ |
A message indicating the configuration status.
## Not run: nixtlar::nixtla_client_setup( base_url = "Base URL", api_key = "Your API key" ) ## End(Not run)
## Not run: nixtlar::nixtla_client_setup( base_url = "Base URL", api_key = "Your API key" ) ## End(Not run)
This function will be deprecated in future versions. Please use nixtla_client_setup
instead.
nixtla_set_api_key(api_key)
nixtla_set_api_key(api_key)
api_key |
The user's 'API' key. Get yours here: https://dashboard.nixtla.io/ |
A message indicating the 'API' key has been set in the global environment.
## Not run: nixtlar::nixtla_set_api_key("Your API key") ## End(Not run)
## Not run: nixtlar::nixtla_set_api_key("Your API key") ## End(Not run)
Validate 'API' key
nixtla_validate_api_key()
nixtla_validate_api_key()
TRUE if the API key is valid, FALSE otherwise.
## Not run: nixtlar::nixtla_client_setup(api_key = "Your API key") nixtlar::nixtla_validate_api_key() ## End(Not run)
## Not run: nixtlar::nixtla_client_setup(api_key = "Your API key") nixtlar::nixtla_validate_api_key() ## End(Not run)