Load the human activity data set. Randomly shuffle the data.
For details on the data set, enter Description
at the command line.
Responses can be one of five classes: Sitting, Standing, Walking, Running, or Dancing. Dichotomize the response by identifying whether the subject is moving (actid > 2).
Create an incremental linear SVM model for binary classification. Configure it for loss by specifying the class names, prior class distribution (uniform), and arbitrary coefficient and bias values. Specify a metrics window size of 1000 observations.
Mdl
is an incrementalClassificationLinear
model. All its properties are read-only.
Simulate a data stream with incoming chunks of 50 observations each.
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.
Display some of the model parameters.
Mdl =
incrementalClassificationLinear
IsWarm: 1
Metrics: [1x2 table]
ClassNames: [0 1]
ScoreTransform: 'none'
Beta: [60x1 double]
Bias: -0.9069
Learner: 'svm'
ans=1×2 table
Cumulative Window
__________ ______
ClassificationError 0.0018185 0
ans = 10×1
-0.8806
-0.0259
1.6498
12.0393
0.4948
8.9050
0.1317
0.0006
0.1071
0.0092
The model is warm (IsWarm
=1), you can see the value of the performance metric, ClassificationError
, estimations for the model parameters, Bias
and Beta
.
Reset the model and display the same parameters.
newMdl =
incrementalClassificationLinear
IsWarm: 0
Metrics: [1x2 table]
ClassNames: [0 1]
ScoreTransform: 'none'
Beta: [60x1 double]
Bias: 0
Learner: 'svm'
ans=1×2 table
Cumulative Window
__________ ______
ClassificationError NaN NaN
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.