## 2 Materials and Methods
### Proposed Feature Selection Method
```
Input: dataset \(\Phi_{n}\)

Output: Two spectra set \(F_{T_{c}}\) and \(F_{f_{s}}\)

1: Initialize: \(T_{c}\), \(T_{c}\), \(F_{n}\) spectra set, \(T_{f}\) length of \(F_{n}\), \(n\) number of MLP networks
2:while\(T_{f}\) less than \(T_{c}\)do
3:for\(i=1\) to \(n\)do
4: Initialize: epoch, \(max\_epoch\), network weight \(\psi\)
5:whileepoch < \(max\_epoch\)do
6: Train, test, and validate network performances
7: Find optimal weight \(\psi_{i}\) for which validation accuracy maximum
8: Compute normalized weight \(\mu_{i}=\psi_{i}/\max(\psi)\)
9:end
10: Compute spectral position contingency table such that \(C_{t}(i)\) = sorted \(\mu_{i}\)
11:end
12: Compute weight confidence matrix \(C_{t}\) by summing spectral weight \(\sum\limits_{i=1}^{n}\mu_{i}\)
13: Compute spectral rank \(F\) by sorting \(C_{\mu}\)
14: Compute \(C_{p}\) using Equation (2)
15:for\(i=1\) to \(T_{f}\)do
16:if Equation (3) is true do
17: Exchange spectral rank position \(F(j)\) and \(F(j-1)\)
18:end
19:end
20: Set \(F_{top}=F(\text{top 80\%\ spectra})\) and \(F_{bot}=F(\text{bottom 20\%\ spectra})\)
21:for\(k=1\) to the length of \(F_{bot}\)do
22:\(spectra\_set\) = addition of spectra \(F_{top}\) and \(F_{bot}(k)\)
23: fit(\(k\)) = classification accuracy using SVM of \(spectra\_set\)
24:\(ig(k)\) = calculate information gain of spectra \(F_{bot}(k)\)
25:end
26: Compute \(fit_{N}=\text{sort}(fit/\max(fit))\)
27: Compute \(ig_{N}=\text{sort}(ig/\max(ig))\)
28:for\(l=1\) to the length of \(F_{bot}\)do
29:if\(fit_{N}(l)\) greater than 0.5 and \(ig_{N}(l)\) greater than 0.05 do
30: Set spectra \(F_{bot}(l)\) as significant and assign to \(F_{r}\)
31:end
32:end
33: Updated spectra \(F_{n}\) by concatenating \(F_{top}\) and \(F_{r}\)
34:if\(T_{f}\) equals to \(T_{e}\)do
35: Generate all subsets of length \(f_{x}\) such as \(F_{f_{s}}(s)\in F_{n}\)
36: Compute classification accuracy for all sub spectra sets \(F_{f_{s}}\) using SVM classifier
37: Find best spectra set \(F_{f_{s}}\) for online application
38:end
39:if\(T_{f}\) equals to \(T_{c}\)do
40: Set \(F_{n}\) as \(F_{T_{c}}\) for quality control application
41:end
```  
**Algorithm 1**selection of significant spectral bands  
The spectral rank was updated based on the value of confidence weight and confidence position of two different spectra. At first, the confidence weight was checked for two spectra \(i\)th and \((i+1)\)th. If the confidence weight difference decreased by 5%, the confidence position value was then reassessed. So, the condition can be written as follows:  
\[(\psi_{F(j)}-\psi_{F(j-1)})\ \geq 0.05\ *\ \psi_{F(j)}\ \&\ C_{p}(F(j))<C_{p}F(j-1) \tag{3}\]  
The decreasing value was randomly chosen for the best fit. If the confidence position value of the \(i\)th feature spectra is less than that of the \((i+1)\)th spectra, then exchange the spectral position within the spectral rank matrix \(F\). Otherwise, the spectral rank matrix remains the same. The spectrum set was selected in an iterative process. Then, from the spectral rank matrix, the lowest-ranked 20% of spectra (\(F_{bot}\)) were removed in each iteration and the top 80% of spectra were considered significant spectra (\(F_{top}\)). However, the removed feature spectra set \(F_{bot}\) may contain important spectra due to the random weight assignment for each MLP network. Also, it was noticed that the removed spectra set contains some spectra whose correlated spectra were selected as important spectra. Therefore, spectral refinement was performed to find the potentially important spectra from \(F_{bot}\). In spectral refinement, the important spectra were calculated by finding the SVM and information gain fitness score. Therefore, each spectrum from \(F_{bot}\) was trained and cross-validated, coupled with \(F_{top}\), to calculate the fitness score. To make the spectral refinement process reliable, we considered only highly relevant spectra for which normalized fitness scores were greater than 0.5. Moreover, only highly relevant spectra were used to calculate information gain (IG).