Paper: Sequential Condition Evolved Interaction Knowledge Graph for Traditional Chinese Medicine Recommendation (ICLR-2024)

Reviewer comment (Novelty):
The motivations of the paper need to be clarified. The differences between Traditional Chinese Medicine Recommendation and General Medicine Recommendation should be emphasized. The author may want to explain these differences. Besides, it seems that the proposed method can be adopted into any other medicine recommendation setting. The author may need to stress the motivations.

Author response:
1. **Motivation of the paper**

The main motivations behind our research are as shown below **(which were also addressed in the second paragraph of the introduction section):**
  
 **Lack of Sequence Data Research in Traditional Chinese Medicine (TCM):** We observed a scarcity of studies focusing on sequential data analysis in the TCM, especially when it comes to incorporating domain knowledge into herbal recommendations. Most existing TCM recommendation studies heavily rely on TCM public datasets, which are not sequential data. Furthermore, many TCM-based studies merely utilize the dataset itself without dynamically integrating domain knowledge. 
   
**Uniqueness and Specificity of Traditional Chinese Medicine (TCM):** Traditional Chinese medicine differs significantly from general Western medicine in terms of treatment methods and diagnostic processes (often presented by unstructured data, e.g., text). TCM emphasizes personalized and holistic approaches, often requiring intricate herbal combinations tailored to an individual's overall condition. In contrast, Western medicine leans more towards quantifiable metrics, such as laboratory test results. TCM relies on comprehensive patient evaluations through observation, olfaction, inquiry, and pulse diagnosis, which distinguishes it from general medicine. **While some recommendation methods may be applicable in other medical domains, our work is tailored specifically to the field of TCM, with domain knowledge that leans towards traditional Chinese medicine principles.**

   **In summary, our research is motivated by two key factors:**

   **Firstly, we have developed a model to effectively capture the state transitions of patients following herb treatments.** In traditional sequence data analysis, the focus primarily revolves around changes in a patient's condition between different diagnoses, often involving comparisons of metrics and data collected at these diagnoses. However, this approach may not adequately account for the effects of herb treatments, as it mainly relies on comparisons of diagnosis information. In contrast, our model provides a more comprehensive method for modeling state transitions following herb treatments. We consider changes in a patient's status over a time series, allowing us to observe the evolution of a patient's condition over an extended period, including the impact of herb treatments. This approach enhances our understanding of the efficacy of TCM by considering state transitions, ultimately improving the accuracy of herbal recommendations.

   **Secondly, we incorporate domain-specific knowledge from the traditional Chinese medicine into our model training process.** This knowledge integration is not limited to pre-trained information but involves a dynamic utilization of domain expertise. This fusion of knowledge provides our approach with a significant advantage in the field of traditional Chinese medicine. 
   
   Through these innovative methods, our aim is to provide more rational herbal recommendations within the domain of traditional Chinese medicine. **We will elaborate further on the innovation and advantages of our paper in the following respones.**

Reviewer comment (Novelty):
The novelty of the paper is limited. The progress of knowledge fusion is by introducing a regularization into the loss function, which is trivial in the literature. Besides, what is the motivation of the module TRANSITION CONDITION MODULE? Actually, modeling patients’ dynamics in drug recommendation has been already addressed. The author may need to discuss the difference.

Author response:
2. **Novelty of the Paper:**

We sincerely appreciate the reviewer's evaluation of our work. We would like to further elaborate on the innovations in our research. **The novelty of our work lies in the introduction of the Interaction Knowledge Graph (IKG), which integrates domain knowledge from TCM through an interactive knowledge graph and applies it to sequential herbal medicine recommendations.This approach, combined with our transition condition module, which explicitly models the evolution of patients' conditions, sets our work apart from existing drug recommendation systems that may not capture these dynamic aspects​​.**

   **Firstly: Incorporation of Domain Knowledge and Knowledge Graph Completion** We fully recognize that constructing a comprehensive knowledge graph for TCM is a great challenge that requires substantial data support. In our study, we employed knowledge graph completion to infer new facts from known facts, enriching the knowledge graph and providing more information for herbal medicine recommendations. Training the knowledge graph embeddings together with the network is distinct from traditional recommendation systems, which typically focus on modeling individual users and items. In our case, we need to consider symptom sets on one side and herb sets on the other, which vary in size and pose a unique challenge. This comprehensive approach allows us to more accurately represent and utilize domain-specific knowledge in the field of TCM. **Additionally, we conducted a supplementary Evaluation of IKG in Revision 4.2, at line 302 of the paper, where we experimented with various knowledge graph completion methods, and further confirmed the validity of our method by the results highlighted in orange in Table 3.**
   
   **Secondly: Modeling Based on Sequential Data and State Transitions** We deeply understand the significance of modeling patient state transitions after herbs in the TCM. In our research, we introduced latent state representations to capture changes in patient conditions after taking prescriptions. This process is crucial in real-life scenarios, as doctors typically recommend herbs based on a patient's past diagnosis history and current condition. Our approach involves predicting patient states post-herbs and leveraging the potential inference inthe state transition process. Even in cases where we lack comprehensive records of a patient's next diagnosis, our method allows us to predict a patient's conditional representation, enabling us to make reasonable herb recommendations. **This aspect, which has been less considered in prior research on sequence data-based medication recommendations, is pivotal for better recommendations**.

   The update process of SCEIKG resembles the concept of the EM algorithm.The updates to IKG will iteratively contribute to improving various modules depicted in Fig.2, and the model training within Fig.2 will reciprocally enhance IKG (on the right side of Fig.2). These two components collaborate and drive the entire iterative updating process.The incorporation of domain-specific knowledge into the loss function inthe TCM domain is not merely adding a regularization term but involves theutilization of knowledge graph completion during the update of IKG.
   
   In conclusion, our research comprehensively considers the fusion of domain knowledge and sequential data to enhance the accuracy of herbal recommendations. We would like to express our gratitude once again to thereviewer for their valuable suggestions and questions, which have stimulated deeper thinking and provided directions for further research.

