如何使用时间序列模型进行未来可能发生的预警或异常检测?

问题描述

我有每月数据,并使用一些额外的回归变量将y转换为log(y)以使用Uncaught TypeError: Cannot read property '_handle' of undefined at :3000/static/js/0.chunk.js:168900 at Array.forEach (<anonymous>) at push../node_modules/set-blocking/index.js.module.exports (:3000/static/js/0.chunk.js:168897) at Object.<anonymous> (:3000/static/js/0.chunk.js:126738) at Object../node_modules/npmlog/log.js (:3000/static/js/0.chunk.js:127102) at __webpack_require__ (:3000/static/js/bundle.js:785) at fn (:3000/static/js/bundle.js:151) at Object.<anonymous> (:3000/static/js/0.chunk.js:127799) at Object../node_modules/opencv-build/build/utils.js (:3000/static/js/0.chunk.js:128015) at __webpack_require__ (:3000/static/js/bundle.js:785) at fn (:3000/static/js/bundle.js:151) at Object.<anonymous> (:3000/static/js/0.chunk.js:127280) at Object../node_modules/opencv-build/build/dirs.js (:3000/static/js/0.chunk.js:127306) at __webpack_require__ (:3000/static/js/bundle.js:785) at fn (:3000/static/js/bundle.js:151) at Object../node_modules/opencv-build/build/constants.js (:3000/static/js/0.chunk.js:127242) at __webpack_require__ (:3000/static/js/bundle.js:785) at fn (:3000/static/js/bundle.js:151) at Object../node_modules/opencv-build/build/index.js (:3000/static/js/0.chunk.js:127599) at __webpack_require__ (:3000/static/js/bundle.js:785) at fn (:3000/static/js/bundle.js:151) at Object.<anonymous> (:3000/static/js/0.chunk.js:128064) at Object../node_modules/opencv4nodejs/lib/cv.js (:3000/static/js/0.chunk.js:128136) at __webpack_require__ (:3000/static/js/bundle.js:785) at fn (:3000/static/js/bundle.js:151) at Object.<anonymous> (:3000/static/js/0.chunk.js:128154) at Object../node_modules/opencv4nodejs/lib/opencv4nodejs.js (:3000/static/js/0.chunk.js:128159) at __webpack_require__ (:3000/static/js/bundle.js:785) at fn (:3000/static/js/bundle.js:151) at Module.<anonymous> (:3000/static/js/main.chunk.js:1552) at Module../src/components/render.js (:3000/static/js/main.chunk.js:2597) at __webpack_require__ (:3000/static/js/bundle.js:785) at fn (:3000/static/js/bundle.js:151) at Module../src/components/FaceFilter.js (:3000/static/js/main.chunk.js:148) at __webpack_require__ (:3000/static/js/bundle.js:785) at fn (:3000/static/js/bundle.js:151) at Module../src/components/App.js (:3000/static/js/main.chunk.js:72) at __webpack_require__ (:3000/static/js/bundle.js:785) at fn (:3000/static/js/bundle.js:151) at Module../src/index.js (:3000/static/js/main.chunk.js:2627) at __webpack_require__ (:3000/static/js/bundle.js:785) at fn (:3000/static/js/bundle.js:151) at Object.1 (:3000/static/js/main.chunk.js:2873) at __webpack_require__ (:3000/static/js/bundle.js:785) at checkDeferredModules (:3000/static/js/bundle.js:46) at Array.webpackJsonpCallback [as push] (:3000/static/js/bundle.js:33) at :3000/static/js/main.chunk.js:1 从201601到202008年我有60个数据点。

这是我的模式:

prophet model.

我只用60分就对相同的数据进行训练和测试。

现在要提一个重要的问题,我想在holidays = pd.DataFrame({ "holiday":"New_Year","ds": pd.to_datetime(["2015-11-30","2016-11-30","2017-11-30","2018-11-30","2019-11-30","2020-11-30"]),"lower_window":-15,"upper_window":90 }) m = Prophet(interval_width=0.95,holidays=holidays) for c in cols: m.add_regressor(c) m.fit(data) train_forecast = m.predict(data)

的未来几个月(比如说6个月的预测)中提早警告所有异常值/异常

当前方法:我采用yhat的均值和标准差,然后在这60个数据点上绘制1std,2std和3std线。无论超出第三标准,我都将其标记为预警。这是正确的方法吗?

问题1 :由于我采用了interval_width = 0.95,所以我对未来数据的预测是否始终落在3个标准差的预测值之内?在那种情况下,我将永远不会异常。

我也在许多博客中看到了这种方法:

202009 to 202012

但是对于看不见的数据(未来6个月),我不会使用y_original > forecasted['yhat_upper'] = 1 y_original< forecasted['yhat_lower']= -1 吗?因此,该方法不适用于预测值。

问题2::如何使用现有的Prophet模型为未来的预测值标记异常?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)