Contenuto principale

reset

Reset pipeline or component

Since R2026a

    Description

    unlearnedPipe = reset(learnedPipe) resets all data-dependent parameters (learnables) of the pipeline or component learnedPipe. The function unlocks learn parameters, but keeps any learn and run parameters previously set. The returned pipeline or component unlearnedPipe is ready to learn with new data.

    example

    unlearnedPipe = reset(learnedPipe,componentName) resets all learnables of the componentName component and any downstream components in the pipeline learnedPipe.

    unlearnedPipe = reset(___,ResetParameters=true) also resets all learn and run parameters, using any of the input argument combinations in previous syntaxes.

    You cannot reset structural parameters. Instead, you must create a component with new structural parameters.

    Examples

    collapse all

    Create a simple pipeline with two components in series.

    pca = pcaComponent(VarianceExplained=0.95);
    ecoc = classificationECOCComponent;
    pipeline = series(pca,ecoc)
    pipeline = 
    
      LearningPipeline with properties:
    
                 Name: "defaultName"
               Inputs: ["DataIn"    "Response"]
            InputTags: [1 2]
              Outputs: ["Predictions"    "Scores"    "Loss"]
           OutputTags: [1 0 0]
    
           Components: struct with 2 entries
          Connections: [6×2 table]
    
        HasLearnables: true
           HasLearned: false
    
    
    Show summary of the components

    The pipeline has two components with learnable parameters.

    Load sample data and define the predictor and response variables.

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

    Learn the pipeline by passing data through it. To see the learned parameters, index into the components.

    learnedPipeline = learn(pipeline,X,Y)
    learnedPCA = learnedPipeline.Components.PCA
    learnedECOC = learnedPipeline.Components.ClassificationECOC
    learnedPipeline = 
    
      LearningPipeline with properties:
    
                 Name: "defaultName"
               Inputs: ["DataIn"    "Response"]
            InputTags: [1 2]
              Outputs: ["Predictions"    "Scores"    "Loss"]
           OutputTags: [1 0 0]
    
           Components: struct with 2 entries
          Connections: [6×2 table]
    
        HasLearnables: true
           HasLearned: true
    
    
    Show summary of the components
    
    
    learnedPCA = 
    
      pcaComponent with properties:
    
                     Name: "PCA"
                   Inputs: "DataIn"
                InputTags: 1
                  Outputs: "DataOut"
               OutputTags: 1
    
       
    Learnables (HasLearned = true)
                       Mu: [5.8433 3.0573 3.7580 1.1993]
             Coefficients: [4×2 double]
            UsedVariables: ["SepalLength"    "SepalWidth"    "PetalLength"    "PetalWidth"]
    
       
    Structural Parameters (locked)
               UseWeights: 0
    
       
    Learn Parameters (locked)
        VarianceExplained: 0.9500
    
    
    Show all parameters
    
    
    learnedECOC = 
    
      classificationECOCComponent with properties:
    
                Name: "ClassificationECOC"
              Inputs: ["Predictors"    "Response"]
           InputTags: [1 2]
             Outputs: ["Predictions"    "Scores"    "Loss"]
          OutputTags: [1 0 0]
    
       
    Learnables (HasLearned = true)
        TrainedModel: [1×1 classreg.learning.classif.CompactClassificationECOC]
    
       
    Structural Parameters (locked)
          UseWeights: 0
    
    
    Show all parameters

    The components show the learned values, and the HasLearned property of the pipeline is set to true.

    Reset the pipeline and investigate the components.

    resetPipeline = reset(learnedPipeline)
    resetPCA = resetPipeline.Components.PCA
    resetECOC = resetPipeline.Components.ClassificationECOC
    resetPipeline = 
    
      LearningPipeline with properties:
    
                 Name: "defaultName"
               Inputs: ["DataIn"    "Response"]
            InputTags: [1 2]
              Outputs: ["Predictions"    "Scores"    "Loss"]
           OutputTags: [1 0 0]
    
           Components: struct with 2 entries
          Connections: [6×2 table]
    
        HasLearnables: true
           HasLearned: false
    
    
    Show summary of the components
    
    
    resetPCA = 
    
      pcaComponent with properties:
    
                     Name: "PCA"
                   Inputs: "DataIn"
                InputTags: 1
                  Outputs: "DataOut"
               OutputTags: 1
    
       
    Learnables (HasLearned = false)
                       Mu: []
             Coefficients: []
            UsedVariables: []
    
       
    Structural Parameters (locked)
               UseWeights: 0
    
       
    Learn Parameters (unlocked)
        VarianceExplained: 0.9500
    
    
    Show all parameters
    
    
    resetECOC = 
    
      classificationECOCComponent with properties:
    
                Name: "ClassificationECOC"
              Inputs: ["Predictors"    "Response"]
           InputTags: [1 2]
             Outputs: ["Predictions"    "Scores"    "Loss"]
          OutputTags: [1 0 0]
    
       
    Learnables (HasLearned = false)
        TrainedModel: []
    
       
    Structural Parameters (locked)
          UseWeights: 0
    
    
    Show all parameters

    The software resets all the learnable parameters of the components, and sets the HasLearned property to false.

    Input Arguments

    collapse all

    Pipeline or component to reset, specified as a LearningPipeline object or a learning component object in one of the following tables.

    Data Preprocessing Components

    ComponentPurpose
    equalWidthBinnerComponentGrouping data into equal-width bins
    frequencyEncoderComponentFrequency encoding categorical variables
    kmeansEncoderComponentFeature extraction using k-means clustering
    normalizerComponentNormalizing data
    observationImputerComponentImputing missing values
    observationRemoverComponentRemoving observations
    oneHotEncoderComponentEncoding categorical data into one-hot vectors
    outlierImputerComponentImputing outlier values
    outlierRemoverComponentRemoving outlier values
    pcaComponentPrincipal component analysis (PCA)
    quantileBinnerComponentBinning data into equally probable bins
    ricaComponentFeature extraction using reconstruction independent component analysis (RICA)
    sparseFilterComponentFeature extraction using sparse filtering

    Feature Selection and Engineering Components

    ComponentPurpose
    featureSelectionClassificationANOVAComponentFeature selection using one-way ANOVA test
    featureSelectionClassificationChi2ComponentFeature selection using chi-square tests
    featureSelectionClassificationKruskalWallisComponentFeature selection using Kruskal-Wallis test
    featureSelectionClassificationMRMRComponentMinimum redundancy maximum relevance (MRMR) feature selection in classification workflow
    featureSelectionClassificationNCAComponentNeighborhood component analysis (NCA) feature selection in classification workflow
    featureSelectionClassificationReliefFComponentReliefF feature selection in classification workflow
    featureSelectionRegressionFTestComponentFeature selection using F-tests
    featureSelectionRegressionMRMRComponentMinimum redundancy maximum relevance (MRMR) feature selection in regression workflow
    featureSelectionRegressionNCAComponentNeighborhood component analysis (NCA) feature selection in regression workflow
    featureSelectionRegressionReliefFComponentReliefF feature selection in regression workflow
    variableSelectorComponentManual variable selection

    Classification Model Components

    ComponentPurpose
    classificationDiscriminantComponentDiscriminant analysis classification
    classificationECOCComponentMulticlass classification using error-correcting output codes (ECOC) model
    classificationEnsembleComponentEnsemble classification
    classificationGAMComponentBinary classification using generalized additive model (GAM)
    classificationKernelComponentClassification using Gaussian kernel with random feature expansion
    classificationKNNComponentClassification using k-nearest neighbor model
    classificationLinearComponentBinary classification of high-dimensional data using a linear model
    classificationNaiveBayesComponentMulticlass classification using a naive Bayes model
    classificationNeuralNetworkComponentClassification using a neural network model
    classificationSVMComponentOne-class and binary classification using a support vector machine (SVM) classifier
    classificationTreeComponentDecision tree classifier

    Regression Model Components

    ComponentPurpose
    regressionEnsembleComponentEnsemble regression
    regressionGAMComponentRegression using generalized additive model (GAM)
    regressionGPComponentGaussian process regression
    regressionKernelComponentKernel regression using explicit feature expansion
    regressionLinearComponentLinear regression
    regressionNeuralNetworkComponentNeural network regression
    regressionSVMComponentRegression using a support vector machine (SVM)
    regressionTreeComponentDecision tree regression

    Custom Components

    ComponentPurpose
    functionComponentCustom function

    Name of the component to reset, specified as a character vector or string scalar. You can find the name of a component in a pipeline by indexing into the Components property using learnedPipe.Components.

    Data Types: char | string

    Output Arguments

    collapse all

    Pipeline or component with reset data-dependent parameters, returned as a LearningPipeline or learning component object. If unlearnedPipe is a pipeline, the software either resets all its components or resets only the component specified by componentName and its downstream components.

    Version History

    Introduced in R2026a