Reviewer comment (Writing):
The structure of the paper needs to be improved. The method is called Sequential Condition Evolved Interaction Knowledge Graph Learning. However, there is no formal definition of what an Interaction Knowledge Graph (IKG) is. The author may want to declare it.

Author response:
3. **Definition of IKG and  Differences between IKG and Common KGs:**

**Definition of IKG:** We define IKG in the revised version of Section 2, Problem Formulation, on line 93 of the paper and further elaborated in Appendix A.1. In this paper, for clarity, we highlight in blue.  **We define an IKG by $\mathcal{G}=(\mathcal{E},\mathcal{R},\mathcal{T}, \mathcal{A})$, where $\mathcal{E}$ is a set of entities and $\mathcal{R}$ is a set of relations. $\mathcal{T}$ is a set of triples $\mathcal{T}=\{(h,r,t)|h \in \mathcal{E}, t\in \mathcal{E}, r\in \mathcal{R}\}$, where each triples means there is a relation $r$ from *head* entity $h$ to *tail* entity $t$. Specifically, $\mathcal{E}$ consists of symptoms $\boldsymbol{S}$, herbs $\boldsymbol{H}$, and other entities such as pharmacology, efficacy, diseases, examination and diagnosis, which were extracted from TCM datasets to help entail relations between symptoms and herbs directly or indirectly.**

 **The differences between KG (Knowledge Graph) and IKG (Interaction Knowledge Graph) are as follows:**
   
**Data Source:** KG is initially constructed based on data from multiple sources, while IKG is an enhanced version built on top of it. KG may not include all the symptoms and herbal entities from the dataset, as it is constructed from multiple sources and may have missing elements. To ensure the quality and completeness of the knowledge graph, additional measures are taken for KG. These measures include adding symptoms and herbal entities present in the dataset and constructing corresponding triplets to fill potential gaps.
   **Triplets:** In the construction of IKG, we employed the Normalized Pointwise Mutual Information to enhance the knowledge graph, improving its connectivity.
 
In summary, IKG is an enhanced and optimized knowledge graph built upon KG to improve its quality, completeness, and semantic relationships. It includes more entities and relationships to better support applications and research in the field of Traditional Chinese Medicine.

Reviewer comment (Experiments):
For experiments, the method is only conducted on one dataset. Evaluations on more datasets should be conducted. The proposed method seems to be a general framework for drug recommendation. Therefore, the author may need to show the results on common datasets.

Author response:
5. **Distinction Between TCM and General Medicine Recommendation and Experiments on a Single Dataset**

**We appreciate the reviewer's feedback, and we have incorporated their suggestions into the revised version in section of Conclusion, highlighted in blue.** 

   Traditional Chinese medicine (TCM) and general medicine exhibit differences in drug recommendation, primarily stemming from two aspects: **data sources and treatment philosophies.** Traditional TCM practitioners typically diagnose diseases using methods such as observation, listening, questioning, and pulse-taking, emphasizing the patient's overall condition and symptoms. They rely on the patient's **subjective feelings and the experience of the physician for diagnosis and treatment**. In contrast, general medicine often relies on **modern medical instruments and clinical examinations to diagnose diseases, leaning towards the collection of objective data.** This results in differences in data, with TCM data being more subjective.

   **Another significant difference lies in the nature of the drugs.** Western medicine typically has well-defined molecular structures and chemical compositions, whereas herbal medicines consist of parts of natural plants, making their compositions more complex and less easily describable using molecular structures. This complexity necessitates the consideration of different factors in herbal medicine recommendation, such as the efficacy of Chinese herbs, the source of medicinal herbs, and their processing methods. Therefore, there is a fundamental difference between TCM and Western medicine in drug recommendation.

   Due to the unique nature of TCM, it significantly differs from general medicine in terms of diagnostic and treatment methods. While our method may have potential applications in other forms of medicine, its design is particularly well-suited for TCM recommendations, given its focus on domain-specific knowledge rooted in TCM principles.

**Single Dataset Issue:**

   When applying this method to different types of task datasets, such as Western medicine drug recommendations, it is essential to consider the unique characteristics and domain knowledge associated with each dataset. The field of healthcare is extensive and complex, encompassing various disciplines and specialized knowledge. Therefore, significant differences exist between various tasks, including data requirements, evaluation criteria, and real-world application contexts.

   It is crucial to emphasize that there are significant differences in medical philosophies and treatment approaches between Traditional Chinese Medicine (TCM) and Western medicine. These distinctions introduce certain limitations in the domain of drug recommendations. Previous studies, such as SafeDrug and GAMNet, have conducted drug recommendation research based on Western medicine datasets. However, the molecular chemical structure information used in these studies is not applicable to herbal medicine recommendations. This underscores the limitations in the scope of applicability of these methods.

   When attempting to extend this method to other medical datasets, careful consideration of the differences in data characteristics is essential to ensure that the recommendations align with clinical needs effectively. For publicly available datasets like TCM, which do not necessarily represent sequential data, they may not align with the specific objectives of our research. **However, in future studies, we can explore approaches such as data preprocessing and transfer learning to address these challenges. By flexibly selecting and extracting features, leveraging information from various types of data, and incorporating knowledge accumulated by pre-trained models in relevant domains, we can transfer this knowledge to target tasks. This not only helps broaden the applicability of the method across different domains but also represents a significant direction for our future research.**

   We recognize that while our method shows potential in the TCM, its extension to more diverse and wide-ranging datasets requires further in-depth research and experimentation. Exploring the adaptability of the model remains a challenging task for our research and merits deeper consideration in the future. 
   
   We would like to express our gratitude once again to the reviewer for their questions, which provide directions for further thinking and exploration.

