NORMALIZE()

All functions > ARRAY > NORMALIZE()

Normalizes a numeric array by dividing each element by the sum of all elements.

Signatures

Returns: Normalized array where elements sum to 1

NORMALIZE(array: ARRAY<DOUBLE>) → ARRAY<DOUBLE>
sql
ParameterTypeRequiredDescription
arrayARRAY<DOUBLE>YesArray of numeric values to normalize

Notes

  • Divides each element by sum of all elements
  • Result sums to 1.0 (probability distribution)
  • Useful for creating probability vectors
  • Returns array of doubles

See also

Examples

FeatureQL
SELECT
    f1 := NORMALIZE(ARRAY(1, 2, 3)) -- Values sum to 1
;
Result
f1 ARRAY
[0.16666666666666666, 0.3333333333333333, 0.5]

Last update at: 2026/05/26 17:22:09