window.variance

Unterstützt in:
window.variance(values)

Beschreibung

Diese Funktion gibt die angegebene Varianz der Eingabewerte zurück.

Parameterdatentypen

INT|FLOAT

Rückgabetyp

FLOAT

Codebeispiele

Beispiel 1

In diesem Beispiel wird die Varianz aller Ganzzahlen zurückgegeben.

// 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
Beispiel 2

In diesem Beispiel wird die Varianz aller Gleitkommazahlen zurückgegeben.

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
Beispiel 3

In diesem Beispiel wird die Varianz negativer Zahlen zurückgegeben.

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
Beispiel 4

In diesem Beispiel wird ein kleiner Varianzwert zurückgegeben.

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
Beispiel 5

In diesem Beispiel wird eine Varianz von null zurückgegeben.

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
Beispiel 6

In diesem Beispiel wird die Varianz von positiven und negativen Zahlen zurückgegeben.

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