Reviewer comment (Writing):
What is IKG? Is there any difference between common KGs and IKGs?

Author response:
3. **Definition of IKG and  Differences between IKG and Common KGs:**

**Definition of IKG:** We define IKG in the revised version of Section 2, Problem Formulation, on line 93 of the paper and further elaborated in Appendix A.1. In this paper, for clarity, we highlight in blue.  **We define an IKG by $\mathcal{G}=(\mathcal{E},\mathcal{R},\mathcal{T}, \mathcal{A})$, where $\mathcal{E}$ is a set of entities and $\mathcal{R}$ is a set of relations. $\mathcal{T}$ is a set of triples $\mathcal{T}=\{(h,r,t)|h \in \mathcal{E}, t\in \mathcal{E}, r\in \mathcal{R}\}$, where each triples means there is a relation $r$ from *head* entity $h$ to *tail* entity $t$. Specifically, $\mathcal{E}$ consists of symptoms $\boldsymbol{S}$, herbs $\boldsymbol{H}$, and other entities such as pharmacology, efficacy, diseases, examination and diagnosis, which were extracted from TCM datasets to help entail relations between symptoms and herbs directly or indirectly.**

 **The differences between KG (Knowledge Graph) and IKG (Interaction Knowledge Graph) are as follows:**
   
**Data Source:** KG is initially constructed based on data from multiple sources, while IKG is an enhanced version built on top of it. KG may not include all the symptoms and herbal entities from the dataset, as it is constructed from multiple sources and may have missing elements. To ensure the quality and completeness of the knowledge graph, additional measures are taken for KG. These measures include adding symptoms and herbal entities present in the dataset and constructing corresponding triplets to fill potential gaps.
   **Triplets:** In the construction of IKG, we employed the Normalized Pointwise Mutual Information to enhance the knowledge graph, improving its connectivity.
 
In summary, IKG is an enhanced and optimized knowledge graph built upon KG to improve its quality, completeness, and semantic relationships. It includes more entities and relationships to better support applications and research in the field of Traditional Chinese Medicine.

Reviewer comment (Novelty):
What is the difference between Traditional Medicine Recommendation and general medicine recommendation? It seems that the proposed method can be used in general medicine recommendation setting. The author may need to point out the differences.

Author response:
5. **Distinction Between TCM and General Medicine Recommendation and Experiments on a Single Dataset**

**We appreciate the reviewer's feedback, and we have incorporated their suggestions into the revised version in section of Conclusion, highlighted in blue.** 

   Traditional Chinese medicine (TCM) and general medicine exhibit differences in drug recommendation, primarily stemming from two aspects: **data sources and treatment philosophies.** Traditional TCM practitioners typically diagnose diseases using methods such as observation, listening, questioning, and pulse-taking, emphasizing the patient's overall condition and symptoms. They rely on the patient's **subjective feelings and the experience of the physician for diagnosis and treatment**. In contrast, general medicine often relies on **modern medical instruments and clinical examinations to diagnose diseases, leaning towards the collection of objective data.** This results in differences in data, with TCM data being more subjective.

   **Another significant difference lies in the nature of the drugs.** Western medicine typically has well-defined molecular structures and chemical compositions, whereas herbal medicines consist of parts of natural plants, making their compositions more complex and less easily describable using molecular structures. This complexity necessitates the consideration of different factors in herbal medicine recommendation, such as the efficacy of Chinese herbs, the source of medicinal herbs, and their processing methods. Therefore, there is a fundamental difference between TCM and Western medicine in drug recommendation.

   Due to the unique nature of TCM, it significantly differs from general medicine in terms of diagnostic and treatment methods. While our method may have potential applications in other forms of medicine, its design is particularly well-suited for TCM recommendations, given its focus on domain-specific knowledge rooted in TCM principles.

**Single Dataset Issue:**

   When applying this method to different types of task datasets, such as Western medicine drug recommendations, it is essential to consider the unique characteristics and domain knowledge associated with each dataset. The field of healthcare is extensive and complex, encompassing various disciplines and specialized knowledge. Therefore, significant differences exist between various tasks, including data requirements, evaluation criteria, and real-world application contexts.

   It is crucial to emphasize that there are significant differences in medical philosophies and treatment approaches between Traditional Chinese Medicine (TCM) and Western medicine. These distinctions introduce certain limitations in the domain of drug recommendations. Previous studies, such as SafeDrug and GAMNet, have conducted drug recommendation research based on Western medicine datasets. However, the molecular chemical structure information used in these studies is not applicable to herbal medicine recommendations. This underscores the limitations in the scope of applicability of these methods.

   When attempting to extend this method to other medical datasets, careful consideration of the differences in data characteristics is essential to ensure that the recommendations align with clinical needs effectively. For publicly available datasets like TCM, which do not necessarily represent sequential data, they may not align with the specific objectives of our research. **However, in future studies, we can explore approaches such as data preprocessing and transfer learning to address these challenges. By flexibly selecting and extracting features, leveraging information from various types of data, and incorporating knowledge accumulated by pre-trained models in relevant domains, we can transfer this knowledge to target tasks. This not only helps broaden the applicability of the method across different domains but also represents a significant direction for our future research.**

   We recognize that while our method shows potential in the TCM, its extension to more diverse and wide-ranging datasets requires further in-depth research and experimentation. Exploring the adaptability of the model remains a challenging task for our research and merits deeper consideration in the future. 
   
   We would like to express our gratitude once again to the reviewer for their questions, which provide directions for further thinking and exploration.

Reviewer comment (Novelty):
The long term effect of the items being recommended on the user has been studied under quite a few subarea in the recommender system. Reinforcement learning (e.g., Interactive collaborative filtering), Counterfactual Reasoning (e.g., Unbiased learning-to-rank with biased feedback), as well as Evolving user profiles (e.g., Dynamic Poisson factorization) are some examples. Taking into long term effect is one of the main contribution claimed in the paper, yet the proposed module is not well positioned.

