Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions nbs/distributed.timegpt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
" add_history: bool = False,\n",
" date_features: Union[bool, List[str]] = False,\n",
" date_features_to_one_hot: Union[bool, List[str]] = True,\n",
" model: str = 'short-horizon',\n",
" model: str = 'timegpt-1',\n",
" num_partitions: Optional[int] = None,\n",
" ) -> fugue.AnyDataFrame:\n",
" kwargs = dict(\n",
Expand Down Expand Up @@ -217,7 +217,7 @@
" validate_token: bool = False,\n",
" date_features: Union[bool, List[str]] = False,\n",
" date_features_to_one_hot: Union[bool, List[str]] = True,\n",
" model: str = 'short-horizon',\n",
" model: str = 'timegpt-1',\n",
" num_partitions: Optional[int] = None,\n",
" ) -> fugue.AnyDataFrame:\n",
" kwargs = dict(\n",
Expand Down Expand Up @@ -260,7 +260,7 @@
" validate_token: bool = False,\n",
" date_features: Union[bool, List[str]] = False,\n",
" date_features_to_one_hot: Union[bool, List[str]] = True,\n",
" model: str = 'short-horizon',\n",
" model: str = 'timegpt-1',\n",
" n_windows: int = 1,\n",
" step_size: Optional[int] = None,\n",
" num_partitions: Optional[int] = None,\n",
Expand Down Expand Up @@ -448,7 +448,7 @@
" num_partitions=1,\n",
" id_col=id_col,\n",
" time_col=time_col,\n",
" model='short-horizon',\n",
" model='timegpt-1',\n",
" **fcst_kwargs\n",
" )\n",
" fcst_df = fa.as_pandas(fcst_df)\n",
Expand Down Expand Up @@ -771,7 +771,7 @@
" num_partitions=1,\n",
" id_col=id_col,\n",
" time_col=time_col,\n",
" model='short-horizon',\n",
" model='timegpt-1',\n",
" **anomalies_kwargs\n",
" )\n",
" anomalies_df = fa.as_pandas(anomalies_df)\n",
Expand Down
2 changes: 1 addition & 1 deletion nbs/docs/how-to-guides/0_distributed_fcst_spark.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
"#| hide\n",
"# test different results for different models\n",
"fcst_df_1 = fcst_df.toPandas()\n",
"fcst_df_2 = timegpt.forecast(spark_df, h=12, model='long-horizon')\n",
"fcst_df_2 = timegpt.forecast(spark_df, h=12, model='timegpt-1-long-horizon')\n",
"fcst_df_2 = fcst_df_2.toPandas()\n",
"test_fail(\n",
" lambda: pd.testing.assert_frame_equal(fcst_df_1[['TimeGPT']], fcst_df_2[['TimeGPT']]),\n",
Expand Down
6 changes: 3 additions & 3 deletions nbs/docs/tutorials/12_longhorizon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"\n",
"Of course, forecasting over a long horizon comes with its challenges. The longer the forecast horizon, the greater the uncertainty in the predictions. It is also possible to have unknown factors come into play in the long-term that were not expected at the time of forecasting.\n",
"\n",
"To tackle those challenges, use TimeGPT's specialized model for long-horizon forecasting by specifying `model='long-horizon'` in your setup.\n",
"To tackle those challenges, use TimeGPT's specialized model for long-horizon forecasting by specifying `model='timegpt-1-long-horizon'` in your setup.\n",
"\n",
"For a detailed step-by-step guide, follow this tutorial on long-horizon forecasting."
]
Expand Down Expand Up @@ -235,7 +235,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, we are ready to use TimeGPT for long-horizon forecasting. Here, we need to set the `model` parameter to `\"long-horizon\"`. This is the specialized model in TimeGPT that can handle such tasks."
"Now, we are ready to use TimeGPT for long-horizon forecasting. Here, we need to set the `model` parameter to `\"timegpt-1-long-horizon\"`. This is the specialized model in TimeGPT that can handle such tasks."
]
},
{
Expand All @@ -261,7 +261,7 @@
" level=[90],\n",
" finetune_steps=10,\n",
" finetune_loss='mae',\n",
" model='long-horizon',\n",
" model='timegpt-1-long-horizon',\n",
" time_col='ds',\n",
" target_col='y'\n",
")"
Expand Down
2 changes: 1 addition & 1 deletion nbs/docs/tutorials/9_cross_validation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@
" h=48, \n",
" n_windows=2,\n",
" level=[80, 90],\n",
" model='long-horizon',\n",
" model='timegpt-1-long-horizon',\n",
")\n",
"timegpt_cv_df_x_long_horizon.columns = timegpt_cv_df_x_long_horizon.columns.str.replace('TimeGPT', 'TimeGPT-LongHorizon')\n",
"timegpt_cv_df_x_models = timegpt_cv_df_x_long_horizon.merge(timegpt_cv_df_x)\n",
Expand Down
56 changes: 28 additions & 28 deletions nbs/timegpt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
" clean_ex_first: bool = True,\n",
" date_features: Union[bool, List[str]] = False,\n",
" date_features_to_one_hot: Union[bool, List[str]] = True,\n",
" model: str = 'short-horizon',\n",
" model: str = 'timegpt-1',\n",
" max_retries: int = 6,\n",
" retry_interval: int = 10,\n",
" max_wait_time: int = 6 * 60,\n",
Expand Down Expand Up @@ -725,8 +725,8 @@
" if 'model' in kwargs:\n",
" model = kwargs['model']\n",
" rename_models_dict = {\n",
" 'timegpt-1': 'short-horizon',\n",
" 'timegpt-1-long-horizon': 'long-horizon',\n",
" 'short-horizon': 'timegpt-1',\n",
" 'long-horizon': 'timegpt-1-long-horizon',\n",
" }\n",
" if model in rename_models_dict.keys():\n",
" new_model = rename_models_dict[model]\n",
Expand Down Expand Up @@ -852,7 +852,7 @@
" self.max_retries = max_retries\n",
" self.retry_interval = retry_interval\n",
" self.max_wait_time = max_wait_time\n",
" self.supported_models = ['short-horizon', 'long-horizon'] \n",
" self.supported_models = ['timegpt-1', 'timegpt-1-long-horizon'] \n",
" # custom attr\n",
" self.weights_x: pd.DataFrame = None\n",
"\n",
Expand Down Expand Up @@ -890,7 +890,7 @@
" add_history: bool = False,\n",
" date_features: Union[bool, List[str]] = False,\n",
" date_features_to_one_hot: Union[bool, List[str]] = True,\n",
" model: str = 'short-horizon',\n",
" model: str = 'timegpt-1',\n",
" num_partitions: int = 1,\n",
" ):\n",
" if validate_token and not self.validate_token(log=False):\n",
Expand Down Expand Up @@ -934,7 +934,7 @@
" validate_token: bool = False,\n",
" date_features: Union[bool, List[str]] = False,\n",
" date_features_to_one_hot: Union[bool, List[str]] = True,\n",
" model: str = 'short-horizon',\n",
" model: str = 'timegpt-1',\n",
" num_partitions: int = 1,\n",
" ):\n",
" if validate_token and not self.validate_token(log=False):\n",
Expand Down Expand Up @@ -981,7 +981,7 @@
" clean_ex_first: bool = True,\n",
" date_features: Union[bool, List[str]] = False,\n",
" date_features_to_one_hot: Union[bool, List[str]] = True,\n",
" model: str = 'short-horizon',\n",
" model: str = 'timegpt-1',\n",
" num_partitions: int = 1,\n",
" ):\n",
" if validate_token and not self.validate_token(log=False):\n",
Expand Down Expand Up @@ -1161,7 +1161,7 @@
" add_history: bool = False,\n",
" date_features: Union[bool, List[str]] = False,\n",
" date_features_to_one_hot: Union[bool, List[str]] = True,\n",
" model: str = 'short-horizon',\n",
" model: str = 'timegpt-1',\n",
" num_partitions: Optional[int] = None,\n",
" ):\n",
" \"\"\"Forecast your time series using TimeGPT.\n",
Expand Down Expand Up @@ -1224,9 +1224,9 @@
" Apply one-hot encoding to these date features.\n",
" If `date_features=True`, then all date features are\n",
" one-hot encoded by default.\n",
" model : str (default='short-horizon')\n",
" Model to use as a string. Options are: `short-horizon`, and `long-horizon`. \n",
" We recommend using `long-horizon` for forecasting \n",
" model : str (default='timegpt-1')\n",
" Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon`. \n",
" We recommend using `timegpt-1-long-horizon` for forecasting \n",
" if you want to predict more than one seasonal \n",
" period given the frequency of your data.\n",
" num_partitions : int (default=None)\n",
Expand Down Expand Up @@ -1296,7 +1296,7 @@
" validate_token: bool = False,\n",
" date_features: Union[bool, List[str]] = False,\n",
" date_features_to_one_hot: Union[bool, List[str]] = True,\n",
" model: str = 'short-horizon',\n",
" model: str = 'timegpt-1',\n",
" num_partitions: Optional[int] = None,\n",
" ):\n",
" \"\"\"Detect anomalies in your time series using TimeGPT.\n",
Expand Down Expand Up @@ -1341,9 +1341,9 @@
" Apply one-hot encoding to these date features.\n",
" If `date_features=True`, then all date features are\n",
" one-hot encoded by default.\n",
" model : str (default='short-horizon')\n",
" Model to use as a string. Options are: `short-horizon`, and `long-horizon`. \n",
" We recommend using `long-horizon` for forecasting \n",
" model : str (default='timegpt-1')\n",
" Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon`. \n",
" We recommend using `timegpt-1-long-horizon` for forecasting \n",
" if you want to predict more than one seasonal \n",
" period given the frequency of your data.\n",
" num_partitions : int (default=None)\n",
Expand Down Expand Up @@ -1408,7 +1408,7 @@
" clean_ex_first: bool = True,\n",
" date_features: Union[bool, List[str]] = False,\n",
" date_features_to_one_hot: Union[bool, List[str]] = True,\n",
" model: str = 'short-horizon',\n",
" model: str = 'timegpt-1',\n",
" num_partitions: Optional[int] = None,\n",
" ):\n",
" \"\"\"Perform cross validation in your time series using TimeGPT.\n",
Expand Down Expand Up @@ -1471,9 +1471,9 @@
" Apply one-hot encoding to these date features.\n",
" If `date_features=True`, then all date features are\n",
" one-hot encoded by default.\n",
" model : str (default='short-horizon')\n",
" Model to use as a string. Options are: `short-horizon`, and `long-horizon`. \n",
" We recommend using `long-horizon` for forecasting \n",
" model : str (default='timegpt-1')\n",
" Model to use as a string. Options are: `timegpt-1`, and `timegpt-1-long-horizon`. \n",
" We recommend using `timegpt-1-long-horizon` for forecasting \n",
" if you want to predict more than one seasonal \n",
" period given the frequency of your data.\n",
" num_partitions : int (default=None)\n",
Expand Down Expand Up @@ -1673,13 +1673,13 @@
"df_test = df.copy()\n",
"df_test.columns = [\"ds\", \"y\"]\n",
"test_warns(\n",
" lambda: timegpt.forecast(df_test, finetune_steps=2, h=12, model=\"timegpt-1\"),\n",
" lambda: timegpt.forecast(df_test, finetune_steps=2, h=12, model=\"short-horizon\"),\n",
")\n",
"test_warns(\n",
" lambda: timegpt.forecast(df_test, finetune_steps=2, h=12, model=\"timegpt-1-long-horizon\"),\n",
" lambda: timegpt.forecast(df_test, finetune_steps=2, h=12, model=\"long-horizon\"),\n",
")\n",
"pd.testing.assert_frame_equal(\n",
" timegpt.forecast(df_test, h=12, model=\"timegpt-1\"),\n",
" timegpt.forecast(df_test, h=12, model=\"short-horizon\"),\n",
" timegpt.forecast(df_test, h=12),\n",
")\n",
"pd.testing.assert_frame_equal(\n",
Expand Down Expand Up @@ -2062,8 +2062,8 @@
" df=df_freq,\n",
" h=h,\n",
" )\n",
" fcst_1_df = test_equal_fcsts_add_history(**{**kwargs, 'model': 'short-horizon'})\n",
" fcst_2_df = test_equal_fcsts_add_history(**{**kwargs, 'model': 'long-horizon'})\n",
" fcst_1_df = test_equal_fcsts_add_history(**{**kwargs, 'model': 'timegpt-1'})\n",
" fcst_2_df = test_equal_fcsts_add_history(**{**kwargs, 'model': 'timegpt-1-long-horizon'})\n",
" test_fail(\n",
" lambda: pd.testing.assert_frame_equal(fcst_1_df, fcst_2_df),\n",
" contains='(column name=\"TimeGPT\") are different',\n",
Expand Down Expand Up @@ -2122,9 +2122,9 @@
"source": [
"#| hide\n",
"# test different results for different models\n",
"fcst_kwargs['model'] = 'short-horizon'\n",
"fcst_kwargs['model'] = 'timegpt-1'\n",
"fcst_timegpt_1 = timegpt.forecast(**fcst_kwargs)\n",
"fcst_kwargs['model'] = 'long-horizon'\n",
"fcst_kwargs['model'] = 'timegpt-1-long-horizon'\n",
"fcst_timegpt_long = timegpt.forecast(**fcst_kwargs)\n",
"test_fail(\n",
" lambda: pd.testing.assert_frame_equal(fcst_timegpt_1[['TimeGPT']], fcst_timegpt_long[['TimeGPT']]),\n",
Expand All @@ -2141,9 +2141,9 @@
"#| hide\n",
"# test different results for different models\n",
"# anomalies\n",
"anomalies_kwargs['model'] = 'short-horizon'\n",
"anomalies_kwargs['model'] = 'timegpt-1'\n",
"anomalies_timegpt_1 = timegpt.detect_anomalies(**anomalies_kwargs)\n",
"anomalies_kwargs['model'] = 'long-horizon'\n",
"anomalies_kwargs['model'] = 'timegpt-1-long-horizon'\n",
"anomalies_timegpt_long = timegpt.detect_anomalies(**anomalies_kwargs)\n",
"test_fail(\n",
" lambda: pd.testing.assert_frame_equal(anomalies_timegpt_1[['TimeGPT']], anomalies_timegpt_long[['TimeGPT']]),\n",
Expand Down
6 changes: 3 additions & 3 deletions nixtlats/distributed/timegpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def forecast(
add_history: bool = False,
date_features: Union[bool, List[str]] = False,
date_features_to_one_hot: Union[bool, List[str]] = True,
model: str = "short-horizon",
model: str = "timegpt-1",
num_partitions: Optional[int] = None,
) -> fugue.AnyDataFrame:
kwargs = dict(
Expand Down Expand Up @@ -182,7 +182,7 @@ def detect_anomalies(
validate_token: bool = False,
date_features: Union[bool, List[str]] = False,
date_features_to_one_hot: Union[bool, List[str]] = True,
model: str = "short-horizon",
model: str = "timegpt-1",
num_partitions: Optional[int] = None,
) -> fugue.AnyDataFrame:
kwargs = dict(
Expand Down Expand Up @@ -225,7 +225,7 @@ def cross_validation(
validate_token: bool = False,
date_features: Union[bool, List[str]] = False,
date_features_to_one_hot: Union[bool, List[str]] = True,
model: str = "short-horizon",
model: str = "timegpt-1",
n_windows: int = 1,
step_size: Optional[int] = None,
num_partitions: Optional[int] = None,
Expand Down
Loading