Skip to content

Commit 45eb145

Browse files
committed
docs: add example to sktime forecast docstring
1 parent acd23d0 commit 45eb145

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

timecopilot/models/adapters/sktime.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def forecast(
5454
level: list[int | float] | None = None,
5555
quantiles: list[float] | None = None,
5656
) -> pd.DataFrame:
57+
# fmt: off
5758
"""
5859
Generate forecasts for time series data using an sktime model.
5960
@@ -103,7 +104,22 @@ def forecast(
103104
104105
For multi-series data, the output retains the same unique
105106
identifiers as the input DataFrame.
107+
108+
Example:
109+
```python
110+
import pandas as pd
111+
from timecopilot import TimeCopilot
112+
from timecopilot.models.adapters.sktime import SKTimeAdapter
113+
from sktime.forecasting.trends import TrendForecaster
114+
115+
df = pd.read_csv("https://timecopilot.s3.amazonaws.com/public/data/air_passengers.csv")
116+
adapted_skt_model = SKTimeAdapter(TrendForecaster())
117+
tc = TimeCopilot(llm="openai:gpt-4o", models=[adapted_skt_model])
118+
result = tc.forecast(df, h=12, freq="MS")
119+
print(result.output)
120+
```
106121
"""
122+
# fmt: on
107123
# TODO: support for exogenous data
108124
# TODO: add support for level for sktime models that can support it
109125
# TODO: add support for quantiles for sktime models that can support it

0 commit comments

Comments
 (0)