숟가락 그만 얹어
Time-series Anomaly Detection by PCA (3) 본문
PCA에서의 Explainable AI다. [1] 논문에서는 complete decomposition contribution (CDC), partial decompostition contribution (PDC), diagonal contribution (DC), reconstruction-based contribution (RBC), angle-based contribution (ABC)를 비교하고, 위 방법들에다가 relative contribution을 적용하는 방법을 제안하였다. Simulation study로 특정 센서에 임의로 fault를 일으켜 그 센서에서 contribution 값이 실제로 증가하는지를 실험/증명하였는데, CDC를 제외하고는 대체로 비슷한 성능을 보였다. CDC와 PDC만 빠르게 구현해보았다.
# CDC_Tsq_index
C = np.dot(U[:, :num_comp], inv(np.sqrt(S_inv)))
C = np.dot(C, U[:, :num_comp].T)
CDC_Tsq_index = np.square(np.dot(C, X_test[fault_num].T))
for i in range(0, CDC_Tsq_index.shape[0]):
plt.plot(CDC_Tsq_index[i])
plt.show()
# CDC_SPE_index
C = np.dot(U[:, num_comp:], U[:, num_comp:].T)
CDC_SPE_index = np.square(np.dot(C, X_test[fault_num].T))
for i in range(0, CDC_SPE_index.shape[0]):
plt.plot(CDC_SPE_index[i])
plt.show()
# PDC_Tsq_index
C = np.dot(np.dot(U[:, :num_comp], S_inv), U[:, :num_comp].T)
for i in range(0, C.shape[0]):
# contribution for each variable
CI = np.dot(X_test[fault_num], C)[i, :]
# partial decompostion contribution
plt.plot(np.dot(X_test[fault_num], CI))
plt.show()
# PDC_SPE_index
C = np.dot(U[:, num_comp:], U[:, num_comp:].T)
for i in range(0, C.shape[0]):
# contribution for each variable
CI = np.dot(X_test[fault_num], C)[i, :]
# partial decompostion contribution
plt.plot(np.dot(X_test[fault_num], CI))
plt.show()
References
[1] C. F. Alcala et al., Analysis and generalization of fault diagnosis methods for process monitoring, J. of Process Control, 2011
'Research > Anomaly Detection' 카테고리의 다른 글
Deep SAD (0) | 2020.09.14 |
---|---|
Classification-based Anomaly Detection (0) | 2020.09.10 |
MSCRED (0) | 2020.08.29 |
Time-series Anomaly Detection by PCA (2) (0) | 2020.07.15 |
Time-series Anomaly Detection by PCA (1) (0) | 2020.07.15 |