主要内容

quantileBinnerComponent

Pipeline component for binning data based on quantiles

Since R2026a

    Description

    quantileBinnerComponent is a pipeline component that bins data using quantiles as bin edges. Unless otherwise specified, the component bins data into equally-probable bins. The pipeline component uses the functionality of the quantile function during the learn phase to compute bin edges. The component uses the functionality of the discretize function during the run phase to bin new data.

    Creation

    Description

    component = quantileBinnerComponent creates a pipeline component for binning data based on quantiles.

    component = quantileBinnerComponent(Name=Value) sets writable Properties using one or more name-value arguments. For example, Probability=0.5 specifies to create two equally-probable bins.

    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.

    Number of bins, specified as a positive integer scalar. During the learn phase, the component computes the bin edge values for NumBins equally probable bins.

    Example: c = quantileBinnerComponent(NumBins=5)

    Example: c.NumBins = 15

    Data Types: single | double

    Cumulative probabilities for which to compute the bin edges, specified as a positive scalar or vector of positive scalars in the range (0,1]. During the learn phase, the component computes the quantile for each cumulative probability in Probabilities, resulting in length(Probability)+1 bins.

    Example: c = quantileBinnerComponent(Probability=0.3)

    Example: c.Probability = [0.25 0.5 0.75]

    Data Types: single | double

    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 = quantileBinnerComponent(Name="Binner")

    Example: c.Name = "EqualWidthBinner"

    Data Types: char | string

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

    Example: c = quantileBinnerComponent(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 = quantileBinnerComponent(Outputs="BinnedX")

    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 = quantileBinnerComponent(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 = quantileBinnerComponent(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.

    Bin edges, returned as a vector. Since each value represents one quantile, Edges contains only the edges which divide the bins. It does not store the leading edge of the first bin or the trailing edge of the last bin.

    Data Types: cell

    This property is read-only.

    Names of the variables used by the component to compute the bin edge values, 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 quantileBinnerComponent pipeline component. Specify to bin data based on the cumulative probabilities 0.05, 0.25, 0.75, and 0.95.

    component = quantileBinnerComponent(Probability=[0.05 0.25 0.75 0.95])
    component = 
      quantileBinnerComponent with properties:
    
                 Name: "QuantileBinner"
               Inputs: "DataIn"
            InputTags: 1
              Outputs: "DataBinned"
           OutputTags: 1
    
       
    Learnables (HasLearned = false)
                Edges: []
        UsedVariables: []
    
       
    Learn Parameters (unlocked)
              NumBins: 10
          Probability: [0.0500 0.2500 0.7500 0.9500]
    
    
    Show all parameters
    

    component is a quantileBinnerComponent object that contains two learnables: Edges and UsedVariables. These properties remains empty until you pass data to the component during the learn phase.

    Load the carbig dataset. Create a table containing the Acceleration variable.

    load carbig
    X = table(Acceleration);

    Use the learn object function to compute the bin edge values.

    component = learn(component,X)
    component = 
      quantileBinnerComponent with properties:
    
                 Name: "QuantileBinner"
               Inputs: "DataIn"
            InputTags: 1
              Outputs: "DataBinned"
           OutputTags: 1
    
       
    Learnables (HasLearned = true)
                Edges: {[4×1 double]}
        UsedVariables: "Acceleration"
    
       
    Learn Parameters (locked)
              NumBins: 10
          Probability: [0.0500 0.2500 0.7500 0.9500]
    
    
    Show all parameters
    

    Note that the HasLearned property is set to true and the Edges and UsedVariables are nonempty.

    Find the bin edge values.

    edges = component.Edges{1}
    edges =
    
       11.0000
       13.7000
       17.2000
       20.4200
    

    Version History

    Introduced in R2026a