tutorials-training.mdx 3.77 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
---
title: "Training"
description: "Tutorials and steps for training TimeGPT for various forecasting scenarios"
icon: "gear"
---

## Overview

This section provides tutorials about training **TimeGPT** under specific conditions. Learn how to extend predictions across multiple time series and over long horizons with ease.

<Info>
  TimeGPT is designed to handle time series forecasting tasks of varying complexities. The tutorials below will guide you through key strategies for effective training and deployment.
</Info>

---

## Quick Start: General Training Steps

Below is a concise overview of how to start training with **TimeGPT**.

<Steps>
  <Step title="Prepare Your Data">
    Ensure your time series data is clean, properly formatted, and includes all necessary features (e.g., timestamps, values, external variables).
  </Step>
  <Step title="Select Your Forecasting Approach">
    Decide whether you need a single series or multi-series approach, and whether you need short or long horizons.
  </Step>
  <Step title="Configure TimeGPT">
    Set up the relevant hyperparameters for your forecasting needs (window size, horizon, seasonalities, etc.).
  </Step>
  <Step title="Train and Evaluate">
    Train the model on your dataset and evaluate performance with appropriate error metrics (MAPE, RMSE, etc.).
  </Step>
  <Step title="Refine and Deploy">
    Use performance insights to refine your model, then deploy it in a production environment.
  </Step>
</Steps>

---

## Tutorials

<AccordionGroup>
  <Accordion title="Long Horizon Forecasting">
    Learn how to make predictions beyond two seasonal periods or further into the future using the specialized long-horizon forecasting model of **TimeGPT**.

    <br />

    <br />

    <Info>
      For forecasting horizons that exceed two seasonal periods, you may need additional computational resources and careful hyperparameter tuning.
    </Info>
    <br />

    <CardGroup cols={2}>
      <Card title="Long Horizon Forecasting Guide" href="https://docs.nixtla.io/docs/tutorials-long_horizon_forecasting" cta="View Tutorial">
        Discover the steps to train and optimize TimeGPTs long-horizon capabilities.
      </Card>
    </CardGroup>
  </Accordion>
  <Accordion title="Multiple Series Forecasting">
    Learn how to forecast multiple time series simultaneously using **TimeGPT**.

    <br />

    <br />

    <Info>
      Forecasting multiple time series can help you leverage shared patterns and reduce overall computational overhead.
    </Info>
    <br />

    <CardGroup cols={2}>
      <Card title="Multiple Series Forecasting Guide" href="https://docs.nixtla.io/docs/tutorials-multiple_series_forecasting" cta="View Tutorial">
        Forecast numerous time series at once, streamlining your workflow for complex projects.
      </Card>
    </CardGroup>
  </Accordion>
</AccordionGroup>

---

## Example Training Code

Below is a simplified example of how you might train **TimeGPT** in Python. Adjust hyperparameters as needed for your specific use case.

<CodeGroup>

```python Example: Training TimeGPT Multi-Series
# Example: Training TimeGPT for a multi-series scenario
import timegpt

# Load your dataset
data = timegpt.load_data("my_dataset.csv")

# Initialize the model
model = timegpt.TimeGPT(
    horizon=30,           # Forecast horizon
    max_epochs=50,        # Number of training epochs
    seasonality=24,       # Seasonal period
    learning_rate=1e-3
)

# Train the model
model.fit(data)

# Generate predictions
predictions = model.predict(data)

# Evaluate results
error = model.evaluate(predictions, data)

print(f"Forecast error: {error:.2f}")
```

</CodeGroup>

---

<Check>
  Congratulations\! You now have an overview of how to set up and train TimeGPT for both single and multiple series forecasting as well as for long-horizon use cases.
</Check>