Author response:
**The reviewer's question regarding the long-term effects and the mention of various methods used in the recommender system field to consider long-term effects are greatly appreciated. We acknowledge the importance of these methods in modeling long-term effects in traditional recommender systems and their wide applicability across different domains and applications.**

   However, it is essential to emphasize that TCM has unique characteristics in treatment methods and patient states. Therefore, specialized approaches are required to address long-term effects within this context. In our research, we are dedicated to addressing specific issues in the TCM recommendation domain. Consequently, our approach places particular emphasis on considering the long-term effects of herbs and the evolution of patient states.

   We would like to clarify that our method is specifically designed for the TCM domain, and thus, it has different backgrounds and objectives when it comes to modeling long-term effects. In TCM treatment, the efficacy of herbal medicine often takes time to manifest and can be influenced by the overall condition of the patient as well as dynamic adjustments during treatment. Therefore, our method introduces the **Transition condition module** to dynamically capture changes in a patient's state between multiple diagnoses, allowing for more accurate herbal medicine recommendations. This module's design and application enable our model to consider the long-term effects on patients by dynamically integrating the patient's historical diagnosis information and current symptoms, resulting in more precise TCM recommendations. **Transition condition module, as stated in section 3.3 of the revised version, in line 203 of the paper, needs to be comprehensively understood in conjunction with the Horizontal Patient Representation.** We combine these two components to provide a detailed explanation of the impact of this module on long-term effects.** In Eq.(4), 
$\Phi^{(t)}_P = \boldsymbol{LSTM} \left( \left(  \Pi \left(h_S^{(t)},\Psi^{(t-1)}\right) ,C^{(t-1)} \right),...,\left( \Pi \left(h_S^{(0)},h_C^{(0)}\right) ,C^{(0)}\right); \; W_6\right)$

 We employ LSTM for sequential prediction, where $\Phi^{(t)}$ denotes the comprehensive patient state during the $t$-th diagnosis. This state includes the patient's historical condition representation $h_C$, symptoms representation $h_S$, and the transitional state $\Phi^{(t-1)}$, derived dynamically through the state transition function 

$ \boldsymbol{T} \left(\Phi^{(t)}_P,\boldsymbol{P}\left(\Phi^{(t)}_P, E_h\right)\right) $

$= \boldsymbol{NN_4} \left(Concatenate\left({\Phi_{P}^{(t)},(\Phi_{P}^{(t)}\odot  h_{H}^{(t)}),h_{H}^{(t)}}\right);\; W_8\right)$. 

**To offer a more intuitive illustration,** consider a scenario involving three diagnoses. During the first diagnosis, leveraging the patient's current condition representation $h_C^{(1)}$ and symptoms representation $h_S^{(1)}$, we compute the comprehensive patient state $Φ^{(1)}$, upon which the initial herbal recommendation is based. In subsequent diagnoses, the previous hidden state $C^{(1)}$ (retaining the first diagnosis's state information) and the transitional state $Ψ^{(1)}=T(Φ^{(1)}, hc^{(1)})$  are integrated through the transition function $T$, alongside the symptoms representation $h_S^{(2)}$ of the second diagnosis, to derive the second comprehensive patient state $Φ^{(2)}$. Importantly, the second comprehensive patient state $Φ^{(2)}$ contains information from the first diagnosis, facilitating dynamic herbal recommendations. This incorporation enriches the patient's inherent state information, amalgamating the current and preceding diagnosis states, along with the transitional state after herbs. Consequently, this augmentation enhances model performance, facilitating improved herbal recommendations.

   Also, the concept of the patient state encapsulates a holistic representation of the patient's well-being, thereby affording a deeper understanding of their condition. **For instance,** a patient's description of "recent severe insomnia accompanied by mild headaches" may not be fully comprehended based solely on symptom representation. Our model predicts the transitional state to address the dynamic nature of herbal effects, considering patient-specific variations and herb interactions. This underpins our rationale for incorporating the transitional state even in cases where the patient's subsequent diagnosis patient state is unavailable, reaffirming our model's robustness in herbal recommendation.

**In the ablation experiments section of Section 4.2 of the revised version, in line 309 of the paper.** We conducted ablation experiments pertaining to this module. As depicted in Fig.3, the performance of both variants lags behind that of SCEIKG, further validating the substantial contribution of this module.

Thank you to the reviewers for their comments.

Reviewer comment (Experiments):
Drug-Drug interaction is one of the major factor to be considered when performing drug recommendation (e.g, Wu et al., Conditional generation net for medication recommendation) in order to avoid harmful effects. The proposed approach does not take this information into consideration. As also show in the case study, the proposed approach recommended quite a few herbs that does not matches doctors prescription, considering Drug-Drug interaction would be crucial for risk minimization.

Author response:
**Reviewers have rightly pointed out the importance of considering drug-drug interactions (DDIs) in medication recommendation systems.** While SCEIKG does not currently model DDIs explicitly, it implicitly addresses the issue of herb compatibility through an iterative interaction knowledge graph, which includes relationships between different herbs. The graph helps avoid recommending mutually exclusive herbs.**In addition, we have reflected on the results of herb interactions by analyzing real doctors. We will provide you with further analyses.**

In the motivation section of our paper, we highlight a significant and perplexing issue in TCM, which is the compatibility of herbal medicines, specifically, the interactions between different herbs when combined. However, the TCM treatment process encompasses a vast amount of complex TCM knowledge and involves four steps, making it challenging to elucidate the intricate interactions between different herbs. **To address this issue, we propose an approach based on domain knowledge from a knowledge graph to ensure herbal compatibility. Nevertheless, it's important to note that due to the complexity of TCM and the lack of standardization, accurately determining interactions between herbs can be challenging. For instance, herbs A and B may have antagonistic effects, but they might reach equilibrium when combined with herb C.** These interaction criteria are highly intricate, and herb compatibility is not fixed. Therefore, to enhance the accuracy of herbal recommendations, we constrain TCM recommendations based on domain knowledge from traditional Chinese medicine. Specifically, we introduce a regularization scheme
 $\boldsymbol{R}$
