5_faq.ipynb 27.4 KB
Newer Older
bailuo's avatar
readme  
bailuo committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# FAQ\n",
    "\n",
    "Commonly asked questions about TimeGPT"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Table of contents\n",
    "- [TimeGPT](#timegpt)\n",
    "- [TimeGPT API Key](#timegpt-api-key)\n",
    "- [Features and Capabilities](#features-and-capabilities)\n",
    "- [Fine-tuning](#finetuning)\n",
    "- [Pricing and Billing](#pricing-and-billing)\n",
    "- [Privacy and Security](#privacy-and-security)\n",
    "- [Troubleshooting](#troubleshooting)\n",
    "- [Additional Support](#additional-support)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## TimeGPT"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details> \n",
    "    <summary>What is TimeGPT?</summary>\n",
    "\n",
    "`TimeGPT` is the first foundation model for time series forecasting. It can produce accurate forecasts for new time series across a diverse array of domains using only historical values as inputs. The model \"reads\" time series data sequentially from left to right, similarly to how humans read a sentence. It looks at windows of past data, which we can think of as \"tokens\", and then predicts what comes next. This prediction is based on patterns the model identifies and that it extrapolates into the future. Beyond forecasting, `TimeGPT` supports other time series related tasks, such as what-if-scenarios, anomaly detection, and more. \n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Is TimeGPT based on a Large Language Model (LLM)?</summary> \n",
    "\n",
    "No, `TimeGPT` is not based on any large language model. While it follows the same principle of training a large transformer model on a vast dataset, its architecture is specifically designed to handle time series data and it has been trained to minimize forecasting errors. \n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>How do I get started with TimeGPT?</summary>\n",
    "\n",
    "To get started with `TimeGPT`, you need to register for an account [here](https://dashboard.nixtla.io/). You will receive an email asking you to confirm your signup. After confirming, you will be able to access your dashboard, which contains the details of your account.\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>How accessible is TimeGPT and what are the usage costs?</summary>\n",
    "\n",
    "For a more in-depth understanding of `TimeGPT`, please refer to the [research paper](https://arxiv.org/pdf/2310.03589.pdf). While certain aspects of the model's architecture remain confidential, registration for `TimeGPT` is open to all. New users receive $1,000 USD in free credits and subsequent usage fees are based on token consumption. For more details, please refer to the [Pricing and Billing](#pricing-and-billing) section\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>How can I use TimeGPT?</summary>\n",
    "\n",
    "- Through the [Python SDK](https://github.com/Nixtla/nixtla)\n",
    "\n",
    "- Via the `TimeGPT` API. For instructions on how to call the API using different languages, please refer to the [API documentation](https://docs.nixtla.io/reference/timegpt_timegpt_post)\n",
    "\n",
    "Both methods require you to have a [API key](#timegpt-api-key), which is obtained upon registration and can be found in your dashboard under `API Keys`.\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## TimeGPT API Key"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>What is an API key?</summary>\n",
    "\n",
    "An API key is a unique string of characters that serves as a key to authenticate your requests when using the Nixtla SDK. It ensures that the person making the requests is authorized to do so.\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Where can I get an API key?</summary>\n",
    "\n",
    "Upon registration, you will receive an API key that can be found in your [dashboard](https://dashboard.nixtla.io/) under `API Keys`. Remember that your API key is personal and should not be shared with anyone.\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>How do I use my API key?</summary>\n",
    "\n",
    "To integrate your API key into your development workflow, please refer to the tutorial on [Setting Up Your API Key](https://docs.nixtla.io/docs/getting-started-setting_up_your_api_key). \n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>How can I check the status of my API key?</summary>\n",
    "\n",
    "If you want to check the status of your API key, you can use the [`validate_api_key` method](https://nixtlaverse.nixtla.io/nixtla/nixtla_client.html#nixtlaclient-validate-api-key) of the `NixtlaClient` class. \n",
    "\n",
    "`nixtla_client = NixtlaClient(\n",
    "    api_key = 'my_api_key_provided_by_nixtla'\n",
    ")`\n",
    "\n",
    "`nixtla_client.validate_api_key()`\n",
    "\n",
    "If your key is validating correctly, this will return\n",
    "\n",
    "```\n",
    "INFO:nixtla.nixtla_client:Happy Forecasting! :), If you have questions or need support, please email support@nixtla.io\n",
    "\n",
    "True\n",
    "```\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>What if my API key isn't validating?</summary>\n",
    "\n",
    "When you validate your API key and it returns `False`:\n",
    "\n",
    "* If you are targeting an Azure endpoint, getting `False` from the `NixtlaClient.validate_api_key` method is expected. You can skip this step when taregting an Azure endpoint and proceed diretly to forecasting instead.\n",
    "* If you are not taregting an Azure endpoint, then you should check the following:\n",
    "    * Make sure you are using the latest version of the SDK (Python or R).\n",
    "    * Check that your API key is active in your dashboard by visiting https://dashboard.nixtla.io/\n",
    "    * Consider any firewalls your organization might have. There may be restricted access. If so, you can whitelist our endpoint https://api.nixtla.io/. \n",
    "        - To use Nixtla's API, you need to let your system know that our endpoint is ok, so it will let you access it. Whitelisting the endpoint isn't something that Nixtla can do on our side. It's something that needs to be done on the user's system. This is a bit of an [overview on whitelisting](https://www.csoonline.com/article/569493/whitelisting-explained-how-it-works-and-where-it-fits-in-a-security-program.html).\n",
    "        - If you work in an organization, please work with an IT team. They're likely the ones setting the security and you can talk with them to get it addressed. If you run your own systems, then it's something you should be able to update, depending on the system you're using.\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Features and Capabilities"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>What is the input to TimeGPT?</summary>\n",
    "\n",
    "`TimeGPT` accepts `pandas` dataframes in [long format](https://www.theanalysisfactor.com/wide-and-long-data/#comments) with the following necessary columns: \n",
    "\n",
    "- `ds` (timestamp): timestamp in format `YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`. \n",
    "- `y` (numeric): The target variable to forecast. \n",
    "\n",
    "(Optionally, you can also pass a DataFrame without the `ds` column as long as it has DatetimeIndex)\n",
    "\n",
    "`TimeGPT` also works with [distributed dataframes](https://docs.nixtla.io/docs/tutorials-computing_at_scale) like `dask`, `spark` and `ray`. \n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Can TimeGPT handle multiple time series?</summary>\n",
    "\n",
    "Yes. For guidance on forecasting multiple time series at once, consult the [Multiple Series](https://docs.nixtla.io/docs/tutorials-multiple_series_forecasting) tutorial. \n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Does TimeGPT support forecasting with exogenous variables?</summary>\n",
    "\n",
    "Yes. For instructions on how to incorporate exogenous variables to `TimeGPT`, see the [Exogenous Variables](https://docs.nixtla.io/docs/tutorials-exogenous_variables) tutorial. For incorporating calendar dates specifically, you may find the [Holidays and Special Dates](https://docs.nixtla.io/docs/tutorials-holidays_and_special_dates) tutorial useful. For categorical variables, refer to the [Categorical Variables](https://docs.nixtla.io/docs/tutorials-categorical_variables) tutorial.\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Can TimeGPT be used for anomaly detection?</summary>\n",
    "\n",
    "Yes. To learn how to use `TimeGPT` for anomaly detection, refer to the [Anomaly Detection](https://docs.nixtla.io/docs/capabilities-anomaly-detection-anomaly_detection) tutorial.\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "<details>\n",
    "    <summary>Does TimeGPT support cross-validation?</summary>\n",
    "\n",
    "Yes. To learn how to use `TimeGPT` for cross-validation, refer to the [Cross-Validation](https://docs.nixtla.io/docs/tutorials-cross_validation) tutorial.\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Can TimeGPT be used to forecast historical data?</summary>\n",
    "\n",
    "Yes. To find out how to forecast historical data using `TimeGPT`, see the [Historical Forecast](https://docs.nixtla.io/docs/tutorials-historical_forecast) tutorial.\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Can TimeGPT be used for uncertainty quantification?</summary>\n",
    "\n",
    "Yes. For more information, explore the [Prediction Intervals](https://docs.nixtla.io/docs/tutorials-prediction_intervals) and [Quantile Forecasts](https://docs.nixtla.io/docs/tutorials-quantile_forecasts) tutorials. \n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Can TimeGPT handle large datasets?</summary>\n",
    "\n",
    "Yes. When dealing with large datasets that contain hundreds of thousands or millions of time series, we recommend using a distributed backend. `TimeGPT` is compatible with several [distributed computing frameworks](https://docs.nixtla.io/docs/tutorials-computing_at_scale), including [Spark](https://docs.nixtla.io/docs/tutorials-spark), [Ray](https://docs.nixtla.io/docs/tutorials-ray), and [Dask](https://docs.nixtla.io/docs/tutorials-dask). Both the `TimeGPT` SDK and API don’t have a limit on the size of the dataset as long as a distributed backend is used.\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Can TimeGPT be used with limited/short data?</summary>\n",
    "\n",
    "`TimeGPT` supports any amount of data for generating point forecasts and is capable of producing results with just one observation per series. When using arguments such as `level`, `finetune_steps`, `X_df` (exogenous variables), or `add_history`, additional data points are necessary depending on the data frequency. For more details, please refer to the [Data Requirements](https://docs.nixtla.io/docs/getting-started-data_requirements) tutorial.\n",
    "\n",
    "</details>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>What is the maximum forecast horizon allowed by TimeGPT?</summary>\n",
    "\n",
    "While `TimeGPT` does not have a maximum forecast horizon, its performance will decrease as the horizon increases. When the forecast horizon exceeds the season length of the data (for example, more than 12 months for monthly data), you will get this message: `WARNING:nixtla.nixtla_client:The specified horizon \"h\" exceeds the model horizon. This may lead to less accurate forecasts. Please consider using a smaller horizon`.\n",
    "\n",
    "For details, refer to the tutorial on [Long Horizon in Time Series](https://docs.nixtla.io/docs/tutorials-long_horizon_forecasting).\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Can TimeGPT handle missing values?</summary>\n",
    "\n",
    "`TimeGPT` cannot handle missing values or series with irregular timestamps. For more information, see the [Forecasting Time Series with Irregular Timestamps](https://docs.nixtla.io/docs/capabilities-forecast-irregular_timestamps) and the [Dealing with Missing Values](https://docs.nixtla.io/docs/tutorials-dealing_with_missing_values_in_timegpt) tutorial. \n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>How can I plot the TimeGPT forecast?</summary>\n",
    "\n",
    "The `NixtlaClient` class has a [`plot` method](https://nixtlaverse.nixtla.io/nixtla/nixtla_client.html#nixtlaclient-validate-token) that can be used to visualize the forecast. This method only works in interactive environments such as Jupyter notebooks and it doesn't work on Python scripts. \n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Does TimeGPT support polars?</summary>\n",
    "\n",
    "As of now, `TimeGPT` does not offer support for polars. \n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Does TimeGPT produce stable predictions?</summary>\n",
    "\n",
    "`TimeGPT` is engineered for stability, ensuring consistent results for identical input data. This means that given the same dataset, the model will produce the same forecasts.\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Can TimeGPT forecast data with simple pattern such as a straight line or sine wave?</summary>\n",
    "\n",
    "While this is not the primary use case for `TimeGPT`, it is capable of generating solid results on simple data such as a straight line. While zero-shot predictions might not always meet expectations, a little help with fine-tuning allows TimeGPT to quickly grasp the trend and produce accurate forecasts. For more details, please refer to the [Improve Forecast Accuracy with TimeGPT](https://docs.nixtla.io/docs/tutorials-improve_forecast_accuracy_with_timegpt) tutorial.\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Fine-tuning"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>What is fine-tuning?</summary>\n",
    "\n",
    "`TimeGPT` was trained on the largest publicly available time series dataset, covering a wide range of domains such as finance, retail, healthcare, and more. This comprehensive training enables `TimeGPT` to produce accurate forecasts for new time series without additional training, a capability known as zero-shot learning.  \n",
    "\n",
    "While the zero-shot model provides a solid baseline, the performance of `TimeGPT` can often be improved through fine-tuning. During this process, the `TimeGPT` model undergoes additional training using your specific dataset, starting from the pre-trained paramaters. The updated model then produces the forecasts. You can control the number of training iterations and the loss function for fine-tuning with the `finetune_steps` and the `finetune_loss` parameters in the `forecast` method from the `NixtlaClient` class, respectively. \n",
    "\n",
    "For a comprehensive guide on how to apply fine-tuning, please refer to the [fine-tuning](https://docs.nixtla.io/docs/tutorials-fine_tuning) and the [fine-tuning with a specific loss function](https://docs.nixtla.io/docs/tutorials-fine_tuning_with_a_specific_loss_function) tutorials. \n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Do I have to fine-tune every series?</summary>\n",
    "\n",
    "No, you do not need to fine-tune every series individually. When using the `finetune_steps` parameter, the model undergoes fine-tuning across all series in your dataset simultaneously. This method uses a cross-learning approach, allowing the model to learn from multiple series at once, which can improve individual forecasts.\n",
    "\n",
    "Keep in mind that selecting the right number of fine-tuning steps may require some trial and error. As the number of fine-tuning steps increases, the model becomes more specialized to your dataset, but will take longer to train and may be more prone to overfitting. \n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Can I save fine-tuned parameters?</summary>\n",
    "\n",
    "Yes! You can fine-tune the TimeGPT model, save it, and reuse it later.  For detailed instructions, see our guide on [Re-using Fine-tuned Models](https://docs.nixtla.io/docs/tutorials-re_using_fine_tuned_models).\n",
    "\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Pricing and Billing "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>How does pricing work?</summary>\n",
    "\n",
    "See our [Pricing page](https://docs.nixtla.io/docs/getting-started-timegpt_subscription_plans) for information about pricing.\n",
    "\n",
    "[Start for Free](https://dashboard.nixtla.io/)\n",
    "*No credit card needed.\n",
    "\n",
    "For customized plan details and offerings, book a demo or contact us at [support@nixtla.io](mailto:support@nixtla.io).\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>Are there free options or discounts?</summary>\n",
    "\n",
    "Yes! We provide some discounted options for academic research. If you would like to learn more, please email us at [support@nixtla.io](mailto:support@nixtla.io).\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>What counts as an API call?</summary> \n",
    "\n",
    "An API call is a request made to TimeGPT to perform an action like forecasting or detecting anomalies. API Usage is as follows:\n",
    "\n",
    "### Forecasting:\n",
    "\n",
    "1. When not requesting historical forecasts (`add_history=False`)\n",
    "    - If you do not set `num_partitions`, all calls to perform [forecasting](https://docs.nixtla.io/docs/getting-started-timegpt_quickstart), [finetuning](https://docs.nixtla.io/docs/tutorials-fine_tuning), or [cross-validation](https://docs.nixtla.io/docs/tutorials-cross_validation) increase the usage by 1. Note that addition of [exogenous variables](https://docs.nixtla.io/docs/tutorials-exogenous_variables), requesting [uncertainity quantification](https://docs.nixtla.io/docs/tutorials-uncertainty_quantification) or forecasting [multiple series](https://docs.nixtla.io/docs/tutorials-multiple_series_forecasting) does not increase the usage further.\n",
    "    - If the API call requires to send more than 200MB of data, the API will return an error and will require you to use the `num_partitions` parameter in order to partition your request. Every partition will count as an API call, hence the usage will increase by the value you set for `num_partitions` (e.g. for num_partitions=2, the usage will increase by 2).\n",
    "    If you set `num_partitions`, all calls to perform forecasting, finetuning, or cross-validation increase the usage by num_partitions.\n",
    "2. When requesting [in-sample predictions](https://docs.nixtla.io/docs/tutorials-historical_forecast) (`add_history=True`), the usage from #1 above is multipled by 2.\n",
    "\n",
    "**Examples**\n",
    "\n",
    "1. A user uses TimeGPT to forecast daily data, using the `timegpt-1` model. How many API calls are made? (*Ans*: 1)\n",
    "2. A user calls the `cross_validation` method on a dataset. How many API calls are made (*Ans*: 1)\n",
    "3. A user decides to forecast on a longer horizon, so they use the `timegpt-1-long-horizon` model. How many API calls are made (*Ans*: 1)\n",
    "4. A user needs to get the in-sample predicitons when forecasting using `add_history=True`. How many API calls are made (*Ans*: 2)\n",
    "5. A user has a very large dataset, with a daily frequency, and they must set `num_partitions=4` when forecasting. How many API calls are made (*Ans*: 4)\n",
    "6. A user has to set `num_partitions=4` and is also interesed in getting the in-sample predicitons (`add_history=True`) when forecasting. How many API calls are made (*Ans*: 8)\n",
    "\n",
    "\n",
    "### Anomaly Detection:\n",
    "\n",
    "1. If you do not set `num_partitions`, all calls to perform [anomaly detection](https://docs.nixtla.io/docs/capabilities-anomaly-detection-quickstart) increase the usage by 1. Note that addition of [exogenous variables](https://docs.nixtla.io/docs/capabilities-anomaly-detection-add_exogenous_variables) does not increase the usage further.\n",
    "2. If the API call requires to send more than 200MB of data, the API will return an error and will require you to use the `num_partitions` parameter in order to partition your request. Every partition will count as an API call, hence the usage will increase by the value you set for `num_partitions` (e.g. for num_partitions=2, the usage will increase by 2).\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>How does billing work?</summary>\n",
    "\n",
    "Billing is done through Stripe. We've partnered with Stripe to handle all payment processing. You can view your invoices and payment history in your [dashboard](https://dashboard.nixtla.io/) under `Billing`. \n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Privacy and Security "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary>How do you ensure the privacy and security of my data?</summary>\n",
    "\n",
    "At Nixtla, we take your privacy and security very seriously. To ensure you are fully informed about our policies regarding your data, please refer to the following documents: \n",
    "\n",
    "- [Privacy Notice](https://docs.nixtla.io/docs/privacy-notice)\n",
    "\n",
    "- For the Python SDK, please review the [license agreement](https://github.com/Nixtla/nixtla/blob/main/LICENSE). \n",
    "\n",
    "- For `TimeGPT`, please refer to our [terms and conditions](https://docs.nixtla.io/docs/terms-and-conditions). \n",
    "\n",
    "In addtion, we are currently developing a self-hosted version of `TimeGPT`, tailored for the unique security requirements of enterprise data. This version is currently in beta. If you are interested in exploring this option, please contact us at `support@nixtla.io`.\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Troubleshooting "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The following section contains some common errors and warnings "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "    <summary><strong>Error message: Invalid API key</strong></summary>\n",
    "\n",
    "``` python\n",
    "ApiError: status_code: 401, body: {'data': None, 'message': 'Invalid API key', 'details': 'Key not found', 'code': 'A12', 'requestID': 'E7F2BBTB2P', 'support': 'If you have questions or need support, please email support@nixtla.io'}\n",
    "```\n",
    "\n",
    "**Solution:** This error occurs when your `TimeGPT` API key is either invalid or has not been set up correctly. Please use the `validate_api_key` method to verify it or make sure it was copied correctly from the `API Keys` section of your [dashboard](https://dashboard.nixtla.io/).\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "<summary><strong>Error message: Too many requests</strong></summary>\n",
    "\n",
    "``` python\n",
    "ApiError: status_code: 429, body: {'data': None, 'message': 'Too many requests', 'details': 'You need to add a payment method to continue using the API, do so from https://dashboard.nixtla.io', 'code': 'A21', 'requestID': 'NCJDK7KSJ6', 'support': 'If you have questions or need support, please email support@nixtla.io'}\n",
    "```\n",
    "\n",
    "**Solution:** This error occurs when you have exhausted your free credits and need to add a payment method to continue using `TimeGPT`. You can add a payment method in the `Billing` section of your [dashboard](https://dashboard.nixtla.io/).\n",
    "\n",
    "</details>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<details>\n",
    "<summary><strong>Error message: WriteTimeout</strong></summary>\n",
    "\n",
    "**Solution:**  If you encounter a `WriteTimeout` error, it means that the request has exceeded the allowable processing time. This is a common issue when working with large datasets. To fix this, consider increasing the `num_partitions` parameter in the [`forecast` method](https://nixtlaverse.nixtla.io/nixtla/nixtla_client.html#nixtlaclient-forecast) of the `NixtlaClient` class, or use a distributed backend if not already in use.\n",
    "\n",
    "</details>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Additional Support"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If you have any more questions or need support, please reach out by:\n",
    "\n",
    "- Opening an [issue](https://github.com/Nixtla/nixtla/issues) on GitHub for technical questions or bugs.\n",
    "- Sending an email to `support@nixtla.io` for general inquiries or support.\n",
    "- Joining our [Slack](https://join.slack.com/t/nixtlacommunity/shared_invite/zt-2ebtgjbip-QMSnvm6ED1NF5vi4xj_13Q) community to connect with our team and the forecasting community."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "python3",
   "language": "python",
   "name": "python3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}