Skip to content

Predict network traffic

Time series prediction function: select ts_regression_predict(x, y, nPred, algotype,processType). The x parameter specifies the time sequence. Points in time are sorted in ascending order. Each point in time is a UNIX timestamp. Unit: seconds. The y parameter specifies the sequence of numeric data at a specific point in time. The nPred parameter specifies the number of points for prediction. The value is of the long type. Valid values: 1 to 500. The algotype parameter specifies the type of the prediction algorithm. Valid values: origin: uses the Gradient Boosted Regression Tree (GBRT) algorithm for prediction. forest: uses the GBRT algorithm for prediction based on the trend component decomposed by Seasonal and Trend decomposition using Loess (STL), and then uses the additive model to sum up the decomposed components and obtain the predicted data. linear: uses the Linear Regression algorithm for prediction based on the trend components decomposed by STL, and then uses the additive model to sum up the decomposed components and obtain the predicted data. The processType parameter specifies the preprocessing process for the data. Valid values: 0: requires no additional data preprocessing. 1: removes abnormal data before prediction.

SQL
*
and metric - type: demonetwork |
select
  ts_regression_predict(time, value, 24, 'origin', 1, 'avg')
from
  (
    select
      __time__ - __time__ % 900 as time,
      sum(value) as value
    from
      log
    GROUP BY
      time
    order by
      time
    limit
      1000
  )

SQLSample query result:

样例图片