# Evaluation of Artificial Intelligence-Based Models for Classifying Defective Photovoltaic Cells
## 2 Materials and Methods
### Methods
_SVM_ hyperparameter tuning from 200 random samples sized 55-training, 5-test: Now, exceeding 70% of success with _KNN_, _SVM_ is applied taking into account the following parameters:  
Core: function in charge of transporting the data to a higher dimension where a better separation of the same can be achieved. Sigmoidal, polynomial, and Gaussian functions and the linear core were taken into account for the experiment;  
Penalty parameter C: it is an indicator of the error that one is willing to tolerate. The values for C of 10, 50, 75, and 100 were taken into account for the experiment;  
Figure 4: Proposed methodology for the selection of main variables. Gamma: indicates how far the points are taken into account when drawing up the separating boundary. The gamma values of 1, 0.8, 0.6, 0.4, 0.1, 0.01, and 0.001 were taken into account for the experiment; Degree: degree of the function in the polynomial nucleus. Grades 1, 2, 3, and 4 were taken into account for the experiment; Based on these parameters, a search was done among all the possible combinations in order to calculate which one of them offered the best results applied to 200 random samples of size 55-training, 5-test. GridSearchCV was used to perform the above task. 5. Test _SVM_ with the best hyperparameters on 20,000 random samples sized 55-training 5-test: Once the ideal combination has been obtained, the efficacy of _SVM_ is estimated running the supervised method based on these parameters and applied to 20,000 random samples of size 55-training, 5-test. Hit and misclassification ratios related to group 3 are saved; Save results and return to first step: Back to step 1. For sufficiently wide data collection, it was necessary to run the previous process in Python for around 40 h to obtain 1800 iterations, of which 250 corresponded to those cases where _KNN_ and _SVM_ were calculated at the same time (since _KNN_ achieved more than 70% of success). The data available was 60 cells, which supposed very little information with which to carry out the study. This influenced the search for the best parameters for _KNN_ and _SVM_, since _Cross Validation_ was not applied (the best parameters would hardly be obtained). Instead, a search based on 200 random samples of size 55-train, 5-test was applied. Considering the results obtained, it could be concluded that the variables 4, 5, 8, 10, 13, 17, 19, 20, and 24 offered good global results as well as low error rates when making classifications related to group 3. Hence, those variables have been selected as representative ones, and it reduced the number of them from 9 to 7 by applying _PCA_ (saving the first variables that explain more than 99.5% of the variance of the data). Afterward, groups of 55 cells were made again to train each model, and it was validated with the 4 remaining classifiers in each case. The classifiers to be tested were the following: _KNN_, _SVM_, _RF_, and _MLP_. On the other hand, _CNN_ was also tested. Nevertheless, this classifier did not follow the same strategy as the four algorithms mentioned before (it directly used the 60, 113 \(\times\) 113 matrix as input data). These models were chosen and compared since they are the most used in classification [30; 31; 32]. Below are included some details of the architecture of the models used. _KNN_ and _SVM_ architectures have already been described in the previous paragraphs, in which the representative variables selection was detailed. The number of neighbors considered in _KNN_ was equal to the number of them obtained in the previous algorithm when the representative variables were selected. The same occurred with the hyperparameters obtained in _SVM_. According to _RF_, each classifier was built based on 500 trees. Additionally, _hyperparameter tuning_ was applied, combining the following parameters:  
1. Maximum depth: represents the maximum number of levels allowed in each decision tree. The values 20, 40, 60, 80, and 100 were taken into account;
2. Minimum points per node: this is the minimum number of data allowed in each partition.