Skip to content

Rescale

cicada edited this page Dec 7, 2022 · 5 revisions

title: Rescale permalink: /Rescale/

Rescale functions rescale

syntax

  • rescale(a, min, max)

definition

rescale(a, min, max) scales the attribute a between the literal/parameter minvalue and the literal/parametermax value.

The relative differences between the values in the new distribution are similar to the original distribution.

The resulting attribute has a new values unit and the same domain unit as attribute a.

description

To avoid rounding off errors in the rescale calculation, use a float32 of float64 value type for the a, min and max arguments.

Be cautious in using rescales. The values unit/metric of the original attribute get's lost, less checks can be applied and the results become more difficult to interpret.

conditions

The value type of attribute a and literal/parameter min and max must match.

since version

5.15

example

attribute rescale_NrInh (City) := rescale(City/NrInhabitants, 0f, 1f);

City/NrInhabitants rescale_nrInh
550 1
525 0.93
300 0.33
500 0.87
200 0.07
175 0
null null

domain City, nr of rows = 7

Clone this wiki locally