$=-\sum_{i=1}^{N}\sum_{j=1}^{N}W_{ij}^{h}\hat{hc}^{(t)}_i \hat{hc}^{(t)}_j$ to penalize $P^{(t)}$, limiting violations of herb pairs. The $W^{I}$ derived $W{i,j}^{h}$
weights from $\mathcal{G}^{I}$ represent the strength of compatibility between the i-th and j-th herbs. If they are mutually antagonistic, $W{i,j}^{h}=0$.
      
**We demonstrate that we reduce the risk of herbal incompatibility by both**

First, in the Herb Compatibility section of Appendix E of this paper, on line 679 of the paper, we conduct a detailed result analysis. Due to data privacy and confidentiality, we present partial correlations between herb pairs in the appendix, which dynamically change during model training. According to real doctors' analysis, these changes are reasonable as they adapt to the patient's current condition.  **The reviewer suggests that the recommended results of our proposed method rarely agree with those recommended by real doctors, but we have analyzed them by real doctors and the remedies we recommend are also appropriate for the current patient's condition. In Table 8**, we showcase the results of herbal recommendations. Although there are differences between the herbs we recommend during the first diagnosis and those prescribed by doctors, **real doctors' analysis indicates that the model-recommended prescription is better suited to the patient's current condition. During the second diagnosis, although there are differences between the herbal recommendations and the actual prescription, doctors point out that the gap between them is not significant, and there are no mutually antagonistic herbs.** This further validates the effectiveness of considering herb compatibility and emphasizes that herb compatibility is a complex and dynamic issue.

**Secondly, the experimental analyses were added to 4.2 in our revised version, in line 263 of the paper, highlighted in red. Fig. 4 illustrates the heatmap for all herb pairs; herb names are omitted due to data privacy. From the heatmap, we observe that the magnified positions, specifically (Cassia Bark(肉桂)), Red Halloysite(赤石脂)), and (Danshen Root(丹参), Lightyellow Sophora Root(苦参)), both exhibit a correlation of 0. The correlation between "Cassia Bark(肉桂)" and "Red Halloysite(赤石脂)" is 0, indicating a certain degree of mutual antagonism between these two herbs. This aligns with the ancient literature's viewpoint that "Cassia Bark is effective in regulating cold energy, but it loses its efficacy when encountered with Red Halloysite(官桂善能调冷气，若逢石脂便相欺)." In other words, Cinnamon and Red Halloysite are mutually repellent. Additionally, "Danshen Root(丹参)" and "Lightyellow Sophora Root(苦参)" cannot be mixed in some situations due to their differing medicinal properties.** Nevertheless, real doctors also point out that some herb combinations may be controversial as they may have different effects in clinical practice. We acknowledge that we have not yet fully addressed the issue of herb interactions, but we have selected **70** recommended results for real doctors to analyze, and after real doctors' analysis, we have achieved a **91.4%** level of compatibility for our recommended herb pairings, which, in terms of our recommended results, demonstrates the validity of our method.

Reviewer comment (Evaluation):
How does the proposed approach mitigate the risk that would caused by harmful drug-drug interactions?

Author response:
**Reviewers have rightly pointed out the importance of considering drug-drug interactions (DDIs) in medication recommendation systems.** While SCEIKG does not currently model DDIs explicitly, it implicitly addresses the issue of herb compatibility through an iterative interaction knowledge graph, which includes relationships between different herbs. The graph helps avoid recommending mutually exclusive herbs.**In addition, we have reflected on the results of herb interactions by analyzing real doctors. We will provide you with further analyses.**

In the motivation section of our paper, we highlight a significant and perplexing issue in TCM, which is the compatibility of herbal medicines, specifically, the interactions between different herbs when combined. However, the TCM treatment process encompasses a vast amount of complex TCM knowledge and involves four steps, making it challenging to elucidate the intricate interactions between different herbs. **To address this issue, we propose an approach based on domain knowledge from a knowledge graph to ensure herbal compatibility. Nevertheless, it's important to note that due to the complexity of TCM and the lack of standardization, accurately determining interactions between herbs can be challenging. For instance, herbs A and B may have antagonistic effects, but they might reach equilibrium when combined with herb C.** These interaction criteria are highly intricate, and herb compatibility is not fixed. Therefore, to enhance the accuracy of herbal recommendations, we constrain TCM recommendations based on domain knowledge from traditional Chinese medicine. Specifically, we introduce a regularization scheme
 $\boldsymbol{R}$
$=-\sum_{i=1}^{N}\sum_{j=1}^{N}W_{ij}^{h}\hat{hc}^{(t)}_i \hat{hc}^{(t)}_j$ to penalize $P^{(t)}$, limiting violations of herb pairs. The $W^{I}$ derived $W{i,j}^{h}$
weights from $\mathcal{G}^{I}$ represent the strength of compatibility between the i-th and j-th herbs. If they are mutually antagonistic, $W{i,j}^{h}=0$.
      
**We demonstrate that we reduce the risk of herbal incompatibility by both**

First, in the Herb Compatibility section of Appendix E of this paper, on line 679 of the paper, we conduct a detailed result analysis. Due to data privacy and confidentiality, we present partial correlations between herb pairs in the appendix, which dynamically change during model training. According to real doctors' analysis, these changes are reasonable as they adapt to the patient's current condition.  **The reviewer suggests that the recommended results of our proposed method rarely agree with those recommended by real doctors, but we have analyzed them by real doctors and the remedies we recommend are also appropriate for the current patient's condition. In Table 8**, we showcase the results of herbal recommendations. Although there are differences between the herbs we recommend during the first diagnosis and those prescribed by doctors, **real doctors' analysis indicates that the model-recommended prescription is better suited to the patient's current condition. During the second diagnosis, although there are differences between the herbal recommendations and the actual prescription, doctors point out that the gap between them is not significant, and there are no mutually antagonistic herbs.** This further validates the effectiveness of considering herb compatibility and emphasizes that herb compatibility is a complex and dynamic issue.

