使用遷移式學習來預測時間序列

source

https://otexts.com/fpppy/nbs/15-foundation-models.html

https://github.com/Nixtla/nixtla

!pip install nixtla>=0.7.0
import pandas as pd
from nixtla import NixtlaClient
# Get your API Key at dashboard.nixtla.io

# 1. Instantiate the NixtlaClient
nixtla_client = NixtlaClient(api_key = 'nixak-XDC6TDhaq1z6ytCf2lnscFmOe7Q6U049amERS5dlMbDOGwQ2De3GpIjgmpielf0w5WlsMNcJyVx8jyH6')

# 2. Read historic electricity demand data
df = pd.read_csv('https://raw.githubusercontent.com/Nixtla/transfer-learning-time-series/main/datasets/electricity-short.csv')

# 3. Forecast the next 24 hours
fcst_df = nixtla_client.forecast(df, h=24, level=[80, 90])

# 4. Plot your results (optional)
nixtla_client.plot(df, fcst_df, level=[80, 90])

# 3. Forecast the next 240 hours
fcst_df = nixtla_client.forecast(df, h=720, level=[80, 90])

# 4. Plot your results (optional)
nixtla_client.plot(df, fcst_df, level=[80, 90])
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.

無符合的項目