
Darts 是一个用于时间序列上用户友好的预测和异常检测的 Python 库。它包含多种模型,从 ARIMA 等经典模型到深度神经网络。所有预测模型都可以使用相同的方式,通过 fit() 和 predict() 函数来使用,类似于 scikit-learn。该库还使得对模型进行回测、组合多个模型的预测以及考虑外部数据变得容易。Darts 支持单变量和多变量的时间序列及模型。基于机器学习的模型可以在包含多个时间序列的潜在大型数据集上进行训练,并且其中一些模型为概率预测提供了丰富的支持。
Darts 还提供了广泛的异常检测能力。例如,将 PyOD 模型应用于时间序列以获得异常分数是轻而易举的,或者包装任何 Darts 预测或滤波模型以获得功能完备的异常检测模型。
我们建议首先使用你喜欢的工具(conda、venv、virtualenv 带或不带 virtualenvwrapper)为你的项目设置一个干净的 Python 3.10+ 环境。
环境设置好后,你可以使用 pip 安装 darts:
pip install darts
更多细节可以参考我们的安装说明。
从 Pandas DataFrame 创建一个 TimeSeries 对象,并将其拆分为训练/验证序列:```python
import pandas as pd
from darts import TimeSeries
df = pd.read_csv("AirPassengers.csv", delimiter=",")
series = TimeSeries.from_dataframe(df, "Month", "#Passengers")
train, val = series[:-36], series[-36:]
对指数平滑模型进行拟合,并在验证序列的时间跨度上做出(概率性的)预测:```python
from darts.models import ExponentialSmoothing
model = ExponentialSmoothing()
model.fit(train)
prediction = model.predict(len(val), num_samples=1000)
绘制中位数、第5和第95百分位数:```python import matplotlib.pyplot as plt
series.plot() prediction.plot(label="forecast", low_quantile=0.05, high_quantile=0.95) plt.legend()
<div style="text-align:center;">
<img src="https://raw.githubusercontent.com/unit8co/darts/master/static/images/example.png" alt="darts 预测示例" />
</div>
### 异常检测
加载一个多元时间序列,对其进行裁剪,保留 2 个分量,并划分训练集和验证集:```python
from darts.datasets import ETTh2Dataset
series = ETTh2Dataset().load()[:10000][["MUFL", "LULL"]]
train, val = series.split_before(0.6)
构建一个 k-means 异常评分器,在训练集上训练它, 并在验证集上使用它来获取异常分数:```python from darts.ad import KMeansScorer
scorer = KMeansScorer(k=2, window=5) scorer.fit(train) anom_score = scorer.score(val)
构建一个二元异常检测器,并在训练分数上训练它,
然后将其应用于验证分数以获得二元异常分类:```python
from darts.ad import QuantileDetector
detector = QuantileDetector(high_quantile=0.99)
detector.fit(scorer.score(train))
binary_anom = detector.detect(anom_score)
绘图(对部分序列进行平移和缩放,使所有内容显示在同一张图上):```python import matplotlib.pyplot as plt
series.plot() (anom_score / 2. - 100).plot(label="computed anomaly score", c="orangered", lw=3) (binary_anom * 45 - 150).plot(label="detected binary anomaly", lw=4)
<div style="text-align:center;">
<img src="https://raw.githubusercontent.com/unit8co/darts/master/static/images/example_ad.png" alt="darts 异常检测示例" />
</div>
## 功能特性
* **预测模型:** 大量用于回归以及分类任务的预测模型集合;从统计模型(如
ARIMA)到深度学习模型(如 N-BEATS)。请参阅下方的[预测模型](#forecasting-models)。
* **异常检测** `darts.ad` 模块包含一系列异常评分器、
检测器和聚合器,它们可以组合使用以检测时间序列中的异常。
可以轻松包装任何 Darts 预测或过滤模型,以构建
一个将预测与实际值进行比较的完整异常检测模型。
`PyODScorer` 使得在时间序列上使用 PyOD 检测器变得非常简单。
* **多变量支持:** `TimeSeries` 可以是多变量的——即包含多个随时间变化的
维度/列,而非单个标量值。许多模型可以消费并生成多变量序列。
* **多序列训练(全局模型):** 所有基于机器学习的模型(包括所有神经网络)
都支持在多个(可能是多变量的)序列上进行训练。这也可以扩展到大型数据集。
* **概率支持:** `TimeSeries` 对象可以(可选地)表示随机
时间序列;例如,这可用于获取置信区间,并且许多模型支持不同的
概率预测风格(例如估计参数分布或分位数)。
一些异常检测评分器也能够利用这些预测分布。
* **共形预测支持:** 我们的共形预测模型允许为任何预训练的全局预测模型生成具有
校准分位数区间的概率预测。
* **过去和未来协变量支持:** Darts 中的许多模型支持将过去观测到的和/或未来已知的
协变量(外部数据)时间序列作为输入来生成预测。
* **静态协变量支持:** 除了随时间变化的数据外,`TimeSeries` 还可以包含
每个维度的静态数据,某些模型可以利用这些数据。
* **层次协调:** Darts 提供转换器来执行协调。
这些可以使预测以尊重底层层次结构的方式相加。
* **回归模型:** 可以插入任何与 scikit-learn 兼容的模型,
以将预测作为目标序列和协变量的滞后值的函数来获取。
* **使用样本权重训练:** 所有全局模型都支持使用样本权重进行训练。它们可以
应用于每个观测值、预测的时间步长和目标列。
* **预测起点偏移:** 所有全局模型都支持在偏移的输出窗口上进行训练和预测。
这对于例如日前市场预测,或当协变量(或目标序列)延迟报告时非常有用。
* **可解释性:** Darts 能够使用 SHAP 值*解释*某些预测模型。
* **数据处理:** 轻松对时间序列数据应用(和还原)常见变换的工具
(缩放、填充缺失值、差分、Box-Cox 变换等)
* **指标:** 用于评估时间序列拟合优度的各种指标;
从 R2 分数到平均绝对缩放误差。
* **回测:** 使用移动时间窗口模拟历史预测的工具。
* **PyTorch Lightning 支持:** 所有深度学习模型均使用 PyTorch Lightning 实现,
除其他外,支持自定义回调、GPU/TPU 训练和自定义训练器。
* **MLflow 集成:** 与 MLflow 集成,用于自动跟踪、比较和持久化
Darts 预测模型实验。有关示例,请参阅 [MLflow 快速入门笔记本](https://unit8co.github.io/darts/examples/29-MLflow-examples.html)。
* **过滤模型:** Darts 提供三种过滤模型:`KalmanFilter`、`GaussianProcessFilter`
和 `MovingAverageFilter`,它们允许过滤时间序列,并且在某些情况下获得
底层状态/值的概率推断。
* **数据集** `darts.datasets` 子模块包含一些流行的时序数据集,用于快速
且可重复的实验。
* **多后端兼容性:** `TimeSeries` 对象可以从各种后端(如 pandas、polars、numpy、pyarrow、xarray 等)创建并导出到这些后端,从而促进与不同数据处理库的无缝集成。
## 预测模型
以下是 Darts 中当前实现的预测模型的细分。我们的套件包括回归和分类模型,每种模型都针对特定的预测任务量身定制。我们致力于通过新的模型和功能来扩展我们的产品,以增强您的预测能力。
**回归模型:** 我们的回归模型旨在预测连续的数值,使其成为预测时间序列数据中未来趋势和模式的理想选择。利用这些模型,您可以基于历史数据洞察潜在的未来结果。| 模型 | 来源 | 目标序列支持:<br/><br/>单变量/<br/>多变量 | 协变量支持:<br/><br/>过去观测/<br/>未来已知/<br/>静态 | 概率预测:<br/><br/>采样/<br/>分布参数 | 多序列训练与预测 |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|--------------------------------------------------------------------------|--------------------------------------------------------------------------|-------------------------------------------|
| **基线模型**<br/>([LocalForecastingModel](https://unit8co.github.io/darts/userguide/covariates.html#local-forecasting-models-lfms)) | | | | | |
| [NaiveMean](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.baselines.html#darts.models.forecasting.baselines.NaiveMean) | | ✅ ✅ | 🔴 🔴 🔴 | 🔴 🔴 | 🔴 |
| [NaiveSeasonal](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.baselines.html#darts.models.forecasting.baselines.NaiveSeasonal) | | ✅ ✅ | 🔴 🔴 🔴 | 🔴 🔴 | 🔴 |
| [NaiveDrift](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.baselines.html#darts.models.forecasting.baselines.NaiveDrift) | | ✅ ✅ | 🔴 🔴 🔴 | 🔴 🔴 | 🔴 |
| [NaiveMovingAverage](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.baselines.html#darts.models.forecasting.baselines.NaiveMovingAverage) | | ✅ ✅ | 🔴 🔴 🔴 | 🔴 🔴 | 🔴 |
| **统计/经典模型**<br/>([LocalForecastingModel](https://unit8co.github.io/darts/userguide/covariates.html#local-forecasting-models-lfms)) | | | | | |
| [ARIMA](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.arima.html#darts.models.forecasting.arima.ARIMA) | | ✅ 🔴 | 🔴 ✅ 🔴 | ✅ 🔴 | 🔴 |
| [VARIMA](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.varima.html#darts.models.forecasting.varima.VARIMA) | | 🔴 ✅ | 🔴 ✅ 🔴 | ✅ 🔴 | 🔴 |
| [ExponentialSmoothing](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.exponential_smoothing.html#darts.models.forecasting.exponential_smoothing.ExponentialSmoothing) | | ✅ 🔴 | 🔴 🔴 🔴 | ✅ 🔴 | 🔴 |
| [Theta](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.theta.html#darts.models.forecasting.theta.Theta) 和 [FourTheta](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.theta.html#darts.models.forecasting.theta.FourTheta) | [Theta 论文](https://robjhyndman.com/papers/Theta.pdf) 和 [4 Theta 源码](https://github.com/Mcompetitions/M4-methods/blob/master/4Theta%20method.R) | ✅ 🔴 | 🔴 🔴 🔴 | 🔴 🔴 | 🔴 |
| [Prophet](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.prophet_model.html#darts.models.forecasting.prophet_model.Prophet) | [Prophet 仓库](https://github.com/facebook/prophet) | ✅ 🔴 | 🔴 ✅ 🔴 | ✅ 🔴 | 🔴 |
| [FFT](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.fft.html#darts.models.forecasting.fft.FFT)(快速傅里叶变换) | | ✅ 🔴 | 🔴 🔴 🔴 | 🔴 🔴 | 🔴 |
| [KalmanForecaster](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.kalman_forecaster.html#darts.models.forecasting.kalman_forecaster.KalmanForecaster),使用卡尔曼滤波器和 N4SID 进行系统辨识 | [N4SID 论文](https://people.duke.edu/~hpgavin/SystemID/References/VanOverschee-Automatica-1994.pdf) | ✅ ✅ | 🔴 ✅ 🔴 | ✅ 🔴 | 🔴 |
| [TBATS](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.sf_tbats.html#darts.models.forecasting.sf_tbats.TBATS) | [TBATS 论文](https://robjhyndman.com/papers/ComplexSeasonality.pdf) | ✅ 🔴 | 🔴 ✅ 🔴 | ✅ ✅ | 🔴 |
| [Croston](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.sf_croston.html#darts.models.forecasting.sf_croston.Croston) 方法 | | ✅ 🔴 | 🔴 ✅ 🔴 | ✅ ✅ | 🔴 |
| [StatsForecastModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.sf_model.html#darts.models.forecasting.sf_model.StatsForecastModel) 包装器,可包装任何 [StatsForecast](https://nixtlaverse.nixtla.io/statsforecast/index.html#models) 模型 | [Nixtla 的 statsforecast](https://github.com/Nixtla/statsforecast) | ✅ 🔴 | 🔴 ✅ 🔴 | ✅ ✅ | 🔴 |
| [AutoARIMA](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.sf_auto_arima.html#darts.models.forecasting.sf_auto_arima.AutoARIMA) | [Nixtla 的 statsforecast](https://github.com/Nixtla/statsforecast) | ✅ 🔴 | 🔴 ✅ 🔴 | ✅ ✅ | 🔴 |
| [AutoETS](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.sf_auto_ets.html#darts.models.forecasting.sf_auto_ets.AutoETS) | [Nixtla 的 statsforecast](https://github.com/Nixtla/statsforecast) | ✅ 🔴 | 🔴 ✅ 🔴 | ✅ ✅ | 🔴 |
| [AutoCES](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.sf_auto_ces.html#darts.models.forecasting.sf_auto_ces.AutoCES) | [Nixtla 的 statsforecast](https://github.com/Nixtla/statsforecast) | ✅ 🔴 | 🔴 ✅ 🔴 | ✅ ✅ | 🔴 |
| [AutoMFLES](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.sf_auto_mfles.html#darts.models.forecasting.sf_auto_mfles.AutoMFLES) | [Nixtla 的 statsforecast](https://github.com/Nixtla/statsforecast) | ✅ 🔴 | 🔴 ✅ 🔴 | ✅ ✅ | 🔴 |
| [AutoTBATS](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.sf_auto_tbats.html#darts.models.forecasting.sf_auto_tbats.AutoTBATS) | [Nixtla 的 statsforecast](https://github.com/Nixtla/statsforecast) | ✅ 🔴 | 🔴 ✅ 🔴 | ✅ ✅ | 🔴 |
| [AutoTheta](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.sf_auto_theta.html#darts.models.forecasting.sf_auto_theta.AutoTheta) | [Nixtla 的 statsforecast](https://github.com/Nixtla/statsforecast) | ✅ 🔴 | 🔴 ✅ 🔴 | ✅ ✅ | 🔴 |
| [MultivariateModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.multivariate_model.html#darts.models.forecasting.multivariate_model.MultivariateModel) | | ✅ ✅ | 🔴 ✅ 🔴 | ✅ ✅ | 🔴 |
| **全局基线模型**<br/>([GlobalForecastingModel](https://unit8co.github.io/darts/userguide/covariates.html#global-forecasting-models-gfms)) | | | | | |
| [GlobalNaiveAggregate](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.global_baseline_models.html#darts.models.forecasting.global_baseline_models.GlobalNaiveAggregate) | | ✅ ✅ | 🔴 🔴 🔴 | 🔴 🔴 | ✅ |
| [GlobalNaiveDrift](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.global_baseline_models.html#darts.models.forecasting.global_baseline_models.GlobalNaiveDrift) | | ✅ ✅ | 🔴 🔴 🔴 | 🔴 🔴 | ✅ |
| [GlobalNaiveSeasonal](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.global_baseline_models.html#darts.models.forecasting.global_baseline_models.GlobalNaiveSeasonal) | | ✅ ✅ | 🔴 🔴 🔴 | 🔴 🔴 | ✅ |
| **回归模型**<br/>([GlobalForecastingModel](https://unit8co.github.io/darts/userguide/covariates.html#global-forecasting-models-gfms)) | | | | | |
| [SKLearnModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.sklearn_model.html#darts.models.forecasting.sklearn_model.SKLearnModel):包装任何类似 scikit-learn 的回归模型 | | ✅ ✅ | ✅ ✅ ✅ | 🔴 🔴 | ✅ |
| [LinearRegressionModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.linear_regression_model.html#darts.models.forecasting.linear_regression_model.LinearRegressionModel) | | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [RandomForestModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.random_forest.html#darts.models.forecasting.random_forest.RandomForestModel) | | ✅ ✅ | ✅ ✅ ✅ | 🔴 🔴 | ✅ |
| [CatBoostModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.catboost_model.html#darts.models.forecasting.catboost_model.CatBoostModel) | | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [LightGBMModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.lgbm.html#darts.models.forecasting.lgbm.LightGBMModel) | | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [XGBModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.xgboost.html#darts.models.forecasting.xgboost.XGBModel) | | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| **基于 PyTorch (Lightning) 的模型**<br/>([GlobalForecastingModel](https://unit8co.github.io/darts/userguide/covariates.html#global-forecasting-models-gfms)) | | | | | |
| [RNNModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.rnn_model.html#darts.models.forecasting.rnn_model.RNNModel)(包括 LSTM 和 GRU);其概率版本等同于 DeepAR | [DeepAR 论文](https://arxiv.org/abs/1704.04110) | ✅ ✅ | 🔴 ✅ 🔴 | ✅ ✅ | ✅ |
| [BlockRNNModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.block_rnn_model.html#darts.models.forecasting.block_rnn_model.BlockRNNModel)(包括 LSTM 和 GRU) | | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [NBEATSModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.nbeats.html#darts.models.forecasting.nbeats.NBEATSModel) | [N-BEATS 论文](https://arxiv.org/abs/1905.10437) | ✅ ✅ | ✅ 🔴 🔴 | ✅ ✅ | ✅ |
| [NHiTSModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.nhits.html#darts.models.forecasting.nhits.NHiTSModel) | [N-HiTS 论文](https://arxiv.org/abs/2201.12886) | ✅ ✅ | ✅ 🔴 🔴 | ✅ ✅ | ✅ |
| [TCNModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.tcn_model.html#darts.models.forecasting.tcn_model.TCNModel) | [TCN 论文](https://arxiv.org/abs/1803.01271)、[DeepTCN 论文](https://arxiv.org/abs/1906.04397)、[博客文章](https://medium.com/unit8-machine-learning-publication/temporal-convolutional-networks-and-forecasting-5ce1b6e97ce4) | ✅ ✅ | ✅ 🔴 🔴 | ✅ ✅ | ✅ |
| [TransformerModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.transformer_model.html#darts.models.forecasting.transformer_model.TransformerModel) | | ✅ ✅ | ✅ 🔴 🔴 | ✅ ✅ | ✅ |
| [TFTModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.tft_model.html#darts.models.forecasting.tft_model.TFTModel)(时间融合 Transformer) | [TFT 论文](https://arxiv.org/pdf/1912.09363.pdf)、[PyTorch Forecasting](https://pytorch-forecasting.readthedocs.io/en/latest/models.html) | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [DLinearModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.dlinear.html#darts.models.forecasting.dlinear.DLinearModel) | [DLinear 论文](https://arxiv.org/pdf/2205.13504.pdf) | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [NLinearModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.nlinear.html#darts.models.forecasting.nlinear.NLinearModel) | [NLinear 论文](https://arxiv.org/pdf/2205.13504.pdf) | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [TiDEModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.tide_model.html#darts.models.forecasting.tide_model.TiDEModel) | [TiDE 论文](https://arxiv.org/pdf/2304.08424.pdf) | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [TSMixerModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.tsmixer_model.html#darts.models.forecasting.tsmixer_model.TSMixerModel) | [TSMixer 论文](https://arxiv.org/pdf/2303.06053.pdf)、[PyTorch 实现](https://github.com/ditschuk/pytorch-tsmixer) | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [NeuralForecastModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.nf_model.html#darts.models.forecasting.nf_model.NeuralForecastModel):包装任何 [NeuralForecast](https://nixtlaverse.nixtla.io/neuralforecast/docs/capabilities/overview.html) 基础模型 | [NeuralForecast 文档](https://nixtlaverse.nixtla.io/neuralforecast/docs/) | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| **基础模型**<br/>([GlobalForecastingModel](https://unit8co.github.io/darts/userguide/covariates.html#global-forecasting-models-gfms)):无需训练 | | | | | |
| [Chronos2Model](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.chronos2_model.html#darts.models.forecasting.chronos2_model.Chronos2Model) | [Chronos-2 报告](https://arxiv.org/abs/2510.15821)、[Amazon 博客文章](https://www.amazon.science/blog/introducing-chronos-2-from-univariate-to-universal-forecasting) | ✅ ✅ | ✅ ✅ 🔴 | ✅ ✅ | ✅ |
| [TimesFM2p5Model](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.timesfm2p5_model.html#darts.models.forecasting.timesfm2p5_model.TimesFM2p5Model) | [TimesFM 1.0 论文](https://arxiv.org/abs/2310.10688)、[Google 博客文章](https://research.google/blog/a-decoder-only-foundation-model-for-time-series-forecasting) | ✅ ✅ | 🔴 🔴 🔴 | ✅ ✅ | ✅ |
| [TiRexModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.tirex_model.html#darts.models.forecasting.tirex_model.TiRexModel) | [TiRex 论文](https://arxiv.org/abs/2505.23719)、[TiRex GitHub](https://github.com/NX-AI/tirex) | ✅ ✅ | 🔴 🔴 🔴 | ✅ ✅ | ✅ |
| [PatchTSTFMModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.patchtst_fm_model.html#darts.models.forecasting.patchtst_fm_model.PatchTSTFMModel) | [PatchTST-FM 论文](https://arxiv.org/abs/2602.06909)、[PatchTST-FM GitHub](https://github.com/ibm-granite/granite-tsfm) | ✅ ✅ | 🔴 🔴 🔴 | ✅ ✅ | ✅ |
| **集成模型**<br/>([GlobalForecastingModel](https://unit8co.github.io/darts/userguide/covariates.html#global-forecasting-models-gfms)):模型支持取决于被集成的预测模型及集成模型本身 | | | | | |
| [NaiveEnsembleModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.naive_ensemble_model.html#darts.models.forecasting.naive_ensemble_model.NaiveEnsembleModel) | | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [RegressionEnsembleModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.regression_ensemble_model.html#darts.models.forecasting.regression_ensemble_model.RegressionEnsembleModel) | | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| **保形模型**<br/>([GlobalForecastingModel](https://unit8co.github.io/darts/userguide/covariates.html#global-forecasting-models-gfms)):模型支持取决于所使用的预测模型 | | | | | |
| [ConformalNaiveModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.conformal_models.html#darts.models.forecasting.conformal_models.ConformalNaiveModel) | [保形预测](https://arxiv.org/pdf/1905.03222) | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [ConformalQRModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.conformal_models.html#darts.models.forecasting.conformal_models.ConformalQRModel) | [保形分位数回归](https://arxiv.org/pdf/1905.03222) | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |**分类模型:** Darts 中的分类模型旨在预测分类标签,从而实现高效的时间序列标注和未来类别预测。这些模型非常适合需要识别随时间变化的不同类别或状态的场景。
| 模型 | 来源 | 目标序列支持:<br/><br/>单变量/<br/>多变量 | 协变量支持:<br/><br/>过去观测/<br/>未来已知/<br/>静态 | 概率预测:<br/><br/>采样/<br/>分布参数 | 多序列训练与预测 |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------------------------------------------------------------|--------------------------------------------------------------------------|--------------------------------------------------------------------------|-------------------------------------------|
| **回归模型**<br/>([GlobalForecastingModel](https://unit8co.github.io/darts/userguide/covariates.html#global-forecasting-models-gfms)) | | | | | |
| [SKLearnClassifierModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.sklearn_model.html#darts.models.forecasting.sklearn_model.SKLearnClassifierModel):任何类似 scikit-learn 的分类模型的封装器 | | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [CatBoostClassifierModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.catboost_model.html#darts.models.forecasting.catboost_model.CatBoostClassifierModel) | | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [LightGBMClassifierModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.lgbm.html#darts.models.forecasting.lgbm.LightGBMClassifierModel) | | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
| [XGBClassifierModel](https://unit8co.github.io/darts/generated_api/darts.models.forecasting.xgboost.html#darts.models.forecasting.xgboost.XGBClassifierModel) | | ✅ ✅ | ✅ ✅ ✅ | ✅ ✅ | ✅ |
## 社区与联系
欢迎任何人加入我们的 [Gitter 聊天室](https://gitter.im/u8darts/darts) 提问、提出建议、讨论用例等。如果您发现 bug 或有改进建议,也欢迎在 GitHub 上提交 issue。
如果您想告知我们的内容不适合在 Gitter 或 GitHub 上发布,
欢迎发送邮件至 <a href="mailto:[email protected]">[email protected]</a> 处理
与 darts 相关的事务,或发送至 <a href="mailto:[email protected]">[email protected]</a> 处理其他
咨询。
## 贡献
开发工作持续进行中,我们欢迎在 GitHub 上提交建议、拉取请求和 issue。
所有贡献者都将在
[更新日志页面](https://github.com/unit8co/darts/blob/master/CHANGELOG.md) 上获得致谢。
在着手贡献(新功能或修复)之前,
请[查看我们的贡献指南](https://github.com/unit8co/darts/blob/master/CONTRIBUTING.md)。
## 引用
如果您在科研工作中使用了 Darts,我们恳请您引用以下 JMLR 论文。
[Darts:面向时间序列的用户友好型现代机器学习](https://www.jmlr.org/papers/v23/21-1177.html)
Bibtex 条目(或直接通过 GitHub 的仓库引用功能复制):```
@article{Herzen_Darts_User-Friendly_Modern_2022,
author = {Herzen, Julien and Lässig, Francesco and Piazzetta, Samuele Giuliano and Neuer, Thomas and Tafti, Léo and Raille, Guillaume and Van Pottelbergh, Tomas and Pasieka, Marek and Skrodzki, Andrzej and Huguenin, Nicolas and Dumonal, Maxime and Kościsz, Jan and Bader, Dennis and Gusset, Frédérick and Benheddi, Mounir and Williamson, Camila and Kosinski, Michal and Petrik, Matej and Grosch, Gaël},
journal = {Journal of Machine Learning Research},
number = {124},
pages = {1--6},
title = {{Darts: User-Friendly Modern Machine Learning for Time Series}},
url = {https://jmlr.org/papers/v23/21-1177.html},
volume = {23},
year = {2022}
}