series_periods_validate()series_periods_validate()

检查时序是否包含给定长度的定期模式。Checks whether a time series contains periodic patterns of given lengths.

通常,测量应用程序流量的指标以每周或每天的时间段为特征。Often a metric measuring the traffic of an application is characterized by a weekly or daily period. 可通过运行 series_periods_validate()(检查每周和每天时间段)来确认此时间段。This period can be confirmed by running series_periods_validate() that checks for a weekly and daily period.

该函数采用一个列作为输入,该列中包含动态时序数组(通常是 make-series 运算符的结果输出)以及定义待验证时间段长度的一个或多个 real 数字。The function takes as input a column that contains a dynamic array of time series (typically the resulting output of make-series operator), and one or more real numbers that define the lengths of the periods to validate.

该函数输出两个列:The function outputs two columns:

  • periods :一个动态数组,包含要验证的时间段(在输入中提供)。periods : A dynamic array that contains the periods to validate (supplied in the input).
  • scores :一个动态数组,包含一个界于 0 到 1 之间的分数。scores : A dynamic array that contains a score between 0 and 1. 该分数显示时间段在 periods 数组中其各自位置上的重要性。The score shows the significance of a period in its respective position in the periods array.

语法Syntax

series_periods_validate(x, period1 [ , period2 , .series_periods_validate(x, period1 [ , period2 , . .. .. ] )] )

参数Arguments

  • x:动态数组标量表达式,它是一个数值数组,通常是 make-seriesmake_list 运算符生成的结果输出。x : Dynamic array scalar expression that is an array of numeric values, typically the resulting output of make-series or make_list operators.
  • period1、period2 等:指定要验证的时间段的 real 数字,以箱大小为单位 。period1 , period2 , and so on: real numbers specifying the periods to validate, in units of the bin size. 例如,如果将序列按 1 小时的箱分箱,则一个每周时间段为 168 个箱。For example, if the series is in 1h bins, a weekly period is 168 bins.

重要

  • 对于每个 period 参数,其最小值是 4,最大值是输入序列长度的一半。The minimal value for each of the period arguments is 4 and the maximal is half of the length of the input series. 对于在这些界限之外的 period 参数,输出分数将会是 0。For a period argument outside these bounds, the output score will be 0 .

  • 输入时序必须有规律(也就是必须在常数箱中聚合),并且如果是使用 make-series 创建的,则输入时序总是有规律。The input time series must be regular, that is, aggregated in constant bins, and is always the case if it has been created using make-series. 否则,输出就没有意义。Otherwise, the output is meaningless.

  • 该函数最多可接受 16 个要验证的时间段。The function accepts up to 16 periods to validate.

示例Example

下面的查询嵌入某应用程序流量一个月的快照,每天聚合两次(箱大小为 12 小时)。The following query embeds a snapshot of a month of an application’s traffic, aggregated twice a day (the bin size is 12 hours).

print y=dynamic([80,139,87,110,68,54,50,51,53,133,86,141,97,156,94,149,95,140,77,61,50,54,47,133,72,152,94,148,105,162,101,160,87,63,53,55,54,151,103,189,108,183,113,175,113,178,90,71,62,62,65,165,109,181,115,182,121,178,114,170])
| project x=range(1, array_length(y), 1), y  
| render linechart 

序列时间段

如果对此序列运行 series_periods_validate() 来验证一个每周时间段(长度为 14 个点),它会产生一个高分,而在验证一个 5 天时间段(长度为 10 个点)时分数为 0。If you run series_periods_validate() on this series to validate a weekly period (14 points long) it results in a high score, and with a 0 score when you validate a five-day period (10 points long).

print y=dynamic([80,139,87,110,68,54,50,51,53,133,86,141,97,156,94,149,95,140,77,61,50,54,47,133,72,152,94,148,105,162,101,160,87,63,53,55,54,151,103,189,108,183,113,175,113,178,90,71,62,62,65,165,109,181,115,182,121,178,114,170])
| project x=range(1, array_length(y), 1), y  
| project series_periods_validate(y, 14.0, 10.0)
series_periods_validate_y_periodsseries_periods_validate_y_periods series_periods_validate_y_scoresseries_periods_validate_y_scores
[14.0, 10.0][14.0, 10.0] [0.84,0.0][0.84,0.0]