주요 콘텐츠

normalizerComponent

Pipeline component for normalizing data

Since R2026a

    Description

    normalizerComponent is a pipeline component that normalizes data. The pipeline component uses the functionality of the normalize function during the learn phase to compute the centering and scaling values. During the run phase, the component normalizes new data using these values.

    Creation

    Description

    component = normalizerComponent creates a pipeline component for normalization.

    component = normalizerComponent(Name=Value) sets writable Properties using one or more name-value arguments. For example, you can specify the center method type, scale method type, and rescale range.

    example

    Properties

    expand all

    Learn Parameters

    The software sets learn parameters when you create the component. You can modify learn parameters using dot notation any time before you use the learn object function. Any unset learn parameters use the corresponding default values.

    Center method type, specified as one of the following:

    • "mean" — Center data to have a mean of 0.

    • "median" — Center data to have a median of 0.

    • Numeric array — Shift center by an array of numeric values. The array must have a compatible size with the first data argument of learn.

    If ScaleType is "mad", the default value is "median". Otherwise, the default value is "mean".

    Example: c = normalizerComponent(CenterType="median")

    Example: c.CenterType = "mean"

    Data Types: char | string

    Rescale range, specified as a two-element row vector.

    This property is valid only when ScaleType is "range".

    Example: c = normalizerComponent(Range=[0 10])

    Example: c.Range = [50 100]

    Data Types: single | double

    Scale method type, specified as one of the following:

    • "std" — Scale data to have a standard deviation of 1.

    • "mad" — Scale data to have a median absolute deviation of 1.

    • "range" — Rescale range of data to Range.

    Example: c = normalizerComponent(ScaleType="mad")

    Example: c.ScaleType = "range"

    Data Types: char | string

    Component Properties

    The software sets component properties when you create the component. You can modify the component properties (excluding HasLearnables and HasLearned) using dot notation at any time. You cannot modify the HasLearnables and HasLearned properties directly.

    Component identifier, specified as a character vector or string scalar.

    Example: c = normalizerComponent(Name="NormalizeData")

    Example: c.Name = "ScaleData"

    Data Types: char | string

    Names of the input ports, specified as a character vector, string array, or cell array of character vectors.

    Example: c = normalizerComponent(Inputs="Data1")

    Example: c.Inputs = "X"

    Data Types: char | string | cell

    Names of the output ports, specified as a character vector, string array, or cell array of character vectors.

    Example: c = normalizerComponent(Outputs="ScaledX")

    Example: c.Outputs = "X"

    Data Types: char | string | cell

    Tags that enable the automatic connection of the component inputs with other components or pipelines, specified as a nonnegative integer vector. If you specify InputTags, then the number of tags must match the number of inputs in Inputs.

    Example: c = normalizerComponent(InputTags=2)

    Example: c.InputTags = 1

    Data Types: single | double

    Tags that enable the automatic connection of the component outputs with other components or pipelines, specified as a nonnegative integer vector. If you specify OutputTags, then the number of tags must match the number of outputs in Outputs.

    Example: c = normalizerComponent(OutputTags=0)

    Example: c.OutputTags=1

    Data Types: single | double

    This property is read-only.

    Indicator for the learnables, returned as 1 (true). A value of 1 indicates that the component contains Learnables.

    Data Types: logical

    This property is read-only.

    Indicator showing the learning status of the component, returned as 0 (false) or 1 (true). A value of 1 indicates that the learn object function has been applied to the component and the Learnables are nonempty.

    Data Types: logical

    Learnables

    The software sets learnables when you use the learn object function. You cannot modify learnables directly.

    This property is read-only.

    Centering values, specified as a numeric vector. Each value in Center corresponds to a variable in the first data argument of learn.

    The component computes the normalized variable N using the formula N = (X - C) ./ S, where X is the unnormalized variable, C is the corresponding value in Center, and S is the corresponding value in Scale.

    Data Types: single | double

    This property is read-only.

    Scaling values, specified as a numeric vector. Each value in Scale corresponds to a variable in the first data argument of learn.

    The component computes the normalized variable N using the formula N = (X - C) ./ S, where X is the unnormalized variable, C is the corresponding value in Center, and S is the corresponding value in Scale.

    Data Types: single | double

    This property is read-only.

    Names of the variables used by the component to normalize data, returned as a string array. The variables correspond to columns in the first data argument of learn.

    Data Types: string

    Object Functions

    learnInitialize and evaluate pipeline or component
    runExecute pipeline or component for inference after learning
    resetReset pipeline or component
    seriesConnect components in series to create pipeline
    parallelConnect components or pipelines in parallel to create pipeline
    viewView diagram of pipeline inputs, outputs, components, and connections

    Examples

    collapse all

    Create a normalizerComponent pipeline component. Specify to center data to a median value of 0.

    component = normalizerComponent(CenterType="median")
    component = 
      normalizerComponent with properties:
    
                 Name: "Normalizer"
               Inputs: "DataIn"
            InputTags: 1
              Outputs: "DataScaled"
           OutputTags: 1
    
       
    Learnables (HasLearned = false)
                Scale: []
               Center: []
        UsedVariables: []
    
       
    Learn Parameters (unlocked)
           CenterType: "median"
    
    
    Show all parameters
    

    component is a normalizerComponent object that contains three learnables: Center, Scale, and UsedVariables. These properties remains empty until you pass data to the component during the learn phase.

    Read the fisheriris data set into a table. Store the predictor and response data in the tables X and Y, respectively.

    fisheriris = readtable("fisheriris.csv");
    X = fisheriris(:,1:end-1);
    Y = fisheriris(:,end);

    Use the learn object function to normalize the predictor data X.

    component = learn(component,X)
    component = 
      normalizerComponent with properties:
    
                 Name: "Normalizer"
               Inputs: "DataIn"
            InputTags: 1
              Outputs: "DataScaled"
           OutputTags: 1
    
       
    Learnables (HasLearned = true)
                Scale: [0.8281 0.4359 1.7653 0.7622]
               Center: [5.8000 3 4.3500 1.3000]
        UsedVariables: ["SepalLength"    "SepalWidth"    "PetalLength"    "PetalWidth"]
    
       
    Learn Parameters (locked)
           CenterType: "median"
    
    
    Show all parameters
    

    Note that the HasLearned property is set to true and Center, Scale, and UsedVariables are nonempty.

    Find the centering values used to normalize the data.

    center = component.Center
    center =
    
        5.8000    3.0000    4.3500    1.3000

    Version History

    Introduced in R2026a

    See Also