# Analytic Continual Learning-Based Non-Intrusive Load Monitoring Adaptive to Diverse New Appliances
## 3 Methodology
### Analytic Continual Learning-Based NILM Model Updating Strategy  
In streaming data, the NILM model needs to extend its novelty detection and load identification abilities from appliances in \(D_{0}\)-\(D_{k-1}\) to those in \(D_{0}\)-\(D_{k}\) as \(D_{k}\) arrives. To avoid the complexity and potential data leakage associated with storing original data, only the latest \(D_{k}\) was used in each round of continual learning. Without access to previous data, capturing the correlations and distinctions between new and original appliances becomes more difficult, increasing the risk of catastrophic forgetting. Recently, analytic continual learning has emerged as a new branch of continual learning [28], with preliminary validation in autonomous driving [29] and hyperspectral classification [30]. The core of the method is recursive Moore-Penrose learning, which treats \(D_{1}\) to \(D_{k}\) in streaming data as blocks in blockwise linear regression. It theoretically guarantees that learning \(D_{0}\) to \(D_{k}\) sequentially is equivalent to learning them simultaneously, eliminating the need to store original data and preventing catastrophic forgetting. Benefiting from the strong representation ability of the feature space obtained through the pretraining strategy in Section 3.3, the linearity assumption required for analytic continual learning can be effectively approximated. Therefore, it is expected to enable NILM to adapt to diverse new appliances. Once continual learning is triggered, the feature extraction module and the first fully connected layer in the novelty detection branch are frozen. For the load identification branch, if the new data contain new appliance types, the parameters \(W_{k}^{i}\) of the fully connected layer need to be extended to match the total number of types. Assuming the data from \(D_{0}\) to \(D_{k}\) are stored, the optimal solution for \(W_{k}^{i}\) in joint training is as follows:  
\[W_{k}^{i*}=\underset{W_{k}^{i}}{\text{argmin}}(\left\|Y_{0\sim k}-X_{0\sim k}^{ \text{en}}W_{k}^{i}\right\|_{\text{F}}^{2}+\gamma\left\|W_{k}^{i}\right\|_{ \text{F}}^{2}) \tag{6}\]  
where \(\gamma\) is the weight coefficient of the regularization term. The above optimization problem has an analytic solution, as shown below:  
\[W_{k}^{i*}=(\sum_{j=0}^{k}(X_{j}^{\text{en}})^{\text{T}}X_{j}^{\text{en}}+ \gamma I)^{-1}(\sum_{j=0}^{k}(X_{j}^{\text{en}})^{\text{T}}Y_{j})=R_{k}Q_{k} \tag{7}\]  
Figure 2: The raw appliance waveforms and the augmented waveforms with a signal-to-noise ratio of 5 dB: (**a**) air conditioner (raw waveform); (**b**) air conditioner (with random wandering noise); (**c**) air conditioner (with Gaussian noise); (**d**) Halogen Fluter (raw waveform); (**e**) Halogen Fluter (with random wandering noise); (**f**) Halogen Fluter (with Gaussian noise). According to the Woodbury matrix identity [31], \(R_{k}\) can be calculated recursively from \(D_{0}\) to \(D_{k}\), as shown in the following:  
\[R_{k}=\left(R_{k-1}^{-1}+(X_{k}^{\text{en}})^{\text{T}}X_{k}^{\text{en}}\right)^ {-1}=R_{k-1}-R_{k-1}(X_{k}^{\text{en}})^{\text{T}}(I+X_{k}^{\text{en}}R_{k-1}(X_ {k}^{\text{en}})^{\text{T}})^{-1}X_{k}^{\text{en}}R_{k-1} \tag{8}\]  
Further, \(Q_{k}\) is expanded to obtain the following:  
\[W_{k}^{\text{i*}}=R_{k}Q_{k}=R_{k}Q_{k-1}+R_{k}X_{k}^{\text{en}}Y_{k} \tag{9}\]  
Substituting (8) into (9) yields the following:  
\[R_{k}Q_{k-1}=(I-R_{k}(X_{k}^{\text{en}})^{\text{T}}X_{k}^{\text{en}})W_{k-1}^ {\text{i*}} \tag{10}\]  
Then, substituting (10) into (9) gives the recursive computation of \(W_{k}^{\text{i*}}\) from \(D_{0}\) to \(D_{k}\), as shown below:  
\[W_{k}^{\text{i*}}=(I-R_{k}(X_{k}^{\text{en}})^{\text{T}}X_{k}^{\text{en}})W_{k -1}^{\text{i*}}+R_{k}(X_{k}^{\text{en}})^{\text{T}}Y_{k} \tag{11}\]  
Consequently, when the streaming appliance data \(D_{k}\) arrives, \(R_{k}\) is first calculated according to (8), followed by the recursive computation of \(W_{k}^{\text{i*}}\) using (11), eliminating the need to store data from \(D_{0}\) to \(D_{k-1}\).