From 7a3e52a4d03cb8af69aed688533ceec25d64859d Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Sun, 7 Apr 2024 19:38:00 -0600 Subject: [PATCH] :herb: Fern Regeneration -- April 6, 2024 (#287) Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com> --- nixtlats/client.py | 36 +++++++++++++++++++ nixtlats/types/multi_series_anomaly.py | 2 +- nixtlats/types/multi_series_anomaly_model.py | 22 +++++++----- .../types/multi_series_cross_validation.py | 14 ++++---- ...ti_series_cross_validation_fewshot_loss.py | 2 +- ...i_series_cross_validation_finetune_loss.py | 2 +- .../multi_series_cross_validation_model.py | 22 +++++++----- nixtlats/types/multi_series_forecast.py | 14 ++++---- .../multi_series_forecast_fewshot_loss.py | 2 +- .../multi_series_forecast_finetune_loss.py | 2 +- nixtlats/types/multi_series_forecast_model.py | 22 +++++++----- .../types/multi_series_insample_forecast.py | 2 +- .../multi_series_insample_forecast_model.py | 22 +++++++----- nixtlats/types/single_series_forecast.py | 14 ++++---- .../single_series_forecast_fewshot_loss.py | 2 +- .../single_series_forecast_finetune_loss.py | 2 +- .../types/single_series_forecast_model.py | 22 +++++++----- .../types/single_series_insample_forecast.py | 2 +- .../single_series_insample_forecast_model.py | 22 +++++++----- 19 files changed, 144 insertions(+), 84 deletions(-) diff --git a/nixtlats/client.py b/nixtlats/client.py index a2d89a1e..77a8d77b 100644 --- a/nixtlats/client.py +++ b/nixtlats/client.py @@ -61,6 +61,24 @@ def validate_token_front(self) -> typing.Any: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + def health_health_get(self) -> typing.Any: + """ + Check if server is healthy. Used by the readiness probe to check server is healthy. + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "health"), + headers=self._client_wrapper.get_headers(), + timeout=60, + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + def forecast(self, *, request: SingleSeriesForecast) -> typing.Any: """ This endpoint predicts the future values of a single time series based on the provided data. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values based on the input arguments. Get your token for private beta at https://dashboard.nixtla.io @@ -476,6 +494,24 @@ async def validate_token_front(self) -> typing.Any: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + async def health_health_get(self) -> typing.Any: + """ + Check if server is healthy. Used by the readiness probe to check server is healthy. + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "health"), + headers=self._client_wrapper.get_headers(), + timeout=60, + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + async def forecast(self, *, request: SingleSeriesForecast) -> typing.Any: """ This endpoint predicts the future values of a single time series based on the provided data. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values based on the input arguments. Get your token for private beta at https://dashboard.nixtla.io diff --git a/nixtlats/types/multi_series_anomaly.py b/nixtlats/types/multi_series_anomaly.py index b83cd0fa..ce548bc9 100644 --- a/nixtlats/types/multi_series_anomaly.py +++ b/nixtlats/types/multi_series_anomaly.py @@ -12,7 +12,7 @@ class MultiSeriesAnomaly(pydantic.BaseModel): model: typing.Optional[MultiSeriesAnomalyModel] = pydantic.Field( - description="Model to use as a string. Options are: `short-horizon`, and `long-horizon.` We recommend using `long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data." + description="Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data." ) freq: typing.Optional[str] = pydantic.Field( description="The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available." diff --git a/nixtlats/types/multi_series_anomaly_model.py b/nixtlats/types/multi_series_anomaly_model.py index 11798b22..96db3cb9 100644 --- a/nixtlats/types/multi_series_anomaly_model.py +++ b/nixtlats/types/multi_series_anomaly_model.py @@ -8,26 +8,30 @@ class MultiSeriesAnomalyModel(str, enum.Enum): """ - Model to use as a string. Options are: `short-horizon`, and `long-horizon.` We recommend using `long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data. + Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data. """ - SHORT_HORIZON = "short-horizon" - LONG_HORIZON = "long-horizon" TIMEGPT_1 = "timegpt-1" TIMEGPT_1_LONG_HORIZON = "timegpt-1-long-horizon" + SHORT_HORIZON = "short-horizon" + LONG_HORIZON = "long-horizon" + AZUREAI = "azureai" def visit( self, - short_horizon: typing.Callable[[], T_Result], - long_horizon: typing.Callable[[], T_Result], timegpt_1: typing.Callable[[], T_Result], timegpt_1_long_horizon: typing.Callable[[], T_Result], + short_horizon: typing.Callable[[], T_Result], + long_horizon: typing.Callable[[], T_Result], + azureai: typing.Callable[[], T_Result], ) -> T_Result: - if self is MultiSeriesAnomalyModel.SHORT_HORIZON: - return short_horizon() - if self is MultiSeriesAnomalyModel.LONG_HORIZON: - return long_horizon() if self is MultiSeriesAnomalyModel.TIMEGPT_1: return timegpt_1() if self is MultiSeriesAnomalyModel.TIMEGPT_1_LONG_HORIZON: return timegpt_1_long_horizon() + if self is MultiSeriesAnomalyModel.SHORT_HORIZON: + return short_horizon() + if self is MultiSeriesAnomalyModel.LONG_HORIZON: + return long_horizon() + if self is MultiSeriesAnomalyModel.AZUREAI: + return azureai() diff --git a/nixtlats/types/multi_series_cross_validation.py b/nixtlats/types/multi_series_cross_validation.py index 6c227a41..4b1c1ff1 100644 --- a/nixtlats/types/multi_series_cross_validation.py +++ b/nixtlats/types/multi_series_cross_validation.py @@ -13,8 +13,12 @@ class MultiSeriesCrossValidation(pydantic.BaseModel): + fewshot_steps: typing.Optional[int] = pydantic.Field(description="Deprecated. Please use finetune_steps instead.") + fewshot_loss: typing.Optional[MultiSeriesCrossValidationFewshotLoss] = pydantic.Field( + description="Deprecated. Please use finetune_loss instead." + ) model: typing.Optional[MultiSeriesCrossValidationModel] = pydantic.Field( - description="Model to use as a string. Options are: `short-horizon`, and `long-horizon.` We recommend using `long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data." + description="Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data." ) freq: typing.Optional[str] = pydantic.Field( description="The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available." @@ -36,15 +40,11 @@ class MultiSeriesCrossValidation(pydantic.BaseModel): clean_ex_first: typing.Optional[bool] = pydantic.Field( description="A boolean flag that indicates whether the API should preprocess (clean) the exogenous signal before applying the large time model. If True, the exogenous signal is cleaned; if False, the exogenous variables are applied after the large time model." ) - fewshot_steps: typing.Optional[int] = pydantic.Field( + finetune_steps: typing.Optional[int] = pydantic.Field( description="The number of tuning steps used to train the large time model on the data. Set this value to 0 for zero-shot inference, i.e., to make predictions without any further model tuning." ) - fewshot_loss: typing.Optional[MultiSeriesCrossValidationFewshotLoss] = pydantic.Field( - description="The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers." - ) - finetune_steps: typing.Optional[int] = pydantic.Field(description="Deprecated. Please use fewshot_steps instead.") finetune_loss: typing.Optional[MultiSeriesCrossValidationFinetuneLoss] = pydantic.Field( - description="Deprecated. Please use fewshot_loss instead." + description="The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers." ) def json(self, **kwargs: typing.Any) -> str: diff --git a/nixtlats/types/multi_series_cross_validation_fewshot_loss.py b/nixtlats/types/multi_series_cross_validation_fewshot_loss.py index a502aa6c..9c59ecc5 100644 --- a/nixtlats/types/multi_series_cross_validation_fewshot_loss.py +++ b/nixtlats/types/multi_series_cross_validation_fewshot_loss.py @@ -8,7 +8,7 @@ class MultiSeriesCrossValidationFewshotLoss(str, enum.Enum): """ - The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers. + Deprecated. Please use finetune_loss instead. """ DEFAULT = "default" diff --git a/nixtlats/types/multi_series_cross_validation_finetune_loss.py b/nixtlats/types/multi_series_cross_validation_finetune_loss.py index 78130331..b4a08b2a 100644 --- a/nixtlats/types/multi_series_cross_validation_finetune_loss.py +++ b/nixtlats/types/multi_series_cross_validation_finetune_loss.py @@ -8,7 +8,7 @@ class MultiSeriesCrossValidationFinetuneLoss(str, enum.Enum): """ - Deprecated. Please use fewshot_loss instead. + The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers. """ DEFAULT = "default" diff --git a/nixtlats/types/multi_series_cross_validation_model.py b/nixtlats/types/multi_series_cross_validation_model.py index c84d4e82..046c6007 100644 --- a/nixtlats/types/multi_series_cross_validation_model.py +++ b/nixtlats/types/multi_series_cross_validation_model.py @@ -8,26 +8,30 @@ class MultiSeriesCrossValidationModel(str, enum.Enum): """ - Model to use as a string. Options are: `short-horizon`, and `long-horizon.` We recommend using `long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data. + Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data. """ - SHORT_HORIZON = "short-horizon" - LONG_HORIZON = "long-horizon" TIMEGPT_1 = "timegpt-1" TIMEGPT_1_LONG_HORIZON = "timegpt-1-long-horizon" + SHORT_HORIZON = "short-horizon" + LONG_HORIZON = "long-horizon" + AZUREAI = "azureai" def visit( self, - short_horizon: typing.Callable[[], T_Result], - long_horizon: typing.Callable[[], T_Result], timegpt_1: typing.Callable[[], T_Result], timegpt_1_long_horizon: typing.Callable[[], T_Result], + short_horizon: typing.Callable[[], T_Result], + long_horizon: typing.Callable[[], T_Result], + azureai: typing.Callable[[], T_Result], ) -> T_Result: - if self is MultiSeriesCrossValidationModel.SHORT_HORIZON: - return short_horizon() - if self is MultiSeriesCrossValidationModel.LONG_HORIZON: - return long_horizon() if self is MultiSeriesCrossValidationModel.TIMEGPT_1: return timegpt_1() if self is MultiSeriesCrossValidationModel.TIMEGPT_1_LONG_HORIZON: return timegpt_1_long_horizon() + if self is MultiSeriesCrossValidationModel.SHORT_HORIZON: + return short_horizon() + if self is MultiSeriesCrossValidationModel.LONG_HORIZON: + return long_horizon() + if self is MultiSeriesCrossValidationModel.AZUREAI: + return azureai() diff --git a/nixtlats/types/multi_series_forecast.py b/nixtlats/types/multi_series_forecast.py index 487e283a..e45588f0 100644 --- a/nixtlats/types/multi_series_forecast.py +++ b/nixtlats/types/multi_series_forecast.py @@ -13,8 +13,12 @@ class MultiSeriesForecast(pydantic.BaseModel): + fewshot_steps: typing.Optional[int] = pydantic.Field(description="Deprecated. Please use finetune_steps instead.") + fewshot_loss: typing.Optional[MultiSeriesForecastFewshotLoss] = pydantic.Field( + description="Deprecated. Please use finetune_loss instead." + ) model: typing.Optional[MultiSeriesForecastModel] = pydantic.Field( - description="Model to use as a string. Options are: `short-horizon`, and `long-horizon.` We recommend using `long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data." + description="Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data." ) freq: typing.Optional[str] = pydantic.Field( description="The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available." @@ -32,15 +36,11 @@ class MultiSeriesForecast(pydantic.BaseModel): clean_ex_first: typing.Optional[bool] = pydantic.Field( description="A boolean flag that indicates whether the API should preprocess (clean) the exogenous signal before applying the large time model. If True, the exogenous signal is cleaned; if False, the exogenous variables are applied after the large time model." ) - fewshot_steps: typing.Optional[int] = pydantic.Field( + finetune_steps: typing.Optional[int] = pydantic.Field( description="The number of tuning steps used to train the large time model on the data. Set this value to 0 for zero-shot inference, i.e., to make predictions without any further model tuning." ) - fewshot_loss: typing.Optional[MultiSeriesForecastFewshotLoss] = pydantic.Field( - description="The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers." - ) - finetune_steps: typing.Optional[int] = pydantic.Field(description="Deprecated. Please use fewshot_steps instead.") finetune_loss: typing.Optional[MultiSeriesForecastFinetuneLoss] = pydantic.Field( - description="Deprecated. Please use fewshot_loss instead." + description="The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers." ) def json(self, **kwargs: typing.Any) -> str: diff --git a/nixtlats/types/multi_series_forecast_fewshot_loss.py b/nixtlats/types/multi_series_forecast_fewshot_loss.py index edd7d24b..48b2c47d 100644 --- a/nixtlats/types/multi_series_forecast_fewshot_loss.py +++ b/nixtlats/types/multi_series_forecast_fewshot_loss.py @@ -8,7 +8,7 @@ class MultiSeriesForecastFewshotLoss(str, enum.Enum): """ - The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers. + Deprecated. Please use finetune_loss instead. """ DEFAULT = "default" diff --git a/nixtlats/types/multi_series_forecast_finetune_loss.py b/nixtlats/types/multi_series_forecast_finetune_loss.py index 9edfcb79..f1665bd9 100644 --- a/nixtlats/types/multi_series_forecast_finetune_loss.py +++ b/nixtlats/types/multi_series_forecast_finetune_loss.py @@ -8,7 +8,7 @@ class MultiSeriesForecastFinetuneLoss(str, enum.Enum): """ - Deprecated. Please use fewshot_loss instead. + The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers. """ DEFAULT = "default" diff --git a/nixtlats/types/multi_series_forecast_model.py b/nixtlats/types/multi_series_forecast_model.py index f5b3c71d..d4a4be94 100644 --- a/nixtlats/types/multi_series_forecast_model.py +++ b/nixtlats/types/multi_series_forecast_model.py @@ -8,26 +8,30 @@ class MultiSeriesForecastModel(str, enum.Enum): """ - Model to use as a string. Options are: `short-horizon`, and `long-horizon.` We recommend using `long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data. + Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data. """ - SHORT_HORIZON = "short-horizon" - LONG_HORIZON = "long-horizon" TIMEGPT_1 = "timegpt-1" TIMEGPT_1_LONG_HORIZON = "timegpt-1-long-horizon" + SHORT_HORIZON = "short-horizon" + LONG_HORIZON = "long-horizon" + AZUREAI = "azureai" def visit( self, - short_horizon: typing.Callable[[], T_Result], - long_horizon: typing.Callable[[], T_Result], timegpt_1: typing.Callable[[], T_Result], timegpt_1_long_horizon: typing.Callable[[], T_Result], + short_horizon: typing.Callable[[], T_Result], + long_horizon: typing.Callable[[], T_Result], + azureai: typing.Callable[[], T_Result], ) -> T_Result: - if self is MultiSeriesForecastModel.SHORT_HORIZON: - return short_horizon() - if self is MultiSeriesForecastModel.LONG_HORIZON: - return long_horizon() if self is MultiSeriesForecastModel.TIMEGPT_1: return timegpt_1() if self is MultiSeriesForecastModel.TIMEGPT_1_LONG_HORIZON: return timegpt_1_long_horizon() + if self is MultiSeriesForecastModel.SHORT_HORIZON: + return short_horizon() + if self is MultiSeriesForecastModel.LONG_HORIZON: + return long_horizon() + if self is MultiSeriesForecastModel.AZUREAI: + return azureai() diff --git a/nixtlats/types/multi_series_insample_forecast.py b/nixtlats/types/multi_series_insample_forecast.py index 7c6f529e..d5961b47 100644 --- a/nixtlats/types/multi_series_insample_forecast.py +++ b/nixtlats/types/multi_series_insample_forecast.py @@ -12,7 +12,7 @@ class MultiSeriesInsampleForecast(pydantic.BaseModel): model: typing.Optional[MultiSeriesInsampleForecastModel] = pydantic.Field( - description="Model to use as a string. Options are: `short-horizon`, and `long-horizon.` We recommend using `long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data." + description="Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data." ) freq: typing.Optional[str] = pydantic.Field( description="The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available." diff --git a/nixtlats/types/multi_series_insample_forecast_model.py b/nixtlats/types/multi_series_insample_forecast_model.py index 9cba17a2..b229600e 100644 --- a/nixtlats/types/multi_series_insample_forecast_model.py +++ b/nixtlats/types/multi_series_insample_forecast_model.py @@ -8,26 +8,30 @@ class MultiSeriesInsampleForecastModel(str, enum.Enum): """ - Model to use as a string. Options are: `short-horizon`, and `long-horizon.` We recommend using `long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data. + Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data. """ - SHORT_HORIZON = "short-horizon" - LONG_HORIZON = "long-horizon" TIMEGPT_1 = "timegpt-1" TIMEGPT_1_LONG_HORIZON = "timegpt-1-long-horizon" + SHORT_HORIZON = "short-horizon" + LONG_HORIZON = "long-horizon" + AZUREAI = "azureai" def visit( self, - short_horizon: typing.Callable[[], T_Result], - long_horizon: typing.Callable[[], T_Result], timegpt_1: typing.Callable[[], T_Result], timegpt_1_long_horizon: typing.Callable[[], T_Result], + short_horizon: typing.Callable[[], T_Result], + long_horizon: typing.Callable[[], T_Result], + azureai: typing.Callable[[], T_Result], ) -> T_Result: - if self is MultiSeriesInsampleForecastModel.SHORT_HORIZON: - return short_horizon() - if self is MultiSeriesInsampleForecastModel.LONG_HORIZON: - return long_horizon() if self is MultiSeriesInsampleForecastModel.TIMEGPT_1: return timegpt_1() if self is MultiSeriesInsampleForecastModel.TIMEGPT_1_LONG_HORIZON: return timegpt_1_long_horizon() + if self is MultiSeriesInsampleForecastModel.SHORT_HORIZON: + return short_horizon() + if self is MultiSeriesInsampleForecastModel.LONG_HORIZON: + return long_horizon() + if self is MultiSeriesInsampleForecastModel.AZUREAI: + return azureai() diff --git a/nixtlats/types/single_series_forecast.py b/nixtlats/types/single_series_forecast.py index c9a60f15..fc5f80c3 100644 --- a/nixtlats/types/single_series_forecast.py +++ b/nixtlats/types/single_series_forecast.py @@ -12,8 +12,12 @@ class SingleSeriesForecast(pydantic.BaseModel): + fewshot_steps: typing.Optional[int] = pydantic.Field(description="Deprecated. Please use finetune_steps instead.") + fewshot_loss: typing.Optional[SingleSeriesForecastFewshotLoss] = pydantic.Field( + description="Deprecated. Please use finetune_loss instead." + ) model: typing.Optional[SingleSeriesForecastModel] = pydantic.Field( - description="Model to use as a string. Options are: `short-horizon`, and `long-horizon.` We recommend using `long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data." + description="Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data." ) freq: typing.Optional[str] = pydantic.Field( description="The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available." @@ -31,15 +35,11 @@ class SingleSeriesForecast(pydantic.BaseModel): clean_ex_first: typing.Optional[bool] = pydantic.Field( description="A boolean flag that indicates whether the API should preprocess (clean) the exogenous signal before applying the large time model. If True, the exogenous signal is cleaned; if False, the exogenous variables are applied after the large time model." ) - fewshot_steps: typing.Optional[int] = pydantic.Field( + finetune_steps: typing.Optional[int] = pydantic.Field( description="The number of tuning steps used to train the large time model on the data. Set this value to 0 for zero-shot inference, i.e., to make predictions without any further model tuning." ) - fewshot_loss: typing.Optional[SingleSeriesForecastFewshotLoss] = pydantic.Field( - description="The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers." - ) - finetune_steps: typing.Optional[int] = pydantic.Field(description="Deprecated. Please use fewshot_steps instead.") finetune_loss: typing.Optional[SingleSeriesForecastFinetuneLoss] = pydantic.Field( - description="Deprecated. Please use fewshot_loss instead." + description="The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers." ) def json(self, **kwargs: typing.Any) -> str: diff --git a/nixtlats/types/single_series_forecast_fewshot_loss.py b/nixtlats/types/single_series_forecast_fewshot_loss.py index ab7fefa2..d3dbe11f 100644 --- a/nixtlats/types/single_series_forecast_fewshot_loss.py +++ b/nixtlats/types/single_series_forecast_fewshot_loss.py @@ -8,7 +8,7 @@ class SingleSeriesForecastFewshotLoss(str, enum.Enum): """ - The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers. + Deprecated. Please use finetune_loss instead. """ DEFAULT = "default" diff --git a/nixtlats/types/single_series_forecast_finetune_loss.py b/nixtlats/types/single_series_forecast_finetune_loss.py index a52711ff..06fb8b1c 100644 --- a/nixtlats/types/single_series_forecast_finetune_loss.py +++ b/nixtlats/types/single_series_forecast_finetune_loss.py @@ -8,7 +8,7 @@ class SingleSeriesForecastFinetuneLoss(str, enum.Enum): """ - Deprecated. Please use fewshot_loss instead. + The loss used to train the large time model on the data. Select from ['default', 'mae', 'mse', 'rmse', 'mape', 'smape']. It will only be used if finetune_steps larger than 0. Default is a robust loss function that is less sensitive to outliers. """ DEFAULT = "default" diff --git a/nixtlats/types/single_series_forecast_model.py b/nixtlats/types/single_series_forecast_model.py index 3ef9520a..7ab1a64a 100644 --- a/nixtlats/types/single_series_forecast_model.py +++ b/nixtlats/types/single_series_forecast_model.py @@ -8,26 +8,30 @@ class SingleSeriesForecastModel(str, enum.Enum): """ - Model to use as a string. Options are: `short-horizon`, and `long-horizon.` We recommend using `long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data. + Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data. """ - SHORT_HORIZON = "short-horizon" - LONG_HORIZON = "long-horizon" TIMEGPT_1 = "timegpt-1" TIMEGPT_1_LONG_HORIZON = "timegpt-1-long-horizon" + SHORT_HORIZON = "short-horizon" + LONG_HORIZON = "long-horizon" + AZUREAI = "azureai" def visit( self, - short_horizon: typing.Callable[[], T_Result], - long_horizon: typing.Callable[[], T_Result], timegpt_1: typing.Callable[[], T_Result], timegpt_1_long_horizon: typing.Callable[[], T_Result], + short_horizon: typing.Callable[[], T_Result], + long_horizon: typing.Callable[[], T_Result], + azureai: typing.Callable[[], T_Result], ) -> T_Result: - if self is SingleSeriesForecastModel.SHORT_HORIZON: - return short_horizon() - if self is SingleSeriesForecastModel.LONG_HORIZON: - return long_horizon() if self is SingleSeriesForecastModel.TIMEGPT_1: return timegpt_1() if self is SingleSeriesForecastModel.TIMEGPT_1_LONG_HORIZON: return timegpt_1_long_horizon() + if self is SingleSeriesForecastModel.SHORT_HORIZON: + return short_horizon() + if self is SingleSeriesForecastModel.LONG_HORIZON: + return long_horizon() + if self is SingleSeriesForecastModel.AZUREAI: + return azureai() diff --git a/nixtlats/types/single_series_insample_forecast.py b/nixtlats/types/single_series_insample_forecast.py index 6228af4f..29eb4eb9 100644 --- a/nixtlats/types/single_series_insample_forecast.py +++ b/nixtlats/types/single_series_insample_forecast.py @@ -11,7 +11,7 @@ class SingleSeriesInsampleForecast(pydantic.BaseModel): model: typing.Optional[SingleSeriesInsampleForecastModel] = pydantic.Field( - description="Model to use as a string. Options are: `short-horizon`, and `long-horizon.` We recommend using `long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data." + description="Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data." ) freq: typing.Optional[str] = pydantic.Field( description="The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available." diff --git a/nixtlats/types/single_series_insample_forecast_model.py b/nixtlats/types/single_series_insample_forecast_model.py index 884599fd..faef673a 100644 --- a/nixtlats/types/single_series_insample_forecast_model.py +++ b/nixtlats/types/single_series_insample_forecast_model.py @@ -8,26 +8,30 @@ class SingleSeriesInsampleForecastModel(str, enum.Enum): """ - Model to use as a string. Options are: `short-horizon`, and `long-horizon.` We recommend using `long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data. + Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon.` We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data. """ - SHORT_HORIZON = "short-horizon" - LONG_HORIZON = "long-horizon" TIMEGPT_1 = "timegpt-1" TIMEGPT_1_LONG_HORIZON = "timegpt-1-long-horizon" + SHORT_HORIZON = "short-horizon" + LONG_HORIZON = "long-horizon" + AZUREAI = "azureai" def visit( self, - short_horizon: typing.Callable[[], T_Result], - long_horizon: typing.Callable[[], T_Result], timegpt_1: typing.Callable[[], T_Result], timegpt_1_long_horizon: typing.Callable[[], T_Result], + short_horizon: typing.Callable[[], T_Result], + long_horizon: typing.Callable[[], T_Result], + azureai: typing.Callable[[], T_Result], ) -> T_Result: - if self is SingleSeriesInsampleForecastModel.SHORT_HORIZON: - return short_horizon() - if self is SingleSeriesInsampleForecastModel.LONG_HORIZON: - return long_horizon() if self is SingleSeriesInsampleForecastModel.TIMEGPT_1: return timegpt_1() if self is SingleSeriesInsampleForecastModel.TIMEGPT_1_LONG_HORIZON: return timegpt_1_long_horizon() + if self is SingleSeriesInsampleForecastModel.SHORT_HORIZON: + return short_horizon() + if self is SingleSeriesInsampleForecastModel.LONG_HORIZON: + return long_horizon() + if self is SingleSeriesInsampleForecastModel.AZUREAI: + return azureai()