# AI use cases for Darts (unit8co/darts)

Repo: [unit8co/darts](https://github.com/unit8co/darts) | Use cases: 3 | Page: https://dedupedai.com/use-cases/unit8co-darts/

Darts is a Python library for forecasting and anomaly detection on time series. Every forecasting model, from ARIMA to N-BEATS, uses the same fit and predict interface, like scikit-learn. It supports univariate and multivariate series, training one model on many series, probabilistic forecasts, past and future covariates, backtesting, and a darts.ad module of anomaly scorers and detectors including a PyODScorer.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Get a probabilistic forecast in a few lines: https://dedupedai.com/use-cases/unit8co-darts/forecast-a-series-with-darts-exponential-smoothing/
- Flag anomalies in a multivariate series: https://dedupedai.com/use-cases/unit8co-darts/detect-anomalies-in-a-series-with-darts/
- Compare many models on the same series fairly: https://dedupedai.com/use-cases/unit8co-darts/backtest-and-compare-forecasting-models-in-darts/

## How to get a probabilistic forecast in a few lines with Darts

Repo: [unit8co/darts](https://github.com/unit8co/darts) | Difficulty: Beginner | Time: 30 minutes | Basis: From the README

Build a TimeSeries from a DataFrame, fit a model and predict with sampled uncertainty.

**Who it is for:** An analyst with a CSV who needs a forecast and a confidence band.

**The problem:** Stitching together statsmodels and plotting code takes longer than the forecast is worth.

**The outcome:** A forecast with median and percentile bands plotted over the history.

### Steps

1. Install it with `pip install darts`
2. Create the series with TimeSeries.from_dataframe, naming the time column and the value column
3. Split it, for example with `train, val = series[:-36], series[-36:]`, then fit ExponentialSmoothing and call model.predict(len(val), num_samples=1000)
4. Plot with series.plot() and prediction.plot(label="forecast", low_quantile=0.05, high_quantile=0.95)

### Prompt to paste into your agent

```text
Using unit8co/darts, load <my CSV> with TimeSeries.from_dataframe, hold out the last 36 points, fit ExponentialSmoothing with 1000 samples and save a chart with the 5th and 95th percentiles.
```

### Caveat

The README recommends a clean Python 3.11 or newer environment before installing.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/unit8co-darts/forecast-a-series-with-darts-exponential-smoothing/

## How to flag anomalies in a multivariate series with Darts

Repo: [unit8co/darts](https://github.com/unit8co/darts) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Score a series with a k-means anomaly scorer and turn the scores into binary anomaly flags.

**Who it is for:** An engineer watching sensor or ops metrics for unusual behaviour.

**The problem:** Fixed thresholds miss context and fire constantly.

**The outcome:** An anomaly score series plus a binary anomaly classification.

### Steps

1. Install it with `pip install darts`
2. Load a series and split it, for example `train, val = series.split_before(0.6)`
3. Fit a scorer with KMeansScorer(k=2, window=5) on the train set and score the validation set
4. Fit QuantileDetector(high_quantile=0.99) on the train scores and call detect on the validation scores

### Prompt to paste into your agent

```text
With unit8co/darts, build a KMeansScorer and QuantileDetector pipeline over <my metric series> and list the timestamps it flags as anomalies.
```

### Caveat

The quantile detector is calibrated on the training scores, so retrain it when the baseline shifts.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/unit8co-darts/detect-anomalies-in-a-series-with-darts/

## How to compare many models on the same series fairly with Darts

Repo: [unit8co/darts](https://github.com/unit8co/darts) | Difficulty: Intermediate | Time: 2 hours | Basis: From the README

Use the shared interface, metrics and backtesting utilities to rank models on historical forecasts.

**Who it is for:** A team that has to defend which model goes into production.

**The problem:** Comparing libraries one by one makes results hard to trust.

**The outcome:** A ranked comparison of models on your own data, using moving time windows.

### Steps

1. Install it with `pip install darts`
2. Build your TimeSeries and pick candidates from the forecasting models listed in the README, from ARIMA to N-BEATS
3. Use the backtesting utilities, which the README describes as simulating historical forecasts using moving time windows
4. Score the runs with the metrics module, from R2-scores to Mean Absolute Scaled Error, and explain the winner with SHAP values where supported

### Prompt to paste into your agent

```text
Using unit8co/darts, backtest ARIMA and a deep model on <my series> with moving windows, report the metrics side by side and say which one I should ship.
```

### Caveat

Deep learning models in Darts run on PyTorch Lightning, so training time depends on your hardware.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/unit8co-darts/backtest-and-compare-forecasting-models-in-darts/
