feat(gpt): support lstm and do some internal refactor, add sample autoencoder model.

This commit is contained in:
Haojun Liao 2025-03-18 09:39:38 +08:00
parent c25981cb0d
commit 3ee9a476ab
5 changed files with 35 additions and 2 deletions

View File

@ -0,0 +1,31 @@
---
title: "ARIMA"
sidebar_label: "ARIMA"
---
本节说明 LSTM 模型的使用方法。
## 功能概述
LSTM模型即长短期记忆网络(Long Short Term Memory),是一种特殊的循环神经网络,适用于处理时间序列数据、自然语言处理等任务,通过其独特的门控机制,能够有效捕捉长期依赖关系,
解决传统RNN的梯度消失问题从而对序列数据进行准确预测不过它不直接提供计算的置信区间范围结果。
完整的调用SQL语句如下
```SQL
SELECT _frowts, FORECAST(i32, "algo=lstm,alpha=95,period=10,start_p=1,max_p=5,start_q=1,max_q=5") from foo
```
```json5
{
"rows": fc_rows, // 返回结果的行数
"period": period, // 返回结果的周期性,同输入
"alpha": alpha, // 返回结果的置信区间,同输入
"algo": "lstm", // 返回结果使用的算法
"mse": mse, // 拟合输入时间序列时候生成模型的最小均方误差(MSE)
"res": res // 列模式的结果
}
```
### 参考文献
- [1] Hochreiter S. Long Short-term Memory[J]. Neural Computation MIT-Press, 1997.

View File

@ -3,7 +3,9 @@ title: "机器学习算法"
sidebar_label: "机器学习算法"
---
Autoencoder<sup>[1]</sup>: TDgpt 内置使用自编码器Autoencoder的异常检测算法对周期性的时间序列数据具有较好的检测结果。使用该模型需要针对输入时序数据进行预训练同时将训练完成的模型保存在到服务目录 `ad_autoencoder` 中,然后在 SQL 语句中指定调用该算法模型即可使用。
Autoencoder<sup>[1]</sup>: TDgpt 内置使用自编码器Autoencoder的异常检测算法
对周期性的时间序列数据具有较好的检测结果。使用该模型需要针对输入时序数据进行预训练,
同时将训练完成的模型保存在到服务目录 `ad_autoencoder` 中,然后在 SQL 语句中指定调用该算法模型即可使用。
```SQL
--- 在 options 中增加 model 的名称ad_autoencoder_foo 针对 foo 数据集(表)训练的采用自编码器的异常检测模型进行异常检测

View File

@ -99,7 +99,7 @@ class ServiceTest(unittest.TestCase):
if item["type"] == "anomaly-detection":
self.assertEqual(len(item["algo"]), 6)
else:
self.assertEqual(len(item["algo"]), 2)
self.assertEqual(len(item["algo"]), 3)
if __name__ == '__main__':