## 3 Results
### LDA Topic Model Analysis  
#### 3.2.1 Estimation of the Optimal Number of Topics  
Determining the number of topics in an LDA model is critical to data interpretation and clustering effectiveness. Too many issues may lead to overfitting of the model, introducing noise and reducing interpretability; too few may ignore essential information, resulting in underfitting and failing to capture the deep structure of the data. In large-scale corpora, it is unclear how many topics there are only by experience and scientific estimation is needed to find the optimal number.  
Established methodologies for determining the most suitable number of topics for LDA are perplexity and thematic coherence. Perplexity reflects article categorization certainty and decreases with increasing topics, but too many issues may lead to overfitting. Thematic coherence measures inter-topic correlation and is another indicator to assess the strength of a model. Many empirical studies have demonstrated the effect of thematic coherence [23]. Generally, the higher a thematic coherence score is, the better the topic model is. Therefore, this paper adopts the two methods of perplexity and thematic coherence at the same time  
Figure 6: Visualized word cloud of the top 100 keywords.  
to comprehensively determine the optimum count of themes established by calculating the scores of perplexity and theme coherence under different numbers of themes. This method balances model predictability and the quality of the themes to achieve the best results for the theme model. This method has been widely used in many studies [24; 25; 26; 27; 28] to help researchers more accurately select the LDA model parameters suitable for the data, and then improve the performance and explanatory power of the topic model. The formula calculates the confusion degree:  
\[Perplexity(D_{test})=\exp\left(-\frac{\sum_{d=1}^{M}\text{log}p(w_{d})}{\sum_{ d=1}^{M}N_{d}}\right) \tag{9}\]  
where \(D_{test}\) denotes the set of all documents in the corpus, the full set of these records is \(M\), the word count of each record \(d\) is denoted by \(N_{d}\), \(w_{d}\) denotes the word in document \(d\), and \(p(w_{d})\) denotes the probability that the word \(w_{d}\) is produced.  
In this paper, we first set a maximum value of n_max_topics that the total number of topics may be taken, i.e., in general, the overall topic count in the text of the accident investigation report of the chemical enterprise exceeds this maximum value, which is not in line with the actual situation. In this study, n_max_topics = 100, that is, the overall topic count of the LDA topic model takes the value of the range 1-100 (take an integer) and then lets the Python program traverse all the number of topics to take the value of each traversal, each traversal of the other parameter \(\alpha\) to take the empirical value, that is, the inverse of the overall topic count of the current traversal of count of \(\beta\) 0.01, the number of sampling iterations to choose 1000 times. This yields the topic models and their corresponding perplexity and consistency scores for each topic under the total number of topics in the range of values taken. An image of the variation of perplexity and topic consistency with the number of topics is plotted, as shown in Figure 7. In the figure, when the number of topics is 50, the perplexity is at the inflection point, the value is the smallest, and the topic consistency is the largest. The number of topics at this time is the best estimate.  
Figure 7: Perplexity and thematic coherence curves.