# Ontology-Driven Semantic Analysis of Tabular Data:
## 5 Results
### Evaluation  
The quality of the algorithm was evaluated by accuracy, precision, recall, as well as the F1-measure metric, which considers both metrics. The calculation of metrics is carried out separately for each component of the knowledge triplets--objects, predicates, and subjects. Therefore, we will further understand further an element from the union of sets of objects, predicates, and subjects.  
For each class, we calculate the following parameters:  
1. True Positive (TP)--correct definition.
2. True Negative (TN)--correct definition.
3. False Positive (FP)--type I error.
4. False Negative (FN)--type II error.  
Based on the obtained parameters, we calculate the following quality metrics:  
1. Accuracy is a metric used to measure the performance of a classification model.
2. Precision is the proportion of objects that the algorithm correctly identified relative to all objects that the algorithm identified.
3. Recall is the proportion of objects that the algorithm correctly identified relative to all objects that are positive.
4. F1-score is the harmonic mean between precision and recall. The F1 score shows the balance between precision and recall.  
Appendix A shows Table A1, which consists of predicates and their metric indicators.  
For example, for predicates, a total of 8710 predicates were detected, of which 8691 were correctly detected, and 8750 were all predicates. Thus, Formulas (1)-(4) demonstrate the calculation of metrics:  
\[\text{Accuracy}=\frac{\text{TP}}{\text{TP}+\text{FN}+\text{FP}}=\frac{8691}{ 8750+19}=0.9911 \tag{1}\]  
\[\text{Precision}=\frac{\text{TP}}{\text{TP}+\text{FP}}=\frac{8691}{8710}=0.9978 \tag{2}\]  
\[\text{Recall}=\frac{\text{TP}}{\text{TP}+\text{FN}}=\frac{8691}{8750}=0.9932 \tag{3}\]  
\[\text{F1}=\frac{2*\text{Precision}*\text{Recall}}{\text{Precision}+\text{ Recall}}=\frac{2*0.9978*0.9932}{0.9978+0.9932}=0.9955 \tag{4}\]  
After the calculations, the following metrics for subjects, predicates and objects were obtained, as well as the final quality metrics for the classification of entities (Table 2).  
\begin{table}
\begin{tabular}{l c c c c c c c} \hline \hline
**Metrics** & **Discovered** & **Correct** & **Total Subjects** & **Macro** & **Macro** & **Macro F1** & **Accuracy** \\  & **Subjects (TP + FP)** & **Subjects (TP)** & **(TP + FN)** & **Precision** & **Recall** & **Macro F1** & **Accuracy** \\ \hline Subject classification & 8724 & 8709 & 8750 & 99.83\% & 99.53\% & 99.68\% & 99.36\% \\ Predicate & 8710 & 8691 & 8750 & 99.78\% & 99.33\% & 99.55\% & 99.11\% \\ classification & 8746 & 8743 & 8750 & 99.97\% & 99.92\% & 99.94\% & 99.88\% \\ Object classification & 26,180 & 26,143 & 26,250 & 99.86\% & 99.59\% & 99.72\% & 99.45\% \\ Final metrics & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \\ \hline \hline \end{tabular}
\end{table}
Table 2: Metrics for subjects, predicates, and objects, as well as final quality metrics for entity classification.  
As can be seen from Table 2, the algorithm has high accuracy, recall, and F1 measures. Misprints, use of synonyms, or other inaccuracies lead to a decrease in completeness, but adding varieties of spelling of words to the ontology allows for this metric to be increased.  
In the process of testing, 8697 triples were extracted and exported into the ontology, in which the subject, predicate and object were simultaneously defined. Considering that there were 8750 triplets in the tables, the completeness of extracting triplets is 99.4%, which significantly exceeds the threshold of 95% defined in the testing requirements.  
Such high metrics were obtained by using the Levenshtein distance to match entities and using ontology as a source of information about the structure of the knowledge area. This approach makes it possible to achieve a good quality object classification without the need to make changes to the algorithm when adding new entities or changing the knowledge area.