Contenu principal

resume

R2026b

Resume training support vector machine regression model

Description

updatedMdl = resume(Mdl,numIterations) returns an updated support vector machine (SVM) regression model updatedMdl by training the model for an additional number of iterations as specified by numIterations.

resume applies the same training options to updatedMdl that you set when using fitrsvm to train Mdl.

example

updatedMdl = resume(Mdl,numIterations,Name=Value) returns an updated SVM regression model with additional options specified by one or more name-value arguments. For example, specify the verbosity level and the number of iterations between diagnostic message printouts.

Examples

collapse all

Resume training an SVM regression model that failed to converge without restarting the entire learning process.

Load the carsmall data set.

load carsmall
rng(0,"twister") % For reproducibility

Specify Acceleration, Cylinders, Displacement, Horsepower, and Weight as the predictor variables (X) and MPG as the response variable (Y).

X = [Acceleration,Cylinders,Displacement,Horsepower,Weight];
Y = MPG;

Train a linear SVM regression model. For illustration purposes, set the iteration limit to 50. Standardize the data.

Mdl = fitrsvm(X,Y,IterationLimit=50,Standardize=true);

Check to confirm whether the model converged.

Mdl.ConvergenceInfo.Converged
ans = logical
   0

The returned value of 0 indicates that the model did not converge.

Resume training the model for up to an additional 100 iterations.

updatedMdl = resume(Mdl,100);

Check to confirm whether the updated model converged.

updatedMdl.ConvergenceInfo.Converged
ans = logical
   1

The returned value of 1 indicates that the updated model did converge.

Check the reason for convergence and the total number of iterations required.

updatedMdl.ConvergenceInfo.ReasonForConvergence
ans = 
'FeasibilityGap'
updatedMdl.NumIterations
ans = 
97

The model converged because the feasibility gap reached its tolerance value after 97 iterations.

Input Arguments

collapse all

Full, trained SVM regression model, specified as a RegressionSVM model object trained using fitrsvm.

Number of iterations to continue training the SVM regression model, specified as a positive integer scalar.

Data Types: single | double

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: resume(Mdl,30,Verbose=0) specifies to continue training the SVM regression model Mdl for 30 iterations without displaying any optimization information in the Command Window.

Verbosity level, specified as 0, 1, or 2. Verbose controls the amount of optimization information that the software displays to the Command Window and is saved in the model as Mdl.ModelParameters.VerbosityLevel.

By default, Verbose is the value that fitrsvm used to train Mdl.

Example: Verbose=1

Data Types: single | double

Number of iterations between diagnostic message printouts, specified as a nonnegative integer scalar.

If you set Verbose=1 and NumPrint=numprint, then the software displays optimization diagnostic messages to the Command Window every numprint number of iterations.

By default, NumPrint is the value that fitrsvm used to train Mdl.

Example: NumPrint=500

Data Types: single | double

Output Arguments

collapse all

Updated SVM regression model, returned as a RegressionSVM model object.

Tips

If the optimization has not converged and Solver is set to "SMO" or "ISDA", then try to resume training the SVM regression model.

Extended Capabilities

expand all

Version History

Introduced in R2015b

expand all