minMaxNormalize

Scales each element to the range 0, 1 using min-max normalization.

The minimum value maps to 0 and the maximum maps to 1, with all other values linearly interpolated between them. If all values are identical (range is zero), every element maps to 0.

Example:

doubleArrayOf(1.0, 2.0, 3.0, 4.0, 5.0).minMaxNormalize()
// [0.0, 0.25, 0.5, 0.75, 1.0]

Return

an array of normalized values in 0, 1.

Throws

if the array is empty.

if the array contains NaN or Infinity.


Scales each element to the range [newMin, newMax] using min-max normalization.

The minimum value maps to newMin and the maximum maps to newMax, with all other values linearly interpolated between them. If all values are identical (range is zero), every element maps to newMin.

Example:

doubleArrayOf(0.0, 5.0, 10.0).minMaxNormalize(-1.0, 1.0) // [-1.0, 0.0, 1.0]

Return

an array of normalized values in [newMin, newMax].

Parameters

newMin

the lower bound of the target range. Must be finite.

newMax

the upper bound of the target range. Must be finite and greater than newMin.

Throws

if the array is empty.

if newMin>= newMax, parameters are non-finite, or the array contains NaN or Infinity.


Scales each element to the range 0, 1 using min-max normalization.

This is a convenience overload that accepts any Iterable. The collection is materialized to a DoubleArray internally.

Return

a list of normalized values in 0, 1.

See also

Throws

if the collection is empty.

if the collection contains NaN or Infinity.


Scales each element to the range [newMin, newMax] using min-max normalization.

This is a convenience overload that accepts any Iterable. The collection is materialized to a DoubleArray internally.

Return

a list of normalized values in [newMin, newMax].

Parameters

newMin

the lower bound of the target range. Must be finite.

newMax

the upper bound of the target range. Must be finite and greater than newMin.

See also

Throws

if the collection is empty.

if newMin>= newMax, parameters are non-finite, or the collection contains NaN or Infinity.