## 5 Comparing Thresholds and Confidence Intervals  
Using the thresholds and CI values determined, a method was developed to test the validity of the thresholds and the previously calculated CI from already categorized data. Testing these values ensure they belong to a transition zone of category values. This method can be integrated into a trend determination in the testing system. It is important to note that the method takes the values of the _passed_ category as a reference because these are the most abundant and represent the default class of tests. Since building a model requires training and testing phases, it is necessary to split the data. This split used 80% for training and the remaining 20% for validating and testing the logic followed by the model. The data splitting process was performed using a developed algorithm that followed these steps:  
* Randomly group all files;
* Create the respective training and test directories;
* Store 80% of the randomly grouped files in the training directory and 20% in the test directory. The training set is used to obtain the thresholds and CI. That is, with the files in the training directory, the calculations for the training portion of the data are repeated. Initially,the thresholds and CI are read from the training dataset, and a local dictionary is created with this information. After creating the dictionary and as a way to test the data, the model checks the quality of the thresholds and the CI through the median value of the quartiles coming from the extremes and quartiles diagrams according to the test ID (identifier). In the procedure used, the model assumes that the median is above or below, depending on the case, the threshold limit, or whether or not the median value lies between the defined CI intervals. Based on this procedure, the model returns a binary vector of labels where values of 0 are considered as the class _passed_ and values of 1 are considered as the class _failed_. This vector, called the prediction vector, is then compared with a vector that has the actual ratings (obtained directly from the text files where the data for an individual antenna are stored). The test directory is traversed to obtain the vector of real values, and if the file presents a failure in any of the tests, the value added to the vector is 1 (positive, that is, the failure is detected). Otherwise, if the file (representative of an individual antenna) does not present any failures, then the value added to the vector is 0 (negative). After obtaining the binary vectors of prediction and real values, both were compared, and the confusion matrices are represented in Figures 4 and 5. * _Precision_ = 0.771;
* _Balanced accuracy_ = 0.578;
* _Specificity_ = 0.993;
* _Recall_ = 0.162;
* _F1_Score_ = 0.268. The confusion matrices indicate that:  
* In the crossing of the first row with the first column are the true positives (the prediction coincides with the actual value, both positive);
* In the crossing of the first row with the second column are the false positives (the prediction does not match the actual value, the prediction indicates that the antenna has had no failures; however, the actual value indicates that the antenna has failed at least one test);
* In the crossing of the second row with the first column are the false negatives (the prediction indicates that the antenna has failed at least one of the tests, but in reality, there are no failures);
* In the crossing of the second row with the second column are the true negatives (the prediction indicates that the antenna has had no faults, and in fact, it does not, coinciding with the real value). Regarding the confusion matrix of the thresholds model, represented by Figure 4, for balanced _accuracy_ and _accuracy_, the result indicated that the model performed well, i.e., the procedure of the _thresholds_ model correctly classified most of the antennas. Regarding the _precision_, the value obtained for the metric reflected a large percentage of correctly classified positive samples.