# Optimization of Associative Knowledge Graph Using TF-IDF Based Ranking Score
## 2 Related Work
### Associative Knowledge Graph Optimization using Term Frequency-Inverse Document Frequency
```
Input : News Stream Data \(\rightarrow\) NewsData[k] Output : Optimized Transaction \(\rightarrow\) OptimizedTransaction[l] Step 1: TF-IDF Ranking Table Generation RankTable \(\leftarrow\) NULL // TF-IDF RankTable for i is number of NewsData[k] do  TF_Nouns \(\leftarrow\) extractNoun(NewsData[i])  TF_Corpus \(\leftarrow\) Corpus(TF_Nouns) // make TF_Nouns list to Corpus data  removeUnnecessaryData(TF_Corpus) // Create DocumentTermMatrix from TF_Corpus to calculate TF-IDF Weight  TF_DTM \(\leftarrow\) DocumentTermMatrix(TF_Corpus) endfor TF_DTM \(\leftarrow\) WeightTFIDF(TF_DTM) // Add TF-IDF Weights per Column to sum up TF-IDF of single News Data for i is number of column in TF_DTM do  RankTable[i] \(\leftarrow\) Sum(TF_DTM[i]) endfor // Sort RankTable by Score RankTable \(\leftarrow\) Sort(RankTable, RankTable.TotalColumnScore) Step 2: TF-IDF based Optimized Transaction Creation for i is number of NewsData[k] do  Nouns[i] \(\leftarrow\) extractNoun(NewsData[i]) // extract words from a row of news data for j is number of words extracted in Nouns[i] do for k is number of words in top 20% of RankTable do  // remove word if it cannot be found in the top 20% RankTable  if (Nouns[j]!= RankTable[k])  Remove(Nouns[j]) endfor endfor  NewsCorpus \(\leftarrow\) Corpus(Nouns[i])  removeUnnecessaryData(NewsCorpus)  OptimizedTransaction[i] \(\leftarrow\) Transaction(NewsCorpus) endfor return OptimizedTransaction
```  
**Algorithm 1** Optimized Transaction Generation Algorithm  
In the third stage, the generated transactions are applied to the association rule algorithm. At this time, pruning is performed in order to extract cleaned association rules. In the last stage, based on the association rules, data are visualized. From the simple association rules, latent associations and knowledge are extracted. That is because the model for effectively extracting and observing data meanings is needed. Figure 8 shows the rule graph after visualization. A graph can present the relation between objects. A graph is classified into the one-way graph ([Mental] => [Urban]) and bidirected graph ([Stress] => [Urban] and [Urban] => [Stress]). In the graph of Figure 8, all edges have their weight. If weight is given to an edge, it is possible to find a level of the relationship between nodes. For this reason, a graph can be used efficiently [35; 40]. This study uses a lift value of association rule as the weight of a graph edge. In addition, for the generation of association rules based on keywords, a TF-IDF weight presenting word importance is used for the vertex. For instance, the vertex value of stress is 19.07. The weight of {stress} => {urban} edge is 5.66. Figure 9 shows the optimized associative knowledge graph based on TF-IDF. It is the modeling of word topics for extracting information on health from the news corpus of traffic accidents. It is possible to expand to the knowledge base for predicting emerging health risks in the relation between a traffic accident and health topics. For example, in the optimized associative knowledge graph of Figure 9, the weight of [Traffic]\(\rightarrow\)[Congestion] is 1.877. Having the word 'congestion' in a traffic circumstance is a general association rule so that the value of lift is low. On the contrary, the lift value of {Traffic}\(\rightarrow\)[Depression] is 7.542. The appearance of 'depression' in a traffic circumstance is not general. In short, it is an  
Figure 8: Rule Graph after Visualization. Figure 9: Optimized Associative Knowledge Graph based on TF-IDF. association rule of providing new information. For this reason, the lift weight is high. Accordingly, the TF-IDF based knowledge graph generates more optimized knowledge than a conventional knowledge graph. Figure 10 presents non-optimized associative knowledge graph. The graph made in the way of setting the number of nodes only with the use of pruning in a conventional association rule graph. As shown in Figure 10, most nodes are empty root nodes, such as {-} => {tunnel}, presenting association rules.