Main Content

resume

Class: RegressionSVM

Resume training support vector machine regression model

Syntax

updatedMdl = resume(mdl,numIter)
updatedMdl = resume(mdl,numIter,Name,Value)

Description

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

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

updatedMdl = resume(mdl,numIter,Name,Value) returns an updated SVM regression model with additional options specified by one or more Name,Value pair arguments.

Input Arguments

expand all

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

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

Data Types: single | double

Name-Value Arguments

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.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Verbosity level, specified as the comma-separated pair consisting of 'Verbose' and either 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 the comma-separated pair consisting of 'NumPrint' and a nonnegative integer.

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

expand all

Updated SVM regression model, returned as a RegressionSVM model.

Examples

expand all

This example shows how to resume training an SVM regression model that failed to converge without restarting the entire learning process.

Load the carsmall data set.

load carsmall
rng default  % 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 =

     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 =

     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
updatedMdl.NumIterations
ans =

FeasibilityGap


ans =

    97

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

Tips

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

Extended Capabilities

Version History

Introduced in R2015b

expand all