window.variance

Disponible en:
window.variance(values)

Descripción

Esta función devuelve la varianza especificada de los valores de entrada.

Tipos de datos de parámetros

INT|FLOAT

Tipo de devolución

FLOAT

Códigos de ejemplo

Ejemplo 1

Este ejemplo devuelve la varianza de todos los números enteros.

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

Este ejemplo devuelve la varianza de todos los elementos flotantes.

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

Este ejemplo devuelve la varianza de números negativos.

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

En este ejemplo se devuelve un valor de varianza pequeño.

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

En este ejemplo se devuelve una varianza cero.

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

En este ejemplo se devuelve la varianza de números positivos y negativos.

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