reset
Description
IncrementalMdl = reset(
returns
the IncrementalMdl
)incrementalPCA
model IncrementalMdl
with reset principal component analysis (PCA)
properties. If any hyperparameters of IncrementalMdl
are estimated
during incremental fitting, the reset
function resets them as well.
reset
preserves the NumPredictors
,
NumComponents
, EstimationPeriod
,
WarmupPeriod
, and VariableWeights
properties of
IncrementalMdl
. However, the reset
function resets
WarmupPeriod
to the default value of 1000 if you specify
Coefficients
and Latent
(but do not specify
WarmupPeriod
) when you create
IncrementalMdl
.
Examples
Reset Incremental PCA Model
Create an incremental PCA model, fit the model, and then reset it after fitting to compare the model properties.
Load Data
Load the ionospheric data in ionosphere.mat
.
load ionosphere.mat
Create Incremental PCA Model Object
Create a model for incremental PCA. Specify a warm-up period of 100 observations, and standardize the predictor data using an estimation period of 100 observations. Specify the first variable weight as 1 and the remaining variable weights as 0.5.
IncrementalMdl = incrementalPCA(StandardizeData=true, ... WarmupPeriod=100,EstimationPeriod=100, ... VariableWeights=[1;0.5*ones(size(X,2)-1,1)]);
Display the properties of the IncrementalMdl
model object.
details(IncrementalMdl)
incrementalPCA with properties: IsWarm: 0 NumTrainingObservations: 0 WarmupPeriod: 100 Mu: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] Sigma: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] ExplainedVariance: [34x1 double] EstimationPeriod: 100 Latent: [34x1 double] Coefficients: [34x34 double] VariableWeights: [1 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 ... ] (1x34 double) NumComponents: 34 NumPredictors: 34
IncrementalMdl
is an incrementalPCA
model object. The model is not warm, meaning that the fit
function does not return transformed data until it processes 200 observations.
Fit Incremental Model
Fit the incremental model IncrementalMdl
to the data by using the fit
function. To simulate a data stream, fit the model in chunks of 10 observations at a time. At each iteration:
Process 10 observations.
Overwrite the previous incremental model with a new one fitted to the incoming observations.
n = numel(X(:,1)); numObsPerChunk = 10; nchunk = floor(n/numObsPerChunk); % Incremental fitting for j = 1:nchunk ibegin = min(n,numObsPerChunk*(j-1) + 1); iend = min(n,numObsPerChunk*j); IncrementalMdl = fit(IncrementalMdl,X(ibegin:iend,:)); end
Display the properties of the fitted IncrementalMdl
model object.
details(IncrementalMdl)
incrementalPCA with properties: IsWarm: 1 NumTrainingObservations: 250 WarmupPeriod: 100 Mu: [0.8300 0 0.6670 -0.0380 0.6708 0.0688 0.6655 -0.0140 0.6300 0.0748 0.5715 0.0963 0.5414 0.1195 0.4708 -0.0354 0.5263 0.0075 0.4527 -0.0185 0.4390 0.0798 0.3596 -0.0106 0.4956 -0.0706 0.6263 -0.0296 0.2949 ... ] (1x34 double) Sigma: [0.3756 0 0.5669 0.5297 0.5386 0.5222 0.5144 0.5640 0.5202 0.5310 0.6145 0.5843 0.5476 0.5236 0.6301 0.5532 0.6114 0.6216 0.6637 0.6501 0.6264 0.6105 0.6634 0.6409 0.6032 0.6497 0.4746 0.6716 0.6981 0.6541 ... ] (1x34 double) ExplainedVariance: [34x1 double] EstimationPeriod: 100 Latent: [34x1 double] Coefficients: [34x34 double] VariableWeights: [1 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 ... ] (1x34 double) NumComponents: 34 NumPredictors: 34
Reset Incremental Model
Reset the fitted incremental model and compare it to the previous model to see which properties are reset.
newMdl = reset(IncrementalMdl); details(newMdl)
incrementalPCA with properties: IsWarm: 0 NumTrainingObservations: 0 WarmupPeriod: 100 Mu: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] Sigma: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] ExplainedVariance: [34x1 double] EstimationPeriod: 100 Latent: [34x1 double] Coefficients: [34x34 double] VariableWeights: [1 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 ... ] (1x34 double) NumComponents: 34 NumPredictors: 34
sum(newMdl.Coefficients(:))
ans = 0
sum(newMdl.Latent)
ans = 0
sum(newMdl.ExplainedVariance)
ans = 0
The
reset
function resets all model properties except the warm-up period, estimation period, variable weights, number of components, and number of predictors.
Input Arguments
IncrementalMdl
— Incremental PCA model
incrementalPCA
model object
Incremental PCA model, specified as an incrementalPCA
model object. You can create
IncrementalMdl
by calling incrementalPCA
directly.
Version History
Introduced in R2024a
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
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)