Skip to content

Commit

Permalink
Add optional inference params to example (#15)
Browse files Browse the repository at this point in the history
*Description of changes:* This PR adds optional inference params such as
`num_samples`, `top_k`, etc. to the example in the README for clarity.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
  • Loading branch information
abdulfatir authored Mar 18, 2024
1 parent ef786e9 commit 73be250
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pip install git+https://github.com/amazon-science/chronos-forecasting.git
A minimal example showing how to perform inference using Chronos models:

```python
# for plotting, run: pip install pandas matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
Expand All @@ -55,7 +56,14 @@ df = pd.read_csv("https://raw.githubusercontent.com/AileenNielsen/TimeSeriesAnal
# or a left-padded 2D tensor with batch as the first dimension
context = torch.tensor(df["#Passengers"])
prediction_length = 12
forecast = pipeline.predict(context, prediction_length) # shape [num_series, num_samples, prediction_length]
forecast = pipeline.predict(
context,
prediction_length,
num_samples=20,
temperature=1.0,
top_k=50,
top_p=1.0,
) # forecast shape: [num_series, num_samples, prediction_length]

# visualize the forecast
forecast_index = range(len(df), len(df) + prediction_length)
Expand Down

0 comments on commit 73be250

Please sign in to comment.