**Secondly, the experimental analyses were added to 4.2 in our revised version, in line 263 of the paper, highlighted in red. Fig. 4 illustrates the heatmap for all herb pairs; herb names are omitted due to data privacy. From the heatmap, we observe that the magnified positions, specifically (Cassia Bark(肉桂)), Red Halloysite(赤石脂)), and (Danshen Root(丹参), Lightyellow Sophora Root(苦参)), both exhibit a correlation of 0. The correlation between "Cassia Bark(肉桂)" and "Red Halloysite(赤石脂)" is 0, indicating a certain degree of mutual antagonism between these two herbs. This aligns with the ancient literature's viewpoint that "Cassia Bark is effective in regulating cold energy, but it loses its efficacy when encountered with Red Halloysite(官桂善能调冷气，若逢石脂便相欺)." In other words, Cinnamon and Red Halloysite are mutually repellent. Additionally, "Danshen Root(丹参)" and "Lightyellow Sophora Root(苦参)" cannot be mixed in some situations due to their differing medicinal properties.** Nevertheless, real doctors also point out that some herb combinations may be controversial as they may have different effects in clinical practice. We acknowledge that we have not yet fully addressed the issue of herb interactions, but we have selected **70** recommended results for real doctors to analyze, and after real doctors' analysis, we have achieved a **91.4%** level of compatibility for our recommended herb pairings, which, in terms of our recommended results, demonstrates the validity of our method.

Reviewer comment (Experiments):
The dataset for experiment is rather small.

Author response:
Regarding the reviewer's concern about the small size of the experimental dataset, we would like to address the issue from the following three aspects. 

**Firstly,** we acknowledge that the dataset utilized in this paper is relatively small. Due to the subdivision of traditional Chinese medicine (TCM) and concerns related to patient privacy, the scale of TCM datasets is indeed constrained. However, the TCM sequence dataset we utilized is extremely valuable, accumulated over a decade from the Guangdong Provincial Hospital of Chinese Medicine, one of China's top hospitals. It encompasses patient information from various regions of China, not limited to Guangdong Province. Additionally, publicly available datasets for TCM recommendations, such as TCM, typically only include information on symptoms and herbs, making them relatively limited for research on TCM sequence recommendations. Therefore, despite the small dataset size, these data hold significant value in the context of TCM research and provide ample diversity for validating the SCEIKG model. Furthermore, we plan to gradually expand the dataset size while ensuring patient privacy and data quality as more data becomes available.

**Secondly,** despite the small size of our dataset, during model training, we not only utilized the ZzzTCM dataset but also trained on the IKG. The knowledge graph we constructed contains 4,308,799 triplets, involving 344,092 entities and 35 types of edge relationships. Both the TCM dataset and the ZzzTCM dataset were incorporated into the construction of the IKG. **Detailed descriptions of the IKG are provided in Appendix A.1, and Appendix Table 4 outlines the data information,** indicating the relative richness of our data resources. 

**Finally,** we conducted additional experiments where we partitioned the ZzzTCM training data at different ratios to assess the robustness of our model in situations with a relatively small dataset. The results are presented in the table below,

| TrainingDataset | Precision@5 | Precision@10 | Precision@20 | Recall@5 | Recall@10 | Recall@20 | F1@5 | F1@10 | F1@20 |
|------------------|-------------|--------------|--------------|----------|-----------|-----------|------|-------|-------|
| 0.2Train         | 0.4813      | 0.3919       | 0.2809       | 0.2454   | 0.3913    | 0.5514    | 0.3164 | 0.3803 | 0.3627 |
| 0.4Train         | 0.4648      | 0.3847       | 0.2912       | 0.2352   | 0.3864    | 0.5722    | 0.3041 | 0.3741 | 0.3758 |
| 0.6Train         | 0.4933      | 0.3960       | 0.2951       | 0.2571   | 0.4088    | 0.5933    | 0.3287 | 0.3901 | 0.3835 |
| 0.8Train         | 0.4959      | 0.4025       | 0.2879       | 0.2551   | 0.4089    | 0.5733    | 0.3264 | 0.3931 | 0.3721 |
| 0.9Train         | 0.5084      | 0.4206       | 0.3040       | 0.2470   | 0.4021    | 0.5718    | 0.3235 | 0.3994 | 0.3867 |
| 0.94Train        | 0.5477      | 0.4275       | 0.3087       | 0.2727   | 0.4243    | 0.6010    | 0.3538 | 0.4128 | 0.3973 |
| 0.98Train        | 0.6000      | 0.4579       | 0.3066       | 0.3059   | 0.4613    | 0.6151    | 0.3932 | 0.4465 | 0.3987 |

From these results, it is evident that with an increase in the training set, the evaluation metrics show an upward trend to some extent. This indicates that the dataset size is not the sole determining factor for the model's performance. **We added this experiment to the Appendix C Parameter Sensitivity section of the revised version, at line 607 of the paper, and drew the trend of the results, displayed in Figures 6, 7, and 8 of the paper, and highlighted in red. See the revised version for details.**

Once again, we appreciate your review and valuable feedback. We remain committed to making continuous improvements and refining our research.

Reviewer comment (Presentation):
The presentation of method can be refined to make it easier to be understood.

