{'fraction_non_alphanumeric': 0.03451219512195122, 'fraction_numerical': 0.006707317073170732, 'mean_word_length': 4.75070126227209, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Discovering Symptom-herb Relationship by Exploiting SHT Topic Model

TCM has been widely researched through various methods in computer science in past decades, but none digs into huge amount of clinical cases to discover the meaningful treatment patterns between symptoms and herbs. To meet the challenge, we explore the unstructured and intricate experiential data in clinical case, and propose a method to discover the treatment patterns by introducing a novel topic model named SHT (Symptom-Herb Topic model). Combinational rules are incorporated into the learning process. We evaluate our method on 3,765 TCM clinical cases. The experiment validates the effectiveness of our method compared with LDA model and LinkLDA model.


Introduction
Traditional Chinese medicine (TCM) has been attracting more and more attention because of its complementary therapeutic effects to western medicines. TCM involves multiple types of entities, such as "herb," "prescription" (a composition that consists of certain herbs), "symptom," and "syndrome" ("Zheng" in Mandarin Chinese, a complex pattern of symptoms, which is used as a holistic summary of a patient's status). Multiple types of relations can exist between these heterogeneous entities, such as composition relations between herbs and prescription, treatment relations between symptoms and herbs. TCM clinical cases describe how doctors diagnose and cure the disease. The unstructured TCM clinical cases involve the symptoms of a patient, the corresponding herbs, the initial visit information and the return visit information. How to dig into enormous clinical cases to mine the valuable relations between symptoms and herbs remains a challenging task.
Data mining approaches play critical roles in TCM related topics, such as new drug discovery [1], syndrome differentiation [2], [13], herbal combinational rule mining [4], [5], intelligent diagnosis [7], and patient classification [14]. Related works on relation extraction from the TCM literature are scarce. Wu et al. [6] was one of the pioneering works on this subject. The authors used a bootstrapping method to extract syndrome-disease associations from a corpus of data. In a recent work by Wang et al. [4], the authors created a herbal network based on attribute similarity calculation, and employed random walk based community detection to discover the latent combinational relations between two herbs. Chen et al. [7] designed a data mining approach to examine the relationship among symptoms, syndromes and herbs. This tripartite information network derived more accurate information than linking symptom and herb alone. Wan et al. [10] used a heterogeneous factor graph model (HFGM) to infer the multiple types of relations (e.g., herb-syndrome, herbdisease) from the entire corpus of TCM literature. Zhao et al. [13] found that a novel machine learning algorithm, minimum reference set-based multiple instance learning, was superior to other machine learning algorithms for TCM syndrome differentiation.
Recently, more and more researchers have adopted topic models to discover the relations between TCM objects. Lin et al. [3] proposed a symptom-herb-therapies-diagnosis topic model to diagnose the disease and administer appropriate drugs and treatments given a patient's symptoms. Zhang et al. [8] proposed a hierarchical topic model (HSHT) to automatically extract the hierarchical latent topic structures with both symptoms and their corresponding herbs in the TCM clinical data. Yao et al. [11] employed Labeled-LDA (Labeled Latent Dirichlet Allocation) to mine treatment patterns in TCM clinical cases, but it only discovered the treatment patterns between herbs and disease by supervised model, which required labeled training data. The main goal of our paper is close to Zhang et al. [8]. However, we are different from theirs because: 1) We propose separate modeling for symptoms and herbs; 2) combinational rules between herbs are incorporated into the process of topic modeling, which is more consistent with TCM theory; that is, when two herbs are used together, their interaction should display their superiority over a single herb in the treatment of diseases.
In TCM, a syndrome can be inferred from symptoms. The process of the treatment is to determine syndromes by observing a patient's symptoms and then determine appropriate herbs. Thus, we consider that the symptoms of a patient and the corresponding Chinese herbs have the same latent topic, which is known as "syndrome." Based on this, we propose a topic model named SHT to automatically discover treatment patterns between sympc 2017 Information Processing Society of Japan toms and herbs from TCM clinical cases. After topic modeling, we can obtain the probability distribution of symptoms and its corresponding list of herbs in one topic (syndrome). The mining results provide valuable auxiliary information for TCM clinical diagnosis. Specifically, TCM doctors can use these associations to assist clinical treatment, since the mining results show the treatment patterns between symptoms and herbs. For example, to cure a patient with the disease "dyspnea with cough," the doctor can navigate the results and find out the corresponding herbs for reference (see Table 2). In addition, the extracted relations may promote the understanding of TCM in Western countries.

Topic Modeling
With respect to our topic model based method, a clinical case is considered as a "document." A clinical case involves the symptoms of a patient and the corresponding Chinese herbs, so herbs and symptoms are treated as "words" in the document. TCM doctors have to select a set of herbs to cure a syndrome, which is reflected by a pattern of symptoms. In this way, a clinical case is a mixture of "topics," syndromes are "topics" of the clinical case ("document"). And a "corpus" is a collection of clinical cases. Let . . , s n } be the set of symptoms. The generative process of clinical cases is shown in Fig. 1.
This process is analogous to the generative process of probabilistic topic model [15]. Topic models, like Latent Dirichlet Allocation (LDA) [15], model each document as a mixture of underlying topics. Traditional LDA model generates a single word from one topic. Here, we generate a single symptom and a single herb from one "syndrome." The generative processes for symptoms and herbs are very similar. Topics for symptoms are the probability distribution on symptom set, topics for herbs are the probability distribution on herb set. Note that Syndromes can be considered as the semantic bridge between symptoms and herbs. However, the efficiency of a single herb is usually limited in TCM. When two herbs are used together, their interaction should display their superiority over a single herb in the treatment of diseases, we say that these two herbs have compatibility rule. Thus, it is more meaningful to analyze paired herbs than a single herb.
Based on the above, we propose a novel topic model named SHT model to discover the treatment patterns between symptoms and herbs, and incorporate compatibility rules into the model. We introduce a variable x i to indicate whether herb h i has compatibility rule with herb h j . If x i = 1, then h i and h j are paired herbs; otherwise, they are generated from the distributions associated with their corresponding syndromes. The graphical model of SHT model is shown in Fig. 2.
In Fig. 2, plates represent replications, shaded circles represent observed variables, and unshaded circles represent hidden variables. The outer plate represents clinical cases, while the inner plates represents the repeated choice of topics (syndromes) and words (symptoms and herbs) within a clinical case. h i and h j are herbs, s denotes symptoms. z s denotes the topic assigned for symptoms, z h denotes the topic assigned for herbs. D is the number of clinical cases, K and L represent the topic number of symptoms and herbs, M and N represent the number of unique herbs and unique symptoms. γ is the prior parameter for variable x i . Dirichlet priors α and β are set over the clinical case and topic distributions, respectively. SHT generates a collection of clinical cases by the process below:  pair (h p , h q ) from ϕ zh . According to the TCM theory, the topic number for symptoms K should be numerically equal to the topic number for herbs L. We set K = L during the generative process. In step (iii), we construct distributions of herbs per topic analogously to the construction of the symptoms distributions per topic.

Learning SHT Parameters
We employs Gibbs sampling for learning the parameters [15]. The Gibbs sampling procedure considers each symptom or each herb in the clinical case in turn, and estimates the probability of assigning the current symptom or herb to each topic, conditioned on the topic assignments to all other "words." For all symptoms in each clinical case, we use the assignment of z s for term s based on p(z s |s). Similarly, assign the topic z h for term h i based on p(z h |h i ). The approximately computation of p(z s |s) is described in Eq. (1). We use p(z s = k|z −s , s, −s) to simulate p(z s |s), which estimates the probability of assigning the current symptom to each topic (p(z s = k)), conditioned on the topic assignment to all other symptoms (z −s ), not including the current symptom (−s). During Gibbs sampling, we draw the topic assignment z s and z hi according to Eq. (1) and Eq. (2).
where z s = k means assigning current symptom s to topic (syndrome) k, z −s denotes the topic assignments for all symptoms except symptom s. The meanings of n k,−s s , n k,−s • , n ci k,−s and n ci •,−s refer to the corresponding components in Table 1, but not including the current assignment instance s (represented by the token −s). If x i = 0: If x i = 1, h i and h j are regarded as a whole. We assign the topic for the unit h i , h j . After Gibbs Sampling iterations, we estimate the syndrome-herb distribution ϕ, the syndrome-symptom distribution δ and the document-syndrome distribution θ as follows:

Setup
We collect 3,765 clinical cases from Professional Knowledge Service System for Chinese Herbal Medicine * 1 . The symptoms and the herbs should be extracted by text matching according to Traditional Chinese Medical Subject Headings (TCM Mesh) [12] and Chinese pharmacopoeia (2,000 edition).
We designed three experiments to validate our method: LDA-based method, LinkLDA-based method [9] and SHT-based method. LinkLDA can simultaneously model the content of documents and citations in previous work [9]. We employed it to extract the latent topic structures which involve the symptoms and their corresponding herbs. To evaluate the performance of our topic model, we used two metrics: the perplexity and the accuracy of top 5 "words" discovered for latent topics. The former can be thought of as the effective number of equally likely words (symptoms or herbs) according to the model. It is a common way to evaluate the effectiveness of topic models on topic modeling. We computed the perplexity of the test sets with parameters learned from the corresponding training sets. Let C be the set of clinical cases, the definition of perplexity is defined as follows: where C test is the test data set, w i is a vector of "words" in clinical case c i of the test set, and C train is the training set. N i denotes the total number of symptoms and herbs in clinical case c i . p(w i |C train ) denotes the probability of the words w i in a test clinical case c i under the parameters trained by training set. Note that lower numbers denote better performance. The latter evaluation can be computed as follows: Accuracy = The correct number of returned "words" The total number of returned "words" The correct number of returned "words" (symptoms and herbs) is determined by expert's manual judgement. For each syndrome (topic), if a symptom can reflect the syndrome and a herb has therapeutic effects on the syndrome, then the "word" is correct. We randomly selected 20% clinical cases as the test set. In topic modeling process, we set the hyper-parameters for both two models as follows: α = 50/K, β = 0.1, and the iteration number l = 100.

Overall Performance and Discussions
In ancient TCM books, 917 paired herbs have been discovered by TCM experts * 2 . The data set of paired herbs was incorporated into the SHT topic modeling process. We conducted treatment pattern mining through LDA, LinkLDA and SHT model, and calculated perplexity on different number of topics, which vary from   10 to 100. Table 2 shows the probability distributions of 5 discovered topics in SHT model.
In Table 2, top 5 symptoms and top 5 herbs are returned for each topic. For example, several symptoms are returned in the topic "Dyspnea with cough," such as "cough," "excessive phlegm," "deep and adynamic pulse," "thick yellow sputum" and "upward adverseness of gas to the chest." These "words" are typical symptoms in the syndrome of "Dyspnea with cough." The efficiency of the corresponding 5 herbs is relieving cough. These results show that the treatment patterns between symptoms and herbs can be discovered by our model.
Meanwhile, a pair of herbs tend to indicate more intensive relations with the corresponding topics than a single herb, such as "Caulis Perllae" and "Platycodonis Radix" in topic 1, "Saposhnikoviae Radix" and "Schizonepetae Herba" in topic 5. Therapeutic effects can be promoted by the coordination of two herbs. The results are valuable for TCM practitioners to conduct automatic diagnosis research and new prescription discovery. However, LDA cannot discover combinations of effective interacting herbs.   and herbs can improve the topic structure. If symptoms and herbs are regarded as a whole, the probability distribution for symptoms and herbs will be mixed together. SHT performs better than LinkLDA when K ≤ 60, which means that concerning combinational rules can improve the modeling performance. However, the performance of SHT is close to LinkLDA when K > 60, this is possibly because the larger number of topics would decrease the number of paired herbs. Figure 4 shows the accuracy of discovered "words." The accuracy has to be calculated manually by expert's instruction, thus we set the topic number between 10 and 40 to alleviate the heavy workload for our task. Our results show that the SHT is more efficient at extracting symptom-herb relationship from the clinical case compared with the basic LDA model (increasing accuracy by 18%, 17%, 19% and 23% for different number of topics) and the LinkLDA (increasing precision by 5%, 12%, 1%, 2% for different number of topics).
However, some of our results can be improved upon, and our approach can be expanded upon in the future. Firstly, some other types of important TCM entities, such as prescriptions and diseases, are not incorporated into our model. If we can bring such entities into our unified model in the future, then more types of relations can be extracted. Secondly, most of the symptom names are manually extracted because there is not a standard or unified terminology glossary for TCM symptoms, so entity recognition techniques are needed to detect symptom entities in clinical cases.

Conclusions
This paper has presented a method of clinical records mining based on probabilistic topic model. We propose a novel topic model named SHT to discover the treatment patterns between symptoms and herbs. The combinational rules are incorporated into the SHT modeling process. Each discovered topic involves a list of symptoms and its corresponding list of herbs. The performance shows that our approach is superior to other topic models in extracting symptom-herb relations from TCM clinical cases.
The results can provide valuable information for TCM automatic diagnosis or poly-pharmacology research.
The dosage of herbs in a prescription plays a key role in clinical treatment. The efficiency of a composition of herbs would change when we adjust the dosage of herbs. In the future, we plan to incorporate the dosage information into the topic mod-eling process. Besides, we intend to use the mining results to construct a calculation model for automatic diagnosis. Specifically, when the doctor provides the symptoms of a patient, our model may automatically return the corresponding combination of herbs to cure the disease.