window.variance

Supportato in:
window.variance(values)

Descrizione

Questa funzione restituisce la varianza specificata dei valori di input.

Tipi di dati dei parametri

INT|FLOAT

Tipo restituito

FLOAT

Esempi di codice

Esempio 1

Questo esempio restituisce la varianza di tutti gli interi.

// This rule creates a detection when the file size variance in 5 minutes for a user is over a threshold.
events:
 $e.user.userid = $userid
match:
 $userid over 5m
outcome:
  $p1 = window.variance($e.file.size) // yields 16 if the event file size values in the match window are [10, 14, 18].
condition:
  $e and #p1 > 10
Esempio 2

Questo esempio restituisce la varianza di tutti i numeri in virgola mobile.

events:
 $e.user.userid = $userid
match:
 $userid over 5m
outcome:
  $p1 = window.variance($e.file.size) // yields 20.148300 if the event file size values in the match window are [10.00, 14.80, 18.97].
condition:
  $e and #p1 > 10
Esempio 3

Questo esempio restituisce la varianza dei numeri negativi.

events:
 $e.user.userid = $userid
match:
 $userid over 5m
outcome:
  $p1 = window.variance($e.file.size) // yields 2366.333333 if the event file size values in the match window are [-1, -56, -98].
condition:
  $e and #p1 > 10
Esempio 4

Questo esempio restituisce un piccolo valore di varianza.

events:
 $e.user.userid = $userid
match:
 $userid over 5m
outcome:
  $p1 = window.variance($e.file.size) // yields 0.000000 if the event file size values in the match window are [0.000000, 0.000000, 0.000100].
condition:
  $e and #p1 > 10
Esempio 5

Questo esempio restituisce una varianza pari a zero.

events:
 $e.user.userid = $userid
match:
 $userid over 5m
outcome:
  $p1 = window.variance($e.file.size) // yields 0.000000 if the event file size values in the match window are [1, 1, 1].
condition:
  $e and #p1 > 10
Esempio 6

Questo esempio restituisce la varianza dei numeri positivi e negativi.

events:
 $e.user.userid = $userid
match:
 $userid over 5m
outcome:
  $p1 = window.variance($e.file.size) // yields 1.000000 if the event file size values in the match window are [1, 0, -1].
condition:
  $e and #p1 > 10