Standard scaler train

Updated at:

When features in your training data have different scales and units, algorithms sensitive to feature magnitude — such as linear models, support vector machines (SVMs), and neural networks — can produce biased results. The Standard Scaler Train component solves this by applying standardization to selected numeric columns, centering them around zero and scaling to unit variance. The output is a scaler model that the Standard Scaler Batch Predict component uses at inference time.

StandardScaler assumes the input data follows a normal distribution.
Standardization is most effective for algorithms sensitive to feature scale, such as linear models, SVMs, and neural networks. Tree-based models (such as gradient boosting and random forests) generally do not require standardization.

Limitations

Supported compute engines: MaxCompute and Realtime Compute for Apache Flink.

Configure the component in Machine Learning Designer

Input ports

Input port (left to right) Data type Recommended upstream component Required
data Integer Read Table, Read CSV File Yes

Component parameters

Tab Parameter Description
Field Setting selectedCols Columns to standardize. Select one or more columns. All selected columns must be numeric.
Parameter Setting withMean Subtract the column mean before scaling. Enabled by default (true).
withStd Divide by the column standard deviation. Enabled by default (true).
Execution Tuning Number of Workers Number of parallel workers. Must be a positive integer. Valid values: 1–9,999. Configure together with Memory per worker, unit MB.
Memory per worker, unit MB Memory allocated to each worker. Valid values: 1,024–65,536. Unit: MB.

Output ports

Output port (left to right) Storage location Recommended downstream component Model type
model N/A Standard Scaler Batch Predict None

Example

The following PyAlink code replicates the Standard Scaler Train component. Copy it into the code editor of the PyAlink Script component.

from pyalink.alink import *

def main(sources, sinks, parameter):
    data = sources[0]
    selectedColNames = ["col2", "col3"]
    # Fit the scaler on training data and output a scaler model
    modelop = StandardScalerTrainBatchOp()\
        .setSelectedCols(selectedColNames)
    result = modelop.linkFrom(data)
    # The output model is passed to Standard Scaler Batch Predict for inference
    result.link(sinks[0])
    BatchOperator.execute()

What's next