Skip to content

Scale

fast step  math

Scales the values of a numerical column to lie between a specified minimum and maximum.

Without further specification, the minimum and maximum by default are 0.0 and 1.0 respectively.

Usage


The following are the step's expected inputs and outputs and their specific types.

Step signature
scale(input: number, {
    "param": value
}) -> (output: number)

where the object {"param": value} is optional in most cases and if present may contain any of the parameters described in the corresponding section below.

Example

The following example scales input values to be in the range [0, 1].

Example call (in recipe editor)
scale(ds.input) -> (ds.scaled)
More examples

Using a custom configuration to scale values to the interval [-2, 2], rather than the default of [0, 1]:

Example call (in recipe editor)
scale(ds.input, {
  "min": -2,
  "max": 2,
}) -> (ds.scaled)

Inputs


input: column:number

A numeric input column.

Outputs


output: column:number

A numeric column containing the scaled values.

Parameters


min: number = 0.0

The minimum value after scaling.


max: number = 1.0

The maximum value after scaling.