## 2 Materials and Methods
### Modelling the Reactive Power with ANFIS
#### 2.2.3 ANFIS-Based Subtractive Clustering (SC)  
When the number of data distribution centres is unknown, this technique is useful. The subtractive clustering approach is a technique for overcoming the disadvantages of grid partitioning. The data set is divided into fuzzy clusters, and the different clusters are then mapped in the input space. As a result, the selected clusters' centres could be considered a system behaviour, and a cluster could be thought of as an \"if then\" rule in the Takagi-Sugeno model [22; 26; 54]. Subtractive clustering [57] is an algorithm for estimating the number of clusters in a data set as well as the centre of each cluster. Based on the density of surrounding data points, the algorithm assumes that each point in the data set is a potential cluster centre and calculates the probability that each point in the data set determines the cluster centre.  
For example, \(D_{i}\), the density measure for each point \(x_{i}\), is defined as [26] for n data (\(x_{1}\), \(x_{2}\),... \(x_{k}\)), according to (1):  
\[D_{i}=\sum_{j=1}^{n}e^{-\frac{|x_{i}-x_{j}|^{2}}{(\frac{n}{2})^{2}}} \tag{1}\]  
The radius of the cluster is defined by \(r_{a}\), which is a constant positive number in (1). From relation (1), it can be seen that the density value \(D_{i}\) is higher when there are more data points in the radius-defined neighbourhood. A point outside this vicinity will have virtually no influence. Since any data point may be the centre, the density index of each point in the neighbourhood must be determined based on this assumption.  
It is reasonable to state that a point's density measurement is a function of its distance from all other data points. As a result, a data point with more neighbours has a greater chance of being a cluster centre. The number of clusters is influenced by the bad value. This is why the number of clusters is called the radius of influence. The number of data  
Figure 5: (**a**) Partition of the input space; (**b**) ANFIS model based on partition with 3 fuzzy sets.  
groups and, by extension, the number of fuzzy rules, is higher when the error is lower, and vice versa.  
When it is unknown how many centres will be used to distribute the data, subtractive clustering is used. This algorithm evaluates each data point as a potential cluster centre candidate and then determines each data point's potential by calculating the density of the data points around it. The approach is iterative, and it assumes that any point could act as the centre of a cluster depending on where it is in relation to other data points.  
Even if the user does not define the number of clusters, the method divides the input space into them. Only the radius of each cluster is defined by the user. The radius is a number between 0 and 1 that represents the domain of control at the centre of each cluster. If the radius is too small, the cluster size is too small, and the number of clusters is too small, resulting in a larger number of fuzzy rules. The number of clusters and fuzzy rules decreases if the radius is too large, the cluster size is too large, and the radius is too large.