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. This period can be confirmed by running series_periods_validate() that checks for a weekly and daily period.

Syntax

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

Learn more about syntax conventions.

Parameters

Name Type Required Description
series dynamic ✔️ An array of numeric values, typically the resulting output of make-series or make_list operators.
period1, period2, etc. real ✔️ The periods to validate in units of the bin size. For example, if the series is in 1h bins, a weekly period is 168 bins. At least one period is required.

Important

  • The minimal value for each of the period parameters is 4 and the maximal is half of the length of the input series. For a period argument outside these bounds, the output score will be 0.
  • 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.
  • The function accepts up to 16 periods to validate.

Returns

The function outputs a table with two columns:

  • periods: A dynamic array that contains the periods to validate as supplied in the input.
  • scores: A dynamic array that contains a score between 0 and 1. The score shows the significance of a period in its respective position in the periods array.

Example

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.

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)

Output

series_periods_validate_y_periods series_periods_validate_y_scores
[14.0, 10.0] [0.84, 0.0]