Author response:
We appreciate this feedback and will revise the manuscript to improve clarity and ease of understanding. We will provide more detailed explanations and simplify the terminology to make the approach more accessible to a wider audience. We have updated this section to take into account **Q1 and Q2** as commented by the reviewer, and the font size of the images has been changed, and we have highlighted in red in the revised version. **Furthermore, to facilitate a better understanding of our method, we would like to provide a further summary of our approach.**

   Our model update process is similar to the concept of the EM algorithm. The updating of Interaction Knowledge Graph (IKG) is iteratively used to enhance various modules in Fig.2, and, in turn, the training of the model in Fig.2 improves IKG (on the right side of Fig.2). These two components collaborate, driving the entire iterative update process.**In our Appendix B, Algorithm 1 outlines the algorithm's process in detail.** Based on this, we will further explain the training process of the model within a single iteration.

   Constructing a complete knowledge graph in TCM is a highly complex task that requires substantial data support. Therefore, knowledge graph completion from existing facts is crucial to make the knowledge graph more comprehensive and enrich entity information. Thus, in the first stage of **Algorithm 1 (Phase I: Interaction Knowledge Graph Completion),** we perform entity representation learning using **Eq. (3)** in the paper, where $f(h, r, t) = C * ||Sin(W_re_h + e_r - W_re_t)||_1$. Subsequently, we update it backward using the loss function **$L_{IKG}$ in Eq. (6)** to complete and enrich entity information.

   In traditional knowledge graph embedding methods, typically only single knowledge triplets can be effectively represented, failing to capture higher-order similarities among entities. However, these higher-order relationships are critical for understanding complex interactions between entities, especially in the field of herbal medicine. For instance, ginger may treat both insomnia and cold symptoms, a multi-faceted relationship that cannot be accurately represented by a single triplet. To better aggregate symptom information and improve the quality of herb recommendations, we introduce the second stage of the algorithm. Building upon the first stage, we proceed to the second stage of **Algorithm 1 (Phase II: Recommended herbs based on sequential visits for each patient).**

   In the 3.1 Section, we elaborate on how we employ a Graph Neural Network (GNN) approach to apply the entity knowledge representations obtained in the first stage to the second-stage herb recommendation. **In this process, we utilize an adjacency matrix constructed using the normalized pointwise mutual information method defined in Eq. (1) while incorporating the entity knowledge representations learned in the first stage. We then aggregate high-order relationships and high-order entity similarity information using Eq. (2):  $E^{(k)} = SUM(NN_1((E^{(k-1)}+W^{I}E^{(k-1)}W_1^{(k)}); W_3^{(k)}), NN_2((E^{(k-1)} ⊙ W^{I}E^{(k-1)}W_2^{(k)}); W_4^{(k)}))$.**  Finally, we propagate backward through the **loss function in Eq.(6)**, which includes the mean squared error **loss $L_{mse}$** to measure the distance between the recommended herb set and the actual herb set, the state **loss $L_{state}$** to assess the similarity between herb recommendations before and after, **and the regularization $\boldsymbol{R}$ to constrain the relationships between herbs.** Through iterative gradient descent, we optimize the model parameters to minimize the overall loss function, achieving the optimization goal of our model.

   In summary, throughout the entire iterative process of the algorithm, we first learn entity representations for IKG, and then apply these representations to the second-stage herb recommendation model, as seen in the middle module of Fig.2. These two stages iteratively update each other, ultimately completing the training of the entire model. This process can be viewed as dynamic knowledge graph completion and herbal recommendation optimization. We thank the reviewers for their questions, which prompted us to delve deeper into the internal mechanisms and implementation details of the model.

Reviewer comment (Evaluation):
It’s not clear how the KG is completed and whether the predicted edges are reasonable. The effectiveness of incorporating IKG also needs to be clarified.

Author response:
We describe the KG **in Appendix A.1 at the line 444 of the paper, Interaction Knowledge Graph**. Let us once again introduce the process of building the knowledge graph (KG). It primarily consists of two main stages. Firstly, we employ web scraping techniques using Python and other tools to dynamically fetch data from websites relevant to the domain. The relevant URLs are provided in Appendix Table 4. Subsequently, we systematically clean and organize this data. The second step involves applying manually designed rules to extract relevant triple knowledge from the web data. **For instance, we can transform information like "Chrysanthemum has the effect of promoting qi circulation and relieving pain, and can treat wind-heat cold" into representations of Traditional Chinese Medicine (TCM) knowledge, such as (Chrysanthemum, Medicinal Properties, Wind-Heat Cold) and (Chrysanthemum, Medicinal Functions, Promoting Qi Circulation and Relieving Pain). Through these steps, we construct the initial knowledge graph (KG).**

   However, the initial KG may not encompass all the symptom and herbal entities present in the dataset.**To ensure the quality and comprehensiveness of the KG, we take further measures. We add the symptom and herbal entities mentioned in the dataset to the initial knowledge graph and build corresponding triples based on the dataset's content. For instance, (Symptom, Symptom-related Symptom, Symptom), (Symptom, Symptom-related Herbal, Herbal), and (Herbal, Herbal-related Herbal, Herbal) triples are constructed. This way, we form the final enhanced Interaction knowledge graph (IKG), as shown on the right side of Fig.2.**

Reviewer comment (Writing):
It’s recommended to define loss function (L_{IKG}, L_{mse}, etc.) in 4.1-4.3 to make the method easier to be understood.

