diff --git a/docs/zh/06-advanced/06-TDgpt/04-forecast/04-lstm.md b/docs/zh/06-advanced/06-TDgpt/04-forecast/04-lstm.md new file mode 100644 index 0000000000..43b3fcba67 --- /dev/null +++ b/docs/zh/06-advanced/06-TDgpt/04-forecast/04-lstm.md @@ -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. \ No newline at end of file diff --git a/docs/zh/06-advanced/06-TDgpt/05-anomaly-detection/04-machine-learning.md b/docs/zh/06-advanced/06-TDgpt/05-anomaly-detection/04-machine-learning.md index b752d446eb..80a5cbe972 100644 --- a/docs/zh/06-advanced/06-TDgpt/05-anomaly-detection/04-machine-learning.md +++ b/docs/zh/06-advanced/06-TDgpt/05-anomaly-detection/04-machine-learning.md @@ -3,7 +3,9 @@ title: "机器学习算法" sidebar_label: "机器学习算法" --- -Autoencoder[1]: TDgpt 内置使用自编码器(Autoencoder)的异常检测算法,对周期性的时间序列数据具有较好的检测结果。使用该模型需要针对输入时序数据进行预训练,同时将训练完成的模型保存在到服务目录 `ad_autoencoder` 中,然后在 SQL 语句中指定调用该算法模型即可使用。 +Autoencoder[1]: TDgpt 内置使用自编码器(Autoencoder)的异常检测算法, +对周期性的时间序列数据具有较好的检测结果。使用该模型需要针对输入时序数据进行预训练, +同时将训练完成的模型保存在到服务目录 `ad_autoencoder` 中,然后在 SQL 语句中指定调用该算法模型即可使用。 ```SQL --- 在 options 中增加 model 的名称,ad_autoencoder_foo, 针对 foo 数据集(表)训练的采用自编码器的异常检测模型进行异常检测 diff --git a/tools/tdgpt/model/sample-ad-autoencoder/sample-ad-autoencoder.info b/tools/tdgpt/model/sample-ad-autoencoder/sample-ad-autoencoder.info new file mode 100644 index 0000000000..0703c99255 Binary files /dev/null and b/tools/tdgpt/model/sample-ad-autoencoder/sample-ad-autoencoder.info differ diff --git a/tools/tdgpt/model/sample-ad-autoencoder/sample-ad-autoencoder.keras b/tools/tdgpt/model/sample-ad-autoencoder/sample-ad-autoencoder.keras new file mode 100644 index 0000000000..43d90cb986 Binary files /dev/null and b/tools/tdgpt/model/sample-ad-autoencoder/sample-ad-autoencoder.keras differ diff --git a/tools/tdgpt/taosanalytics/test/unit_test.py b/tools/tdgpt/taosanalytics/test/unit_test.py index f6ecdf0d5b..aef689a8b6 100644 --- a/tools/tdgpt/taosanalytics/test/unit_test.py +++ b/tools/tdgpt/taosanalytics/test/unit_test.py @@ -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__':