reset
Syntax
Description
Examples
Reset Incremental Regression Model
Load the robot arm data set. Obtain the sample size n
and the number of predictor variables p
.
load robotarm
n = numel(ytrain);
p = size(Xtrain,2);
For details on the data set, enter Description
at the command line.
Create an incremental linear model for regression. Configure the model as follows:
Specify a metrics warm-up period of 1000 observations.
Specify a metrics window size of 500 observations.
Configure the model to predict responses by specifying that all regression coefficients and the bias are 0.
Mdl = incrementalRegressionLinear('MetricsWarmupPeriod',1000,'MetricsWindowSize',500, ... 'Beta',zeros(p,1),'Bias',0,'EstimationPeriod',0)
Mdl = incrementalRegressionLinear IsWarm: 0 Metrics: [1x2 table] ResponseTransform: 'none' Beta: [32x1 double] Bias: 0 Learner: 'svm'
Mdl
is an incrementalRegressionLinear
model object configured for incremental learning. All properties are read-only.
Simulate a data stream with incoming chunks of 50 observations each. For each iteration:
Call
updateMetricsAndFit
to update the performance metrics and fit the model to the incoming window of data. Overwrite the previous incremental model with the new one.Investigate the model.
Call
reset
to reset the learned parameters and compare to the previous model to see which parameters are reset.
numObsPerChunk = 50; nchunk = floor(n/numObsPerChunk); for j = 1:nchunk ibegin = min(n,numObsPerChunk*(j-1) + 1); iend = min(n,numObsPerChunk*j); idx = ibegin:iend; Mdl = updateMetricsAndFit(Mdl,Xtrain(idx,:),ytrain(idx)); L(j) = loss(Mdl,Xtrain(idx,:),ytrain(idx)); PoL(j,:) = perObservationLoss(Mdl,Xtrain(idx,:),ytrain(idx)); end
Display the model.
Mdl
Mdl = incrementalRegressionLinear IsWarm: 1 Metrics: [1x2 table] ResponseTransform: 'none' Beta: [32x1 double] Bias: -1.9425e-04 Learner: 'svm'
The model is warm (IsWarm
=1), you can see the values of some of the properties.
Display the Metrics
property.
Mdl.Metrics
ans=1×2 table
Cumulative Window
__________ _______
EpsilonInsensitiveLoss 0.68922 0.68538
This property contains the model performance metrics, which, in this case, is the epsilon insensitive loss. It shows the cumulative loss and the loss for the latest data window.
Display the model coefficients.
Mdl.Beta(1:10)
ans = 10×1
-0.0002
-0.0002
-0.0004
0.0000
0.0006
0.0000
0.0003
-0.0010
0.0004
-0.0011
Reset the model and display the same parameters.
newMdl = reset(Mdl)
newMdl = incrementalRegressionLinear IsWarm: 0 Metrics: [1x2 table] ResponseTransform: 'none' Beta: [32x1 double] Bias: 0 Learner: 'svm'
newMdl.Metrics
ans=1×2 table
Cumulative Window
__________ ______
EpsilonInsensitiveLoss NaN NaN
newMdl.Beta(1:10)
ans = 10×1
0
0
0
0
0
0
0
0
0
0
reset
function resets the warmup status of the model (IsWarm
= 0), the values of the performance metrics, and the estimated model parameters. In addition to these, it resets the properties, such as NumTrainingObservations
, that the software updates at each iteration.
Input Arguments
Mdl
— Incremental learning model
incrementalRegressionLinear
model object | incrementalRegressionKernel
model object
Incremental learning model, specified as an incrementalRegressionKernel
or incrementalRegressionLinear
model object. You can create
Mdl
directly or by converting a supported, traditionally trained
machine learning model using the incrementalLearner
function. For
more details, see the corresponding object page.
Version History
Introduced in R2022a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)