Author response:
We appreciate this feedback and will revise the manuscript to improve clarity and ease of understanding. We will provide more detailed explanations and simplify the terminology to make the approach more accessible to a wider audience. We have updated this section to take into account **Q1 and Q2** as commented by the reviewer, and the font size of the images has been changed, and we have highlighted in red in the revised version. **Furthermore, to facilitate a better understanding of our method, we would like to provide a further summary of our approach.**

   Our model update process is similar to the concept of the EM algorithm. The updating of Interaction Knowledge Graph (IKG) is iteratively used to enhance various modules in Fig.2, and, in turn, the training of the model in Fig.2 improves IKG (on the right side of Fig.2). These two components collaborate, driving the entire iterative update process.**In our Appendix B, Algorithm 1 outlines the algorithm's process in detail.** Based on this, we will further explain the training process of the model within a single iteration.

   Constructing a complete knowledge graph in TCM is a highly complex task that requires substantial data support. Therefore, knowledge graph completion from existing facts is crucial to make the knowledge graph more comprehensive and enrich entity information. Thus, in the first stage of **Algorithm 1 (Phase I: Interaction Knowledge Graph Completion),** we perform entity representation learning using **Eq. (3)** in the paper, where $f(h, r, t) = C * ||Sin(W_re_h + e_r - W_re_t)||_1$. Subsequently, we update it backward using the loss function **$L_{IKG}$ in Eq. (6)** to complete and enrich entity information.

   In traditional knowledge graph embedding methods, typically only single knowledge triplets can be effectively represented, failing to capture higher-order similarities among entities. However, these higher-order relationships are critical for understanding complex interactions between entities, especially in the field of herbal medicine. For instance, ginger may treat both insomnia and cold symptoms, a multi-faceted relationship that cannot be accurately represented by a single triplet. To better aggregate symptom information and improve the quality of herb recommendations, we introduce the second stage of the algorithm. Building upon the first stage, we proceed to the second stage of **Algorithm 1 (Phase II: Recommended herbs based on sequential visits for each patient).**

   In the 3.1 Section, we elaborate on how we employ a Graph Neural Network (GNN) approach to apply the entity knowledge representations obtained in the first stage to the second-stage herb recommendation. **In this process, we utilize an adjacency matrix constructed using the normalized pointwise mutual information method defined in Eq. (1) while incorporating the entity knowledge representations learned in the first stage. We then aggregate high-order relationships and high-order entity similarity information using Eq. (2):  $E^{(k)} = SUM(NN_1((E^{(k-1)}+W^{I}E^{(k-1)}W_1^{(k)}); W_3^{(k)}), NN_2((E^{(k-1)} ⊙ W^{I}E^{(k-1)}W_2^{(k)}); W_4^{(k)}))$.**  Finally, we propagate backward through the **loss function in Eq.(6)**, which includes the mean squared error **loss $L_{mse}$** to measure the distance between the recommended herb set and the actual herb set, the state **loss $L_{state}$** to assess the similarity between herb recommendations before and after, **and the regularization $\boldsymbol{R}$ to constrain the relationships between herbs.** Through iterative gradient descent, we optimize the model parameters to minimize the overall loss function, achieving the optimization goal of our model.

   In summary, throughout the entire iterative process of the algorithm, we first learn entity representations for IKG, and then apply these representations to the second-stage herb recommendation model, as seen in the middle module of Fig.2. These two stages iteratively update each other, ultimately completing the training of the entire model. This process can be viewed as dynamic knowledge graph completion and herbal recommendation optimization. We thank the reviewers for their questions, which prompted us to delve deeper into the internal mechanisms and implementation details of the model.

Reviewer comment (Evaluation):
In Fig. 3, method w/o sequence performs very poor, which is confusing, as doctor can prescribe accurately even without any historical information. A successful AI system should also be robust to patient without historical information.

Author response:
We highly appreciate the reviewer's perspective on the performance differences of our model described in Fig.3 in the absence of sequence information. We agree that a robust artificial intelligence system should demonstrate effectiveness in situations where extensive patient history data is not available, similar to what a doctor might do in practical medical practice. The performance in the absence of sequence data is indeed an area we aimed to explore to demonstrate the additional value of historical context in traditional Chinese medicine recommendations. Traditional Chinese medical practices often rely on a comprehensive understanding of a patient's condition over an extended period, including the evolution of symptoms and treatment responses. The primary innovation of our model lies in leveraging this sequential data to enhance accuracy.

**However, the reviewer rightly points out that doctors can propose reasonable prescriptions even without such medical history. In response, we initiated further research. Through experiments, we discovered that when we did not utilize sequences for herbal recommendations, incorporating the overall patient condition into the model led to the results shown in Fig.3. Subsequently, we removed the overall patient condition and conducted experiments again using a model without sequence information, with the following results,**

  | Ablation      | Precision@5 | Precision@10 | Precision@20 | Recall@5 | Recall@10 | Recall@20 | F1@5   | F1@10  | F1@20  |
|-----------------------|-------------|--------------|---------------|----------|-----------|-----------|--------|--------|--------|
|                       |             |              |               |          |           |           |        |        |        |
| **w/o Sequence1**          | 0.2617      | 0.1490       | 0.1215        | 0.1249   | 0.1458    | 0.2252    | 0.1652 | 0.1432 | 0.1543 |
| **w/o Sequence2**| 0.4282      | 0.3906       | 0.2872        | 0.2296   | 0.4053    | 0.5683    | 0.2872 | 0.3836 | 0.3708 |


**w/o Sequence1** is the result of the ablation experiment of SCEIKG without sequence in our paper, and **w/o Sequence2** is likewise the result of the ablation experiment of SCEIKG without sequence, but with the overall condition of the patient removed from the experiment.

The following analysis was conducted on the experimental results,

**Role of the Sequence Module:** The sequence module may play a crucial role in handling sequential data, and removing it resulted in the model losing its ability to process sequence information. The information provided in the textual description may have been better integrated and utilized in the sequence module. In the absence of sequences, noise in the disease features may lead to interference from redundant information, thereby reducing performance.

**Association between Features and Sequences:** The inclusion of overall patient condition as a feature in the model may depend on certain patterns or contextual information in the sequence data. Removing the sequence module may hinder the model's ability to correctly capture these associations, resulting in a decline in performance.

**This part of the experiment we supplemented in Appendix D Poor Performance without sequences of the revised version, in line 645 of the paper and highlighted in red, see the revised version for more details.**

We thank the reviewers for their constructive feedback, which prompted us to make valuable extensions to the study to better serve all potential clinical applications.