Skip to content

Commit 503efa5

Browse files
committed
docs: fix skforecast example and docs
1 parent 48df3d4 commit 503efa5

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

docs/examples/skforecast.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@
118118
"id": "4bb01c41",
119119
"metadata": {},
120120
"source": [
121-
"## Create a TimeCopilot instance with your sktime model\n",
121+
"## Create a TimeCopilot instance with your skforecast model\n",
122122
"\n",
123-
"You will need to specify the forecasters you're using when using sktime models. "
123+
"You will need to specify the forecasters you're using when using skforecast models. "
124124
]
125125
},
126126
{

timecopilot/models/adapters/skforecast.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,22 @@ def forecast(
133133
134134
Example:
135135
```python
136+
from lightgbm import LGBMRegressor
136137
import pandas as pd
137138
from timecopilot import TimeCopilot
138-
from timecopilot.models.adapters.sktime import SKTimeAdapter
139-
from sktime.forecasting.trend import TrendForecaster
139+
from timecopilot.models.adapters.skforecast import SKForecastAdapter
140+
from skforecast.recursive import ForecasterRecursive
141+
from skforecast.preprocessing import RollingFeatures
142+
143+
forecaster = ForecasterRecursive(
144+
estimator = LGBMRegressor(random_state=123, verbose=-1),
145+
lags = 10,
146+
window_features = RollingFeatures(stats=['mean'], window_sizes=10)
147+
)
140148
141149
df = pd.read_csv("https://timecopilot.s3.amazonaws.com/public/data/air_passengers.csv")
142-
adapted_skt_model = SKTimeAdapter(TrendForecaster())
143-
tc = TimeCopilot(llm="openai:gpt-4o", forecasters=[adapted_skt_model])
150+
adapted_skf_model = SKForecastAdapter(forecaster)
151+
tc = TimeCopilot(llm="openai:gpt-4o", forecasters=[adapted_skf_model])
144152
result = tc.forecast(df, h=12, freq="MS")
145153
print(result.output)
146154
```

0 commit comments

Comments
 (0)