Min-max scaler batch predict

Updated at:

When a dataset has columns with very different magnitudes—for example, one column ranging from 0 to 1 and another ranging from 10,000 to 100,000—those differences in scale can distort model training. Min Max Scaler Batch Predict applies a trained min-max normalization model to new data, scaling each value into a consistent range (by default [0, 1]) so that no single column dominates due to its magnitude.

This component requires a model generated by the Min Max Scaler Train component. It cannot be used standalone.

Supported compute engines

MaxCompute and Realtime Compute for Apache Flink.

How it works

The component transforms each value using:

normalized = (value - min) / (max - min) × (maxValue - minValue) + minValue

where min and max are the minimum and maximum values in the column, as calculated during training.

By default, minValue is 0 and maxValue is 1, producing output in the [0, 1] range. Both values can be customized.

Configure the component in Machine Learning Designer

Prerequisites

Before you begin, ensure that you have:

  • Completed a Min Max Scaler Train run and have a trained model available

  • Input data to normalize, accessible via a Read table or Read CSV file component

Input ports

Input port (left to right) Data type Recommended upstream component Required
Input model of the prediction None Min-max scaler train Yes
Input data of the prediction None Read table, Read CSV file Yes

Component parameters

Tab Parameter Required Description
Parameter Setting outputCols No New column names after normalization. The number of names must match the number of columns used during training. Separate multiple names with commas (,).
numThreads No Number of threads used by the component. Default: 1.
Execution Tuning Number of Workers No Number of workers. Must be used together with Memory per worker, unit MB. Valid values: 1–9999.
Memory per worker, unit MB No Memory allocated per worker. Valid values: 1024–65536. Unit: MB.

Output ports

Output port (left to right) Storage location Recommended downstream component Model type
Output result N/A None None

Example

Copy the following code into the code editor of a PyAlink script component. This replicates the behavior of the Min Max Scaler Batch Predict component in code form, using MinMaxScalerPredictBatchOp.

from pyalink.alink import *

def main(sources, sinks, parameter):
    model = sources[0]       # Trained model from Min Max Scaler Train
    batchData = sources[1]   # Input data to normalize
    predictor = MinMaxScalerPredictBatchOp()
    result = predictor.linkFrom(model, batchData)
    result.link(sinks[0])
    BatchOperator.execute()

sources[0] maps to the first input port (the trained model) and sources[1] maps to the second input port (the data to normalize). The normalized output is written to sinks[0].

What's next