# Illuminant Estimation Using Adaptive Neuro-Fuzzy Inference System
## 3 Proposed Method
### ANFIS Modeling  
ANFIS is an integrated neuro-fuzzy modeling technique that embeds a Fuzzy Inference System (FIS) into the framework of adaptive neural networks (ANN). Based on a set of input-output pairs and the human reasoning process in the form of if-then rules, ANFIS has been used to construct many practical models [24; 37]. In this study, we apply this method to combine the unitary algorithms to estimate illuminant color for a given image.  
**ANFIS structure.** In ANFIS, Takagi-Sugeno-Kang (TSK) type of fuzzy logic is commonly used due to its computational efficiency, adaptive ability, and suitability for optimization. What's more, it can produce continuous output surfaces. For a TSK model with \(n\) rules, we have:  
\[Rule\ i:\quad\text{If }x_{1}\text{ is }L_{1}^{i},\ x_{2}\text{ is }L_{2}^{i},\ \cdots,\ x_{n}\text{ is }L_{n}^{i},\quad\text{Then }f_{i}(X)=m_{0}^{i}+\sum_{k=1}^{n}m_{k}^{i}, \tag{19}\]  
where \(i=1,2,\cdots,n\), \(L_{j}^{i}\) denotes the linguistic labels (fuzzy sets) for \(j=1,2,\cdots,n\), \(m_{k}^{i}\) represents the adjustable consequent parameters determined during the training of the model for \(k=1,2,\cdots,n\), and \(f_{i}(X)\) is the output of the \(i\)-th rule. With the form of if-then rules, ANFIS yet works in a similar way to a feedforward back-propagation type ANN. Its FIS parameters are encoded and optimized as connection weights in ANNs. The consequent parameters of defuzzification are identified using least square methods in the forward pass, and the premise parameters are adjusted using the gradient descent method in the backward pass. For more details, refer to [36; 37].  
**Training ANFIS models.** Since the total number of the clusters is \(k_{1}\cdot k_{2}\) in this study, we need to train the corresponding number of ANFIS models to capture the pattern in every cluster to map IIFs to GTs (illuminant ground truths) respectively. The FIS selected in this study is of TSK type with the subtractive clustering algorithm. We choose Gaussian function for the input membership function, and linear function for the output membership function. Once we choose the suitable ANFIS settings, ANFIS models can be automatically trained and model parameters will be obtained for predicting illuminant chromaticity components \(r\), \(g\), and \(b\).  
Table 1 presents the specifications of the ANFIS models developed in this study. After successful training, the parameters of each ANFIS model will be obtained, including the input membership functions. Figure 2 shows an example for the input Gaussian membership functions used by the three developed ANFIS networks after the training procedure.  
During model training, the sampling data fed to \(ij\)-th ANFIS model \(FIS_{ij}\) are the pairs of IIFs and GTs that are obtained from the images included in cluster \(SS_{ij}\). In order to reduce modeling complexity, we train three ANFIS models separately for each cluster, the first for predicting \(r_{gt}\), the second for predicting \(g_{gt}\), and the third for predicting \(b_{gt}\), where \(r_{gt}\), \(g_{gt}\), and \(b_{gt}\) are the ground truth chromaticity components of the training images. Thus, for each cluster \(SS_{ij}\) of the training dataset, we can get a model set which consists of three ANFIS models as follows:  
\[FIS_{ij}=\{FIS^{r}_{ij},FIS^{g}_{ij^{\prime}},FIS^{b}_{ij}\}. \tag{20}\]