## 4 Method
#### 4.1.4 Loss Function  
We leverage BCELoss as loss function, which is shown in Equation (12).  
\[\text{BCELoss}(x,y)=-(y\log x+(1-y)\log(1-x)) \tag{12}\]  
Our work is to achieve NER and RE in the quality engineering of continuous casting; hence, the loss functions are defined separately for the NER module and RE module, as shown in Equation (13).  
\[\begin{split}& L_{ner}=\sum\limits_{\hat{\theta}_{ij}^{k}\in S} \text{BCELoss}(e_{ij}^{k},\hat{\theta}_{ij}^{k})\\ & L_{re}=\sum\limits_{\hat{\theta}_{ij}^{k}\in S}\text{BCELoss}( r_{ij}^{k},\hat{r}_{ij}^{k})\end{split} \tag{13}\]  
As shown in Equation (13), \(L_{ner}\) is the loss function about continuous casting quality NER, \(L_{re}\) is the loss function about continuous casting quality RE, \(e_{ij}^{k}\) and \(r_{ij}^{k}\) are the continuous casting quality entity and relation's true category, while \(\hat{\theta}_{ij}^{k}\) and \(\hat{r}_{ij}^{k}\) are the continuous casting quality entity and relation's predicted category.  
The total loss function is shown as Equation (14).  
\[L=L_{ner}+\lambda L_{re} \tag{14}\]  
As shown in Equation (14), \(L\) is the total loss function, \(L_{ner}\) is the loss function about continuous casting quality NER, and \(L_{re}\) is the loss function about continuous casting quality RE.  
Knowledge Alignment Method for Quality Engineering of Continuous Casting Based on Semi-Supervised Incremental Learning  
In Section 4.1, we leverage the SAPRM to obtain structured unit knowledge in the quality engineering of continuous casting. This section integrates the extracted continuous casting quality entities by using knowledge alignment method to enhance the quality of knowledge.  
Formally, in the DSKG for the quality engineering of continuous casting, knowledge is represented as \(K\) = (_E,R,T_), where \(E\) represents entities, \(R\) represents relationships between entities, and \(T\) = (_E,R,E_) represents the triples in the KG. The fusion of redundant or ambiguous knowledge can be regarded as a matching task for entity pairs. Therefore, formally, its definition is as shown in Equation (15).  
\[\text{Match}(K_{1},K_{2})=\{(e_{1},e_{2})|e_{1}\in K_{1},e_{2}\in K_{2}\} \tag{15}\]  
As shown in Equation (15), \(K\) is the quality engineering knowledge of continuous casting, and \(e\) is an entity in kind \(k\).  
The knowledge fusion task involves finding all similar entities and generating matching results \(S=\{(e_{1},e_{2})|e_{1}\in K_{1},e_{2}\in K_{2}\}\), which represents two entities that have the same physical meaning.  
To achieve the above goal, we propose a DL model based on semi-supervised incremental learning for knowledge alignment, and a KG is refined based on the aligned triples. The proposed DL model based on semi-supervised incremental learning includes a supervised learning module, pseudo-label generation module, and incremental learning module. Figure 4 provides the overall flowchart of the knowledge alignment model, and the pseudocode is shown in Algorithm 2.  
```
Input: labeled pairs of entities \(W_{label}\) and unlabeled pairs of entities \(W_{unlabel}\) Output: finely-tuned BERT \(\text{BERT}_{\text{FT}}\leftarrow\text{fine-tune}(\text{BERT}(e_{1},e_{2}))\) for \((e_{1},e_{2})\) in \(W_{unlabel}\) for \((e_{1},e_{2})\) in \(W_{unlabel}\) \(pl\leftarrow\text{BERT}_{\text{FT}}((e_{1},e_{2}))\) \(W_{total}\gets W_{total}+(e_{1},e_{2})\) if confidence(\(pl\)) \(\geq\) threshold for \(w\) in \(W_{unlabel}\) \(e_{\text{P}}\leftarrow\text{replace }w\) with \(w^{\prime}\) if importance(\(w\)) \(\geq\) threshold m \(\leftarrow\text{BERT}_{\text{FT}}(e_{\text{P}},e_{2})\) \(W_{total}\gets W_{total}+(e_{\text{P}},e_{2})\) if \(m\) changed \(\text{BERT}_{\text{FT}}\leftarrow\text{fine-tune}(\text{BERT}(e_{1},e_{2}))\) for \((e_{1},e_{2})\) in \(W_{total}\) return BERT\({}_{\text{FT}}\)
```  
**Algorithm 2** Knowledge Alignment Method Based on Semi-supervised Incremental Learning.