Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,31 @@ L_{Quantile}\big(y,f(x),\theta,p\big) = min_\theta\{\mathbb{E}_{(x,y)\sim D}[(y
$$

where $p$ is our fixed confidence interval parameterized by $\theta$. When the pinball loss is minimized, the result is the optimal quantile.

### Examples

---

```python
from torchts.nn.loss import quantile_loss
from torchts.nn.model import TimeSeriesModel

# initialize model
class Model(TimeSeriesModel):
def __init__(self):
...

def forward(self, x):
...

model = Model(
...,
criterion=quantile_loss,
criterion_args={"quantile": 0.05}
)

model.fit(...)
y_pred = model.predict(...)
```

[Full example](https://github.com/Rose-STL-Lab/torchTS/blob/main/examples/quantile-regression/lstm-quantile-regression.ipynb)