Stay organized with collections
Save and categorize content based on your preferences.
The ML.MIN_MAX_SCALER function
This document describes the ML.MIN_MAX_SCALER function, which lets you scale
a numerical_expression to the range [0, 1]. Negative values are set to 0,
and values above 1 are set to 1.
When used in the
TRANSFORM clause,
the range of [0,1] is automatically used in prediction, and predicted
values outside that range are similarly capped.
Syntax
ML.MIN_MAX_SCALER(numerical_expression) OVER()
Arguments
ML.MIN_MAX_SCALER takes the following argument:
numerical_expression: the
numerical
expression to scale.
Output
ML.MIN_MAX_SCALER returns a FLOAT64 value that represents the scaled
numerical expression.
Example
The following example scales a set of numerical expressions to values between
0 and 1:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eML.MIN_MAX_SCALER\u003c/code\u003e function scales a numerical expression to a range between \u003ccode\u003e0\u003c/code\u003e and \u003ccode\u003e1\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eValues outside the \u003ccode\u003e[0, 1]\u003c/code\u003e range are capped, with negative values becoming \u003ccode\u003e0\u003c/code\u003e and values above \u003ccode\u003e1\u003c/code\u003e becoming \u003ccode\u003e1\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWhen used within a \u003ccode\u003eTRANSFORM\u003c/code\u003e clause, the scaling and capping of the range \u003ccode\u003e[0,1]\u003c/code\u003e is applied during prediction.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eML.MIN_MAX_SCALER\u003c/code\u003e function takes one argument, a numerical expression to scale, and returns a \u003ccode\u003eFLOAT64\u003c/code\u003e value.\u003c/p\u003e\n"]]],[],null,[]]