メインコンテンツ

時系列データの統計的工程制御異常検出器の学習とテスト

R2026b

ファイル sineWaveAnomalyData.mat を読み込みます。このファイルには、3 チャネルの合成正弦波信号が 2 セット含まれています。

sineWaveNormal には、10 個の安定した周波数と振幅の正弦波が含まれています。各信号に小振幅の影響のような一連の劣化があります。信号ごとに長さと初期位相が異なります。sineWaveAbnormal には sineWaveNormal と同じ正弦波が含まれていますが、異常状態のデータも含まれています。

load sineWaveAnomalyData.mat
s1 = 3;

入力信号のプロット

最初の 3 つの異常状態の入力信号をプロットします。

tiledlayout("vertical")
ax = zeros(s1,1);
for kj = 1:s1
    ax(kj) = nexttile;
    plot(sineWaveAbnormal{kj})
    title("Anomalous Signals")
end

Figure contains 3 axes objects. Axes object 1 with title Anomalous Signals contains 3 objects of type line. Axes object 2 with title Anomalous Signals contains 3 objects of type line. Axes object 3 with title Anomalous Signals contains 3 objects of type line.

sineWaveAbnormal には、すべて同じ長さの 3 つの信号が含まれています。このセットの各信号には 1 つ以上の異常があります。

  • 1 つ目の信号には、すべてのチャネルに一定の時間にわたって続く周波数の急激な変化があります。

  • 2 つ目の信号には、チャネルの 1 つに一定期間の振幅の変化があります。

  • 3 つ目の信号には、すべてのチャネルにランダムな時点で発生するスパイクがあります。

検出器の作成

timeSeriesSpcAD コマンドを使用して、データの指数加重平均を追跡する 3 チャネルの検出器を作成します。

detector_tsspc = timeSeriesSpcAD(3, Method="ewma",WindowLength=10);

検出器の学習

通常状態のデータと既定の設定を使用して検出器に学習させます。

detector_tsspc = train(detector_tsspc,sineWaveNormal)
detector_tsspc = 
  TimeSeriesSPCDetector with properties:

       NumChannels: 3
      WindowLength: 10
            Stride: 10
            Method: "ewma"
            Lambda: 0.4000
    DetectionRules: "n1"
             Level: 3
        CenterLine: [0.0056 -0.0030 -2.9131e-04]
     StandardError: [0.3533 0.3504 0.3538]
              Mean: [0.0056 -0.0030 -2.9131e-04]
             Sigma: [0.7067 0.7008 0.7075]
         MeanRange: [0.1533 0.3004 0.0925]
         IsTrained: 1

検出結果のプロット

sineWaveAbnormal(2) の検出結果をプロットします。

figure(1);
detector_tsspc.plot(sineWaveAbnormal{2}, "PlotType","anomaly")

Figure contains 2 axes objects. Axes object 1 with title Anomalies, xlabel Samples, ylabel Signal contains 7 objects of type patch, line. These objects represent Labeled Anomalies, Raw Signal (Channel 3), Raw Signal (Channel 2), Raw Signal (Channel 1), Detected Anomalies (Channel 3), Detected Anomalies (Channel 2), Detected Anomalies (Channel 1). Axes object 2 with title EWMA Control Chart, xlabel Window Start Index, ylabel Batch-Means Signal contains 5 objects of type line, constantline. One or more of the lines displays its values using only markers These objects represent Batch-Means Signal (Channel 3), Batch-Means Signal (Channel 2), Batch-Means Signal (Channel 1), Detected Anomalies (across all channels), UCL, CL, LCL.

プロットは、検出器が異常を正しく検出したことを示しています。

ヒストグラムのプロット

異常スコアのヒストグラムをプロットします。

figure(2);
detector_tsspc.plotHistogram(sineWaveNormal{2}, sineWaveAbnormal{2})

Figure contains an axes object. The axes object with title Anomaly Score Distribution, xlabel Anomaly Scores, ylabel Probability (Histogram) contains 3 objects of type histogram, constantline. These objects represent Anomaly Scores 1, Anomaly Scores 2.

参考

|

トピック