## 3 Proposed Approach
### The HFuzzNDA Approach
```
1:Set \(\theta_{init}\), \(\theta_{adapt}\), \(\theta_{class}\), \(c_{max}=2\), \(N_{in}=p_{offline}\), \(N_{old}=p_{offline}\), \(t=0\), \(Ncur_{sm}=0\)
2:for each new \(j\)-th instance do
3:\(t=t+1\)
4:\(N_{in}=N_{in}+1\)
5: Calculate the highest typicality value \(maxt_{cj}\) and determine the corresponding existing class \(y_{c}\)
6: For instances, previously labelled as \(y_{c}\), calculate the mean of the highest typicality values \(m_{ct}\)
7:if\(\left(p_{offline}-N_{in}\right)==1\)then
8:\(m_{ct}=\theta_{init}\)
9:endif
10:if\(maxt_{cj}>\left(m_{ct}-\theta_{adapt}\right)\)then
11: The \(j\)-th instance belongs to class \(y_{c}\)
12: Update clusters that belong to the class \(y_{c}\) by using PFCM
13:if The number of clusters is greater than 2 then
14: Execute the merging procedure
15:endif
16:elseif\(maxt_{cj}>\left(m_{ct}-\theta_{class}\right)\)then
17: The \(j\)-th instance belongs to class \(y_{c}\)
18:if The number of clusters that belong to class \(y_{c}\) is less than \(c_{m}ax\)then
19: Increment the number of clusters that belong to class \(y_{c}\)
20: Create new cluster with \(j\)-th instance as its center
21: Execute NL-SHADE-RSP to refine the clusters
22: Calculate the membership and typicality matrices for all clusters
23:else
24: Determine the oldest cluster that belongs to class \(y_{c}\)
25: Create new cluster with \(j\)-th instance as its center
26: Execute NL-SHADE-RSP to refine the clusters
27: Calculate the membership and typicality matrices for all clusters
28:endif
29:endif
30: Execute the merging procedure
31:endif
32:else
33:if\(\left(Ncur_{sm}+1\right)\leq N_{sm}\)then
34:\(Ncur_{sm}=Ncur_{sm}+1\)
35: Store the \(j\)-th instance in the short memory
36:else
37: Execute the novelty detection procedure
38: Store the \(j\)-th instance in the updated short memory
39:endif
40:endif
41:endfor
```  
**Algorithm 2** One iteration of the online phase The original PFuzzND algorithm allows an increase in the number of clusters belonging to each class, but not the other way around. Experiments showed that in some cases the instances belonging to the same class might be divided into an excessive number of clusters which can can lead to bad classification results. Thus, in this study, it is proposed to merge clusters belonging to the same class if they are similar to each other, which allows for a decrease in their number. In [9], fuzzy similarity metric was introduced. It can be described in the following way: firstly, the dispersions of two considered clusters are calculated, then the dissimilarity between these clusters is determined and, finally, the sum of dispersions is divided by the dissimilarity value [9]. Each cluster's dispersion is the weighted sum of distances between instances belonging to this cluster and its centre, averaged by the number of considered instances. Note that the membership values are used as weights. The dissimilarity between two clusters is the Euclidean distance between their centres. In our study, the typicality values are used as the weight coefficients for calculating the similarity metric. We find two of the most similar clusters belonging to a given class, and determine if they should be merged by using the generalized soft \(C\) index metric [10] (here, we denote it as \(f_{merge}\)). To use the latter, we have to conduct calculations for all instances that belong to the considered class. However, this can significantly slow the algorithm, so only a part \(N_{c,B}\) (here, \(c\) is the class number and \(B\) is the batch size) of instances participate in calculating the \(f_{merge}\) values. The pseudo-code of the proposed merging procedure is demonstrated in Algorithm 3.