reset
説明
例
インクリメンタル回帰モデルのリセット
ロボット アームのデータ セットを読み込みます。標本サイズ n
と予測子変数の数 p
を取得します。
load robotarm
n = numel(ytrain);
p = size(Xtrain,2);
データ セットの詳細については、コマンド ラインで Description
を入力してください。
回帰用のインクリメンタル線形モデルを作成します。次のようにモデルを構成します。
メトリクスのウォームアップ期間を観測値 1000 個に指定。
メトリクス ウィンドウ サイズを観測値 500 個に指定。
すべての回帰係数およびバイアスを 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
はインクリメンタル学習用に構成された incrementalRegressionLinear
モデル オブジェクトです。プロパティはすべて読み取り専用です。
それぞれ 50 個の観測値の入力チャンクを使用して、データ ストリームをシミュレートします。各反復で次を行います。
updateMetricsAndFit
を呼び出してパフォーマンス メトリクスを更新し、モデルをデータの入力ウィンドウに当てはめます。前のインクリメンタル モデルを新しいモデルで上書きします。モデルを調べます。
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
モデルを表示します。
Mdl
Mdl = incrementalRegressionLinear IsWarm: 1 Metrics: [1x2 table] ResponseTransform: 'none' Beta: [32x1 double] Bias: -1.9425e-04 Learner: 'svm'
モデルはウォーム (IsWarm
=1) で、一部のプロパティの値を確認できます。
Metrics
プロパティを表示します。
Mdl.Metrics
ans=1×2 table
Cumulative Window
__________ _______
EpsilonInsensitiveLoss 0.68922 0.68538
このプロパティにはモデルのパフォーマンス メトリクスが格納され、この場合はイプシロン不感応損失です。累積の損失と最新のデータ ウィンドウの損失を示します。
モデル係数を表示します。
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
モデルをリセットし、同じパラメーターを表示します。
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
は、モデルのウォームアップ ステータス (IsWarm
= 0)、パフォーマンス メトリクスの値、および推定されたモデル パラメーターをリセットします。これらに加えて、各反復で更新される NumTrainingObservations
などのプロパティもリセットします。
入力引数
Mdl
— インクリメンタル学習モデル
incrementalRegressionLinear
モデル オブジェクト | incrementalRegressionKernel
モデル オブジェクト
インクリメンタル学習モデル。incrementalRegressionKernel
または incrementalRegressionLinear
というモデル オブジェクトとして指定します。Mdl
は、直接作成することも、サポートされている従来式の学習済み機械学習モデルを関数 incrementalLearner
によって変換して作成することもできます。詳細については、対応するオブジェクトのページを参照してください。
バージョン履歴
R2022a で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
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)