Patient feature extraction method and device based on graph attention network, and electronic equipment
By constructing and training a relationship graph based on a graph attention network method, the problem of inaccurate feature extraction of patients with respiratory diseases in the existing technology is solved, more efficient and accurate patient feature extraction is achieved, and the prediction effect of respiratory diseases is improved.
Patent Information
- Application Number
- CN202510516914.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-09-09
AI Technical Summary
Existing technologies have difficulty in effectively extracting the characteristics of patients with respiratory diseases, resulting in insufficient prediction accuracy of respiratory diseases.
A graph attention network-based method is adopted to obtain sample data of patients with respiratory diseases, construct a relationship graph and perform pruning processing, and use the initial graph attention network for pre-training and formal training to obtain the target graph attention network to realize the extraction of patient features.
It improves the efficiency and accuracy of feature extraction of patients with respiratory diseases, enhances the extraction of local information, reduces redundant connections, and improves the predictive ability of the model.
Smart Images

Figure CN120611166A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a method, device, and electronic device for extracting patient features based on a graph attention network. Background Art
[0002] Respiratory diseases are a common chronic disease. Timely identification of high-risk patients is crucial for improving treatment efficiency and quality of care. Current methods for predicting respiratory diseases rely primarily on physician experience and statistical methods, but these methods often fail to effectively capture patient characteristics.
[0003] In view of this, how to effectively extract patient characteristics has become a technical problem that needs to be solved urgently. Summary of the Invention
[0004] In view of this, the purpose of the present disclosure is to propose a patient feature extraction method, device and electronic device based on graph attention network to solve or partially solve the above technical problems.
[0005] Based on the above objectives, the first aspect of the present disclosure proposes a patient feature extraction method based on a graph attention network, the method comprising:
[0006] Obtaining sample data of patients with respiratory diseases, and converting the sample data to obtain a data matrix;
[0007] Determine a characteristic vector and a target relationship matrix based on the indicator features in the data matrix, and construct a relationship graph based on the characteristic vector and the target relationship matrix;
[0008] Inputting the feature vector into an initial graph attention network, pruning the relationship graph based on the initial graph attention network to obtain a first subgraph, and pre-training the initial graph attention network based on the first subgraph to obtain an updated graph attention network;
[0009] Inputting the feature vector into the update graph attention network, dividing the relationship graph based on the update graph attention network to obtain a second subgraph, and formally training the update graph attention network based on the second subgraph to obtain a target graph attention network;
[0010] Patient data of patients with respiratory diseases are obtained, and feature extraction processing is performed on the patient data using the target graph attention network to obtain patient features.
[0011] Based on the same inventive concept, the second aspect of the present disclosure proposes a patient feature extraction device based on a graph attention network, comprising:
[0012] an acquisition module configured to acquire sample data of patients with respiratory diseases and convert the sample data to obtain a data matrix;
[0013] a relationship graph construction module, configured to determine a feature vector and a target relationship matrix based on the indicator features in the data matrix, and to construct a relationship graph based on the feature vector and the target relationship matrix;
[0014] a pre-training module configured to input the feature vector into an initial graph attention network, prune the relationship graph based on the initial graph attention network to obtain a first subgraph, and pre-train the initial graph attention network based on the first subgraph to obtain an updated graph attention network;
[0015] a formal training module configured to input the feature vector into the update graph attention network, partition the relationship graph based on the update graph attention network to obtain a second subgraph, and formally train the update graph attention network based on the second subgraph to obtain a target graph attention network;
[0016] The feature extraction module is configured to obtain patient data of patients with respiratory diseases and use the target graph attention network to perform feature extraction processing on the patient data to obtain patient features.
[0017] Based on the same inventive concept, the third aspect of the present disclosure proposes an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method described above when executing the computer program.
[0018] As can be seen from the above, the present disclosure provides a method, apparatus, and electronic device for extracting patient features based on a graph attention network. Sample data from patients with respiratory diseases is obtained and transformed to obtain a data matrix. Feature vectors and a target relationship matrix are determined based on the indicator features in the data matrix, and a relationship graph is constructed based on the feature vectors and the target relationship matrix. In this way, the relationship graph can reflect the correlation between the various indicator features in the sample data of patients with respiratory diseases. The feature vectors are input into an initial graph attention network, and the relationship graph is pruned based on the initial graph attention network to obtain a first subgraph. This integrates the correlation between the various indicator features, effectively groups highly correlated indicator features, enhances the extraction of local information, and reduces redundant connections. The initial graph attention network is pre-trained based on the first subgraph to obtain an updated graph attention network, which improves the efficiency and accuracy of the updated graph attention network's relationship graph pruning. The feature vectors are input into the updated graph attention network, and the relationship graph is partitioned based on the updated graph attention network to obtain a second subgraph. The updated graph attention network is formally trained based on the second subgraph to obtain a target graph attention network. By pre-training and formally training the initial graph attention network, the target graph attention network can be more accurate. Patient data of patients with respiratory diseases is obtained, and the target graph attention network is used to extract features from the patient data to obtain patient features. In this way, the trained target graph attention network can effectively extract patient features. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1 Flowchart of the patient feature extraction method based on graph attention network according to an embodiment of the present disclosure;
[0021] Figure 2 This is a flow chart of converting sample data according to an embodiment of the present disclosure;
[0022] Figure 3 A schematic diagram of classifying patient data according to an embodiment of the present disclosure;
[0023] Figure 4 A schematic diagram of a relationship diagram and sub-diagrams of an embodiment of the present disclosure;
[0024] Figure 5 This is a flowchart of a relationship graph pruning process according to an embodiment of the present disclosure;
[0025] Figure 6 Schematic diagram of a graph attention network according to an embodiment of the present disclosure;
[0026] Figure 7 A flowchart of graph attention network training according to an embodiment of the present disclosure;
[0027] Figure 8 Flowchart of a method for extracting features of patients with chronic respiratory diseases based on a graph attention network according to an embodiment of the present disclosure;
[0028] Figure 9 Schematic diagram of the structure of a patient feature extraction device based on a graph attention network according to an embodiment of the present disclosure;
[0029] Figure 10 Schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.
[0031] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should have the usual meanings understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative position relationships. When the absolute position of the described object changes, the relative position relationship may also change accordingly.
[0032] Based on the description of the background technology, chronic respiratory disease (CRD) is a type of chronic disease with a high incidence worldwide, including chronic obstructive pulmonary disease, asthma and interstitial lung disease. Among them, chronic obstructive pulmonary disease is the main cause of CRD-related deaths, and asthma has the highest prevalence, which has a wide-ranging impact on people's health. CRD also poses a major challenge to the public health system. CRD patients have a high mortality rate during the acute attack period, so timely identification of high-risk CRD patients is of great significance to improving treatment efficiency and quality of care. In the past, doctors mainly relied on experience and traditional statistical methods (for example, regression analysis) to make relevant predictions about CRD, but these methods often have limitations when processing complex health data, such as difficulty in handling nonlinear relationships and high-dimensional data.
[0033] With the accumulation of large-scale clinical data and the improvement of computing power, the application of machine learning in the field of healthcare has made great progress. In recent years, recurrent neural networks, long short-term memory networks, convolutional neural networks, and models based on attention mechanisms have been widely used in health data analysis, showing their superiority in processing complex time series data and extracting multidimensional clinical features. These models can effectively identify disease patterns in patients with CRD and assist doctors in making more accurate decisions. However, these methods fail to effectively model the complex relationships between features and are primarily data-driven. They also lack integration of medical knowledge and disease mechanisms, resulting in poor model interpretability.
[0034] As mentioned above, how to effectively extract patient characteristics has become an important research issue.
[0035] Based on the above description, if Figure 1 As shown, the patient feature extraction method based on the graph attention network proposed in this embodiment includes:
[0036] Step 101: Obtain sample data of patients with respiratory diseases, and convert the sample data to obtain a data matrix.
[0037] In specific implementation, respiratory disease patients refer to patients with chronic respiratory diseases (CRD patients). Sample data of patients with respiratory diseases is obtained, wherein the sample data includes: basic patient information, vital signs data, comorbidity data, and laboratory test data. The sample data is preprocessed to obtain indicator features, the indicator features are converted to obtain a data matrix, and the data matrix is divided into a training set and a validation set according to a preset ratio, wherein the training set is used to train the initial graph attention network to obtain the target graph attention network, and the validation set is used to verify the target graph attention network.
[0038] Step 102: determining a characteristic vector and a target relationship matrix based on the indicator features in the data matrix, and constructing a relationship graph based on the characteristic vector and the target relationship matrix.
[0039] In specific implementation, a data matrix consisting of each patient's basic indicators, vital signs, laboratory test indicators, and comorbidity indicators is converted into a feature vector through linear transformation. An initial relationship matrix constructed based on the interrelationships between CRD indicator characteristics can reflect the complex relationships between indicator characteristics. An element 1 in the initial relationship matrix indicates a direct relationship, and a 0 indicates no relationship.
[0040] In addition, to address the issue of missing data sources, a masking mechanism is introduced to mask out missing indicators in the initial relationship matrix through a mask matrix. Ultimately, the eigenvectors and the masked target relationship matrix are used to construct the nodes and edges of the CRD indicator relationship graph, respectively.
[0041] Step 103: input the feature vector into an initial graph attention network, prune the relationship graph based on the initial graph attention network to obtain a first subgraph, and pre-train the initial graph attention network based on the first subgraph to obtain an updated graph attention network.
[0042] In specific implementation, the feature vector is input into the initial graph attention network, and deep feature extraction of the feature vector is achieved through stacked graph attention layers, thereby enhancing the initial graph attention network's ability to understand different types of CRD indicators, especially those with weak correlation. At the same time, a graph attention layer with a changing number of nodes is introduced, and local relevant information is captured through subgraph partitioning and node fusion driven by CRD phenotype, thereby improving the efficiency and accuracy of the initial graph attention network. In the graph attention calculation, each node updates its features by propagating information with adjacent nodes, and the attention coefficient is used to weight the features of adjacent nodes when the node is updated. Subgraph partitioning divides the relationship graph into multiple first subgraphs by setting an attention coefficient threshold and pruning the edges. After aggregating the node features of each first subgraph, it is further processed through the graph attention layer to capture more relevant local information.
[0043] Graph Attention Networks (GATs) use the attention mechanism to learn relationships between nodes, enabling tasks such as node classification and node-level feature learning on graph data. The core idea of GATs is to calculate an attention coefficient at each node to determine the importance of the node to its neighbors. The attention mechanism enables the model to assign different weights to relationships between different nodes, thereby better capturing both local structure and global information in graph data.
[0044] Step 104: input the feature vector into the update graph attention network, divide the relationship graph based on the update graph attention network to obtain a second subgraph, and formally train the update graph attention network based on the second subgraph to obtain a target graph attention network.
[0045] In practice, feature vectors of CRD patients are extracted through multi-layer graph attention features and then input into the graph attention network. Graph attention network training consists of two phases: pre-training and main training. During pre-training, the number of initial subgraphs is dynamically adjusted to select the optimal number of subgraphs. During main training, subgraphs are divided based on edge pruning results and medical criteria based on CRD phenotypes, ensuring that highly correlated indicators are grouped together and consistent with medical common sense. Loss functions are calculated during both training phases, and the parameters of the initial graph attention network are updated until the network converges.
[0046] Step 105: Obtain patient data of patients with respiratory diseases, and use the target graph attention network to perform feature extraction processing on the patient data to obtain patient features.
[0047] In a specific implementation, patient data from patients with respiratory diseases is obtained, including basic patient information, vital signs, comorbidities, and laboratory test data. This patient data is then fed into a trained target graph attention network, which then extracts features from the patient data to generate patient features. These features include disease type or risk level.
[0048] Through the above embodiment, sample data of patients with respiratory diseases are obtained, and the sample data are converted to obtain a data matrix. Based on the indicator features in the data matrix, feature vectors and a target relationship matrix are determined, and a relationship graph is constructed based on the feature vectors and the target relationship matrix. In this way, the relationship between the various indicator features in the sample data of patients with respiratory diseases can be reflected according to the relationship graph. The feature vector is input into the initial graph attention network, and the relationship graph is pruned based on the initial graph attention network to obtain a first subgraph. This can integrate the relationship between the various indicator features, effectively group the indicator features with high correlation, enhance the extraction of local information, and reduce redundant connections. The initial graph attention network is pre-trained based on the first subgraph to obtain an updated graph attention network, which can improve the efficiency and accuracy of the updated graph attention network in pruning the relationship graph. The feature vector is input into the updated graph attention network, and the relationship graph is divided based on the updated graph attention network to obtain a second subgraph. The updated graph attention network is formally trained based on the second subgraph to obtain a target graph attention network. By pre-training and formally training the initial graph attention network, the target graph attention network can be ensured to be more accurate. Patient data of patients with respiratory diseases is obtained, and the target graph attention network is used to extract features from the patient data to obtain patient features. In this way, the trained target graph attention network can effectively extract patient features.
[0049] In some embodiments, step 101 includes:
[0050] Step 1011 : Acquire sample data of patients with respiratory diseases, and divide the sample data into continuous indicator data and categorical indicator data.
[0051] Step 1012: normalize the continuous indicator data to obtain continuous indicator features, and encode the categorical indicator data to obtain categorical indicator features.
[0052] Step 1013: Concatenate the continuous indicator features and the categorical indicator features to obtain a data matrix.
[0053] When implementing it specifically, Figure 2 FIG. 1 is a flow chart of converting sample data according to an embodiment of the present disclosure. Figure 2 As shown in Figure 1, the sample data is divided into continuous indicator data and categorical indicator data. The continuous indicator data is normalized to obtain continuous indicator features, and the categorical indicator data is encoded to obtain categorical indicator features. Missing values are filled in for the continuous and categorical indicator features to obtain multi-source data, which is then integrated to obtain a data matrix.
[0054] Figure 3FIG. 1 is a schematic diagram of classifying patient data according to an embodiment of the present disclosure. Figure 3 As shown, CRD patient data (i.e., sample data) includes: patient basic information, vital signs data, comorbidity data, and laboratory test data. CRD patient data are divided into category indicator data and continuous indicator data. Among them, category indicator data includes patient basic information and comorbidity data, and continuous indicator data includes vital signs data and laboratory test data. For example, patient basic information includes patient gender and patient age. Comorbidity data includes at least one of the following: hypertension, allergic rhinitis, eczema, and chronic obstructive pulmonary disease. Vital signs data includes at least one of the following: pulse, systolic blood pressure, diastolic blood pressure, and blood oxygen saturation. Laboratory test data includes at least one of the following: white blood cells, red blood cells, platelets, and potassium ions.
[0055] Continuous indicator data (e.g., vital signs and laboratory test data) are normalized to obtain continuous indicator features. Specifically, the mean and standard deviation of the continuous indicator data are determined, and the continuous indicator features are obtained by subtracting the mean from the continuous indicator data and dividing it by the standard deviation. This ensures that continuous indicator features of different dimensions can be analyzed on the same scale.
[0056] Categorical indicator data (e.g., patient basic information and comorbidity data) is encoded to obtain categorical indicator features. Encoding methods include one-hot encoding and label encoding. Specifically, the categorical indicator data is encoded using one-hot encoding or label encoding to obtain categorical indicator features, which are then digitized so that the graph attention network can process the categorical indicator features.
[0057] For missing data in continuous and categorical indicator features, zero filling is used to fill in the data to ensure the integrity of the continuous and categorical indicator features. The filled continuous and categorical indicator features are then vertically spliced to obtain the data matrix.
[0058] Label the data matrix based on the specific prediction goal. Divide the data matrix into a training set and a validation set according to a preset ratio. Resample and undersample the training set and validation set, respectively, to balance the data matrix. For example, if the preset ratio is 1:3, then divide the data matrix into a training set and a validation set at a ratio of 1:3.
[0059] Resampling is a statistical and machine learning method that creates a new dataset by resampling samples from an existing dataset (with or without replacement). The main purpose of resampling is to address issues such as data imbalance, estimation errors, and assessing the generalization ability of models. Common resampling methods include oversampling, undersampling, cross-validation, and bootstrapping.
[0060] Undersampling balances the dataset by reducing the number of samples from the majority class. Undersampling reduces the size of the sample set by randomly removing samples from the majority class until its class distribution is balanced. This method can reduce the size of the dataset but may lose some information.
[0061] Using this approach, sample data from respiratory disease patients is divided into continuous indicator data and categorical indicator data. The continuous indicator data is normalized to obtain continuous indicator features, ensuring that continuous indicator features of different dimensions can be analyzed at the same scale. The categorical indicator data is encoded to obtain categorical indicator features, which are then digitized to facilitate processing by the graph attention network. The continuous indicator features and categorical indicator features are concatenated to obtain a data matrix, from which a relationship graph can be constructed.
[0062] In some embodiments, step 102 includes:
[0063] Step 1021 : Standardize the multiple indicator features in the data matrix to obtain standard features, and map the standard features to a first preset space to obtain feature vectors.
[0064] In specific implementation, the data matrix includes the patient's basic indicator characteristics, vital sign indicator characteristics, comorbidity indicator characteristics and laboratory test indicator characteristics. The multiple indicator characteristics in the data matrix are represented as a vector x = [x1, x2, ..., x N ]∈R 1×N , where x N is the Nth indicator feature, and N is the number of CRD-related indicators in the data matrix.
[0065] For each indicator feature x in the data matrix i Standardization is performed to obtain standard features, and the standard features are mapped to the first preset space to obtain feature vectors, so that the feature vectors can more clearly represent the indicator features in the data matrix. The first preset space is a d (0) Dimensional space.
[0066] Specifically, the data matrix is converted into a feature vector by the following formula,
[0067] H (0) =W e x+b e
[0068] Among them, H (0) is the feature vector, x is the representation vector of multiple indicator features in the data matrix, is the first learnable parameter, is the second learnable parameter.
[0069] The eigenvector is H (0) =[h1 (0) ,h2 (0) ,…,h N (0) ],in, is the indicator feature of the i-th node.
[0070] Step 1022: Based on prior knowledge, determine whether any two indicator features in the data matrix have a direct relationship to obtain a correlation determination result, and construct an initial relationship matrix based on the correlation determination result.
[0071] In specific implementation, in order to effectively construct the relationship diagram of CRD indicator characteristics, it is necessary to consider the correlation between various indicator characteristics. r ∈R N×N To express the correlation between various indicator characteristics, it is used to reflect the direct correlation between CRD indicator characteristics.
[0072] M r It is a binary matrix constructed based on prior knowledge and a large-scale language model. When there is a direct correlation between two indicator features, the corresponding position in the initial relationship matrix is 1; when there is no direct correlation between the two indicator features, the corresponding position in the initial relationship matrix is 0. In this way, the initial relationship matrix can help the graph attention network effectively capture the interactions and influences between different clinical indicators and avoid redundant connections in the graph attention network.
[0073] Step 1023 : determining missing data from the data matrix, constructing a mask matrix based on the missing data, and performing mask processing on the initial relationship matrix based on the mask matrix to obtain a target relationship matrix.
[0074] In practice, in real-world settings, doctors assess CRD patients and prescribe specific laboratory tests. However, some tests may be missing from patient to patient. To accurately reflect the distribution of patient sample data and ensure the graph attention network can adapt to the presence of missing test items, a masking mechanism was employed.
[0075] First, a mask matrix M0∈R is constructed by statistical analysis of the missing data pattern. N×H , the mask matrix M0 and the initial relationship matrix M rThe dimensions of the matrix are consistent. In the mask matrix M0, the rows and columns with missing data are set to 0, indicating that there is no connection between these nodes. The remaining positions are set to 1, indicating that the connection remains valid. The mask matrix is used to mask some relevant information in the initial relationship matrix to ensure that the graph attention network is not affected by the missing indicator features. Finally, the masked target relationship matrix M masked Calculated by the following formula:
[0076]
[0077] Among them, M r is the initial relationship matrix, M0 is the mask matrix, Indicates the element-by-element multiplication operation. The target relation matrix M after masking masked It can ensure that the missing indicator features in the subsequent graph attention network will not affect the update of adjacent nodes, thereby improving the adaptability and predictive ability of the graph attention network to different patient data patterns.
[0078] Step 1024: construct nodes of a relationship graph based on the feature vectors, construct edges of the relationship graph based on the target relationship matrix, and obtain a relationship graph based on the nodes and the edges.
[0079] In specific implementation, according to the eigenvector H (0) And the masked target relationship matrix M masked , construct a graph-based representation G = (V, E) and obtain a relationship graph. Figure 4 Schematic diagram of the relationship diagram and sub-diagram of the embodiment of the present disclosure. Figure 4 As shown, Figure 4 The CRD indicator relationship diagram in can reflect multiple indicator characteristics and the correlation between each indicator characteristic. Figure 4 Node v in i Represents the CRD indicator characteristics, edge e ij Then M masked The corresponding element representation of .
[0080] Through the above scheme, multiple indicator features in the data matrix are standardized to obtain standard features, and the standard features are mapped to the first preset space to obtain feature vectors, so that the indicator features in the data matrix can be more clearly represented by the feature vectors. Based on prior knowledge, it is judged whether there is a direct relationship between any two indicator features in the data matrix to obtain a correlation judgment result, and an initial relationship matrix is constructed based on the correlation judgment result. In this way, the initial relationship matrix can help the graph attention network effectively capture the interactions and influences between different clinical indicators, and avoid redundant connections in the graph attention network. By masking the initial relationship matrix, the target relationship matrix can ensure that the missing indicator features in the subsequent graph attention network will not affect the update of adjacent nodes, thereby improving the adaptability and predictive ability of the graph attention network to different patient data patterns. The nodes of the relationship graph are constructed based on the feature vectors, the edges of the relationship graph are constructed based on the target relationship matrix, and the relationship graph is obtained according to the nodes and the edges.
[0081] In some embodiments, step 103 includes:
[0082] Step 1031: Input the feature vector into the initial graph attention network, and determine the input features corresponding to each node in the relationship graph from the feature vector.
[0083] Step 1032: Determine the adjacent nodes of each node from the relationship graph, and determine the attention coefficient between each node and the adjacent nodes through the graph attention mechanism.
[0084] Step 1033: Based on the initial graph attention network, the input features of all nodes in the relationship graph are updated according to the attention coefficient to obtain a relationship graph node feature set.
[0085] Step 1034: Prune the relationship graph according to the attention coefficient to obtain a first subgraph, determine the subgraph node features of all nodes in the first subgraph from the relationship graph node feature set, and update the subgraph node features based on the graph attention network to obtain a first subgraph node feature set.
[0086] Step 1035: Update the model parameters of the initial graph attention network based on the first subgraph node feature set to obtain an updated graph attention network.
[0087] In specific implementation, the graph attention mechanism is used to determine the v of each node i and adjacent node v j The attention coefficient α between ij Based on the initial graph attention network, the input features of each node in the relationship graph are updated according to the attention coefficient to obtain the corresponding relationship graph node feature h i(p+1) , combine the relationship graph node features of all nodes in the relationship graph to obtain the relationship graph node feature set H (p+1) For the target node in each node, when the attention coefficient between the target node and the adjacent node is less than the preset attention coefficient threshold, the target edge between the target node and the adjacent node in the relationship graph is removed to obtain the first subgraph, and the subgraph node features of all nodes in the first subgraph are determined from the relationship graph node feature set, and the subgraph node features are aggregated to obtain the aggregated node feature h k (P) , use the graph attention network to update the aggregated node features to obtain the first subgraph node feature set H (P+1) .
[0088] Through the above scheme, the input features of the nodes in the relationship graph can be updated according to the attention coefficient, so that the obtained relationship graph node feature set is more accurate. When the attention coefficient between the target node and the adjacent node is less than the preset attention coefficient threshold, the target edge between the target node and the adjacent node in the relationship graph is removed to obtain the first subgraph. In this way, the edge between two nodes with low correlation in the relationship graph can be removed, so that the obtained first subgraph can accurately represent the correlation relationship between the indicator features corresponding to each node. The subgraph node features are aggregated to obtain aggregated node features, and the aggregated node features are updated using the graph attention network to obtain the first subgraph node feature set. The input features of the nodes in the first subgraph can be updated, so that the obtained first subgraph node feature set is more accurate.
[0089] In some embodiments, step 1032 includes:
[0090] Step 1032A: for each target node in the node, determine the adjacent nodes of the target node.
[0091] Step 1032B: determine the attention coefficient between the target node and the adjacent nodes through the graph attention mechanism.
[0092]
[0093] Among them, α ij is the attention coefficient between the i-th target node and the j-th adjacent node, LeakyReLU(·) is the activation function, || represents the row connection operation, a is the weight vector, W is the shared weight matrix, and h i (p) is the input feature of the i-th target node of the p+1-th graph attention layer, h j (p) is the input feature of the jth adjacent node of the p+1th graph attention layer, h n (p)is the input feature of the nth adjacent node of the p+1th graph attention layer, m ij is the element in the mask matrix, V i is the set of adjacent nodes consisting of all adjacent nodes of the i-th target node, v k is the kth adjacent node in the set of adjacent nodes.
[0094] In specific implementation, the attention coefficient between the target node and the adjacent nodes is determined by the graph attention mechanism, which uses a simple feedforward network and a weight vector a∈R 1×2d(p+1) In the above formula for calculating the attention coefficient, there can be multiple adjacent nodes, that is, j∈(1,2,…,N).
[0095] Through the above scheme, the attention coefficient between the target node and the adjacent nodes can be accurately determined through the graph attention mechanism, so that the input features of each node in the relationship graph can be updated according to the attention coefficient to obtain the corresponding relationship graph node features. At the same time, the relationship graph can also be pruned according to the attention coefficient to obtain the first subgraph.
[0096] In some embodiments, step 1033 includes:
[0097] Step 1033A: Based on the initial graph attention network, the input features of each node in the relationship graph are updated according to the attention coefficient to obtain the corresponding relationship graph node features.
[0098]
[0099] Among them, h i (p+1) is the feature of the i-th graph node in the p+1-th graph attention layer, σ(·) is the ReLU(·) activation function, and α ij is the attention coefficient between the i-th target node and the j-th adjacent node, W is the shared weight matrix, h n (p) is the input feature of the nth adjacent node of the p+1th graph attention layer, V i is the set of adjacent nodes consisting of all adjacent nodes of the i-th target node, v k is the kth adjacent node in the set of adjacent nodes.
[0100] Step 1033B: combining the relationship graph node features of all nodes in the relationship graph to obtain a relationship graph node feature set.
[0101] H (p+1) =[h1 (p+1) ,h2 (p+1) ,…,h N (p+1)]
[0102] Among them, H (p+1) is the feature set of the graph nodes in the p+1th graph attention layer, h N (p+1) It is the Nth relationship graph node feature of the p+1th graph attention layer.
[0103] In practice, in a graph attention network, information propagation is achieved through graph convolutional layers. Each node is updated based on the information of its neighboring nodes, which can capture the relationship between nodes and the deep structure of the network. Taking the p+1th layer of the graph attention layer as an example, the node update process is as follows:
[0104] The input feature of the (p+1)th graph attention layer is H (p) =[h1 (p) ,h2 (p) ,…,h N (v) ], where each The target node v i The feature representation of d (p) is the dimension of the node feature vector.
[0105] The output feature of the graph attention layer of the (p+1)th layer is H (p+1) =[h1 (p+1) ,h2 (p+1) ,…,h N (p+1) ], where each is the updated target node v i Then use a shared weight matrix Map the input features to a higher or equal dimensional space d (p+1) .
[0106] The output feature of each node is the weighted sum of the features of its adjacent nodes, and the weight is determined by the attention coefficient α ik Decide:
[0107]
[0108] Among them, σ(·) is the ReLU(·) activation function, which represents a nonlinear transformation.
[0109] Through the above scheme, based on the initial graph attention network, the input features of each node in the relationship graph are updated according to the attention coefficient to obtain the corresponding relationship graph node features. The relationship graph node features of all nodes in the relationship graph are combined to obtain the relationship graph node feature set. In this way, the input features of the nodes in the relationship graph can be updated according to the attention coefficient, making the obtained relationship graph node feature set more accurate.
[0110] In some embodiments, step 1034 includes:
[0111] Step 1034A: For the target node in each node, the attention coefficient between the target node and the adjacent node is compared with a preset attention coefficient threshold.
[0112] Step 1034B: In response to determining that the attention coefficient is less than a preset attention coefficient threshold, the target edge between the target node and the adjacent node in the relationship graph is removed to obtain a first subgraph.
[0113] Step 1034C: Determine the subgraph node features of all nodes in the first subgraph from the relationship graph node feature set.
[0114] Step 1034D: Aggregate the subgraph node features to obtain aggregate node features.
[0115]
[0116] Among them, h k (P) is the aggregate node feature of the k subgraph node features of the P-th graph attention layer, h i (P) is the feature of the ith subgraph node in the Pth graph attention layer, V k is the set of k subgraph nodes in the P-th graph attention layer, v i It is the i-th subgraph node of the P-th graph attention layer.
[0117] Step 1034E: Use the graph attention network to update the aggregated node features to obtain a first subgraph node feature set.
[0118] H (P+1) =[h1 (p+1) ,h2 (p+1) ,…,h K (P+1) ]
[0119] Among them, H (P+1) is the first subgraph node feature set of the P+1th graph attention layer, h K (P+1) is the kth aggregate node feature in the P+1th graph attention layer.
[0120] In specific implementation, in order to further improve the efficiency and accuracy of graph neural networks, a node fusion strategy based on edge pruning is used to extract more relevant local information by dividing the subgraph. Figure 5 FIG. 1 is a flowchart of the relationship graph pruning process according to an embodiment of the present disclosure. Figure 5As shown, the relationship graph is pruned to obtain the first subgraph, including:
[0121] First, each edge in the graph is evaluated according to the preset attention coefficient threshold τ, for example, for the edge (i, j) between the target node i and the adjacent node j. ij If the value is less than the preset attention coefficient threshold τ, the edge between the target node i and the adjacent node j is removed from the relationship graph to form an edge cut set S τ ={(i,j)∈E||α ij <τ}. Remove all τ After the edges in , we get the pruned relationship graph G′=(V,E′), where E′=E / S τ This process will pruned the relationship graph G ′ Divide into K first subgraphs G1, G2, ..., G K , where each first subgraph G k =(V k ,E k ) contains a group of nodes with strong correlation. The node set in each first subgraph It indicates a CRD indicator with high correlation, and the correlation between multiple first subgraphs is weak.
[0122] Subsequently, the subgraph node features of each first subgraph are aggregated to obtain the aggregated node features. The aggregation method is to average the features of all nodes in the first subgraph:
[0123]
[0124] In this way, the node features in the first subgraph are compressed and the information becomes richer.
[0125] Then, these aggregated node features will also pass through the graph attention layer, but in this process they are no longer affected by the initial relationship matrix M r Constraints are set, and edges between all nodes are allowed to be established.
[0126] Finally, the output of the graph attention layer is the updated first subgraph node feature set H (P+1) =[h1 (P+1) ,h2 (P +1) ,…,h K (P+1) ], each of which is the aggregation node feature.
[0127] Through the above scheme, when the attention coefficient between the target node and the adjacent node is less than the preset attention coefficient threshold, the target edge between the target node and the adjacent node in the relationship graph is removed to obtain the first subgraph. In this way, the edge between two nodes with low correlation in the relationship graph can be removed, so that the first subgraph can accurately represent the correlation relationship between the indicator features corresponding to each node. The subgraph node features are aggregated to obtain aggregated node features, and the aggregated node features are updated using the graph attention network to obtain the first subgraph node feature set. In this way, the input features of the nodes in the first subgraph can be updated, making the first subgraph node feature set more accurate.
[0128] In some embodiments, step 104 includes:
[0129] Step 1041: Input the feature vector into the updated graph attention network, and determine the number of subgraphs according to a preset attention coefficient threshold.
[0130] Step 1042 : Divide the relationship graph according to the number of subgraphs to obtain second subgraphs, and sort the second subgraph node feature sets of the second subgraphs according to the frequency of occurrence.
[0131] Step 1043 : For each second subgraph node in the second subgraph node feature set, determine whether the second subgraph node is in the initialization set.
[0132] Step 1044 : In response to determining that the second subgraph node is not in the initialization set and the second subgraph node meets a preset criterion, the second subgraph node is added to the initialization set to obtain an updated set.
[0133] Alternatively, in step 1045 , in response to determining that the second subgraph node is in the initialization set and the second subgraph node meets a preset criterion, the corresponding element in the initialization set is replaced with the second subgraph node to obtain an updated set.
[0134] Step 1046: Update the model parameters of the updated graph attention network based on the update set to obtain a target graph attention network.
[0135] When implementing it specifically, Figure 6 Schematic diagram of the graph attention network of the embodiment of the present disclosure. Figure 6As shown in the figure, an indicator relationship graph is generated based on the CRD feature vector and the CRD relationship matrix after the masking mechanism. The indicator relationship graph is input into the graph attention network. The graph attention layer of the P layer performs graph attention calculation on the relationship graph. After forward propagation and residual connection, CRD phenotype-driven subgraph partitioning is performed. The graph attention layer of the Q layer performs graph attention calculation on the relationship graph. After forward propagation and residual connection, the partitioned subgraph is input into the prediction network to calculate the loss function of the graph attention network.
[0136] During pre-training, the preset attention coefficient threshold τ is dynamically changed, and τ for each sample depends on the pre-set number of subgraphs K. The number of subgraphs K is determined based on the performance indicators of the updated graph attention network obtained during pre-training. During formal training, the relationship graph is divided into K second subgraphs.
[0137] Specifically, the feature vector and the preset standard are input into the updated graph attention network, wherein the feature vector can be the feature vector of the validation set, and the preset standard can be the medical criterion P med Using the updated graph attention network, the relationship graph is divided into K second subgraphs, and the second subgraph node feature set S of the second subgraph is sorted according to the frequency of occurrence.
[0138] For each second subgraph node s in the second subgraph node feature set S, determine whether the second subgraph node s is in the initialization set C0, and determine whether the second subgraph node s meets the preset standard P med When the second subgraph node s is not in the initialization set C0 and the second subgraph node s meets the preset standard P med , then add the second subgraph node s to the initialization set C0 to obtain the updated set C K Or, when the second subgraph node s is in the initialization set C0 and the second subgraph node s meets the preset standard P med , then use the second subgraph node s to replace the corresponding element in the initialization set C0 to obtain the updated set C K .
[0139] For each second subgraph node s in the second subgraph node feature set S, determine whether the second subgraph node s is 1, and determine whether the number of subgraphs in the initialization set C0 is K. When the second subgraph node s is 1 and the number of subgraphs in the initialization set C0 is K, remove the indicator features that are the same as the second subgraph node s in the initialization set C0, and add the second subgraph node s to the initialization set C0 to obtain the updated set C. K .
[0140] Based on the update set C KDetermine the loss function of the updated graph attention network, and update the model parameters of the updated graph attention network according to the loss function to obtain the target graph attention network.
[0141] Figure 7 Flowchart of the graph attention network training of the embodiment of the present disclosure. Figure 7 As shown in the figure, the initial graph attention network is pre-trained based on the CRD patient dataset to determine the subgraph partitioning. The loss function of the initial graph attention network is calculated by predicting CRD-related targets. The model parameters of the initial graph attention network are updated according to the loss function to obtain an updated graph attention network. Convergence of the updated graph attention network is determined. If the updated graph attention network has not converged, the loss function of the updated graph attention network is calculated and the model parameters of the updated graph attention network are continuously updated until the updated graph attention network converges.
[0142] Similarly, in the formal training process, based on the update set C K Determine the loss function for the updated graph attention network and update the model parameters of the updated graph attention network according to the loss function to obtain the target graph attention network. Determine whether the target graph attention network has converged. If the target graph attention network has not converged, calculate the loss function of the target graph attention network and continue to update the model parameters of the target graph attention network until the target graph attention network converges.
[0143] Through this approach, the relationship graph is partitioned according to the number of subgraphs to obtain a second subgraph. By determining whether the second subgraph node is in the initialization set, the initialization set is updated using the second subgraph node, making the resulting updated set more accurate. Based on the updated set, the model parameters of the update graph attention network are updated to obtain the target graph attention network, enabling the target graph attention network to more accurately partition the relationship graph.
[0144] Through the above embodiment, sample data of patients with respiratory diseases are obtained, and the sample data are converted to obtain a data matrix. Based on the indicator features in the data matrix, feature vectors and a target relationship matrix are determined, and a relationship graph is constructed based on the feature vectors and the target relationship matrix. In this way, the relationship between the various indicator features in the sample data of patients with respiratory diseases can be reflected according to the relationship graph. The feature vector is input into the initial graph attention network, and the relationship graph is pruned based on the initial graph attention network to obtain a first subgraph. This can integrate the relationship between the various indicator features, effectively group the indicator features with high correlation, enhance the extraction of local information, and reduce redundant connections. The initial graph attention network is pre-trained based on the first subgraph to obtain an updated graph attention network, which can improve the efficiency and accuracy of the updated graph attention network in pruning the relationship graph. The feature vector is input into the updated graph attention network, and the relationship graph is divided based on the updated graph attention network to obtain a second subgraph. The updated graph attention network is formally trained based on the second subgraph to obtain a target graph attention network. By pre-training and formally training the initial graph attention network, the target graph attention network can be ensured to be more accurate. Patient data of patients with respiratory diseases is obtained, and the target graph attention network is used to extract features from the patient data to obtain patient features. In this way, the trained target graph attention network can effectively extract patient features.
[0145] It should be noted that the embodiments of the present disclosure may be further described in the following manner:
[0146] Figure 8 Flowchart of the method for extracting features of patients with chronic respiratory diseases based on graph attention network according to an embodiment of the present disclosure. Figure 8 As shown in the figure, the feature extraction method for patients with chronic respiratory diseases based on the graph attention network includes:
[0147] Step 1: Data preprocessing
[0148] The original data of patients were obtained from the electronic health records of multiple hospitals, from which various CRD indicators such as basic information of patients, vital signs data, comorbidity data, laboratory test data, etc. were screened. Figure 3 As shown. According to different prediction tasks, the patient's label is obtained for subsequent training of the neural network. According to the characteristics of CRD patient data, a series of preprocessing operations are taken, such as Figure 2 shown.
[0149] Step 1.1, CRD-related indicators and sample screening
[0150] Based on anonymous electronic health record data from multiple hospitals, we analyzed the medical records of adult patients (≥18 years old). We screened for multiple CRD indicators, including basic patient information, vital signs, comorbidity data, and laboratory test data. Samples with missing laboratory test data were excluded.
[0151] Step 1.2, indicator processing
[0152] For continuous indicator data (for example, vital signs data, laboratory test data, etc.), normalization processing is performed, that is, the continuous indicator data is subtracted from the mean and divided by the standard deviation to obtain continuous indicator features, thereby ensuring that continuous indicator features of different dimensions can be analyzed at the same scale. Categorical indicator data (for example, basic patient information, comorbidity data, etc.) are digitized, and encoding methods such as unique hot encoding or label encoding can be used so that the graph attention network can process them. In addition, for missing data, zero filling is used to fill it in to ensure data integrity. The processed continuous indicator features and categorical indicator features are vertically spliced and integrated into a data matrix.
[0153] Step 1.3, Dataset Segmentation
[0154] Label the dataset based on the specific prediction goal. Divide the patient data into a training set and a validation set at a ratio of 1:3. Resampling and undersampling are used to balance the training set and validation set, respectively.
[0155] Step 2: CRD graph network construction
[0156] The eigenvectors of the data matrix after dimension transformation constitute the points of the CRD indicator relationship diagram, and the relationship matrix reflecting the relationship between the CRD indicator characteristics constructed by medical prior knowledge constitutes the edges of the CRD indicator relationship diagram through a masking mechanism.
[0157] Step 2.1, feature vector construction
[0158] After data preprocessing, the data matrix of each patient includes the patient's basic indicator characteristics, vital sign indicator characteristics, laboratory test indicator characteristics and comorbidity indicator characteristics. These indicator characteristics are represented as vector x = [x1, x2, ..., x N ]∈R 1×N , where N is the number of CRD-related indicator features. Each indicator feature x i All are normalized and mapped to a d by linear transformation (0) dimensional space in order to better represent the indicator characteristics. This process is completed through the following formula: (0) =W e x+b e .in, and is a learnable parameter. The final H (0) =[h1 (0) ,h2 (0) ,…,h N (0) ] is used as the input of the CRD graph network building module, where the indicator characteristics of each node are
[0159] Step 2.2, relationship matrix construction
[0160] In order to effectively construct the relationship diagram of CRD indicator characteristics, it is necessary to consider the correlation between each indicator characteristic. r ∈R N×N To express the correlation between various indicator features, it is used to reflect the direct correlation between CRD indicator features. r It is a binary matrix constructed based on prior knowledge and a large-scale language model. When there is a direct correlation between two indicator features, the corresponding position in the relationship matrix is 1; when there is no direct correlation between the two indicator features, the corresponding position in the relationship matrix is 0. In this way, the relationship matrix can help the model effectively capture the interactions and influences between different clinical indicators and avoid redundant connections in the graph attention network.
[0161] Step 2.3, masking mechanism
[0162] In the actual medical environment, doctors assess the condition of CRD patients and prescribe specific laboratory tests. However, different patients may have missing test items. In order to accurately reflect the distribution characteristics of the data and ensure that the model can adapt to the situation of missing test items, a masking mechanism is adopted. First, through statistical analysis of the missing data pattern, a missing mask matrix M0∈R is constructed. N×N , the mask matrix M0 and the relationship matrix M r The dimensions are consistent. In the mask matrix M0, the row and column positions with missing data are set to 0, indicating that there is no connection between these nodes. The remaining positions are set to 1, indicating that the connection remains valid. The mask matrix is used to mask some relevant information in the original relationship matrix to ensure that the model is not affected by the missing indicators. Finally, the masked relationship matrix M masked Calculated by the following formula:
[0163]
[0164] in, Indicates the element-by-element multiplication operation. The masked relation matrix M maskedThis ensures that in the subsequent graph attention layer, the missing indicator features do not affect the update of adjacent nodes, thereby improving the model's adaptability and predictive ability for different patient data patterns.
[0165] Step 2.4, CRD indicator relationship diagram construction
[0166] According to the eigenvector H (0) And the masked relationship matrix M masked , construct a graph-based representation G = (V, E), such as Figure 4 As shown. Node v in the graph i Represents the CRD indicator, edge e ij Then M masked The corresponding element representation of .
[0167] Step 3: Graph Attention Feature Extraction
[0168] The graph attention feature extraction module achieves deep feature extraction through multiple stacked graph attention layers, thereby enhancing the model's understanding of different types of indicators, especially the weakly correlated CRD indicators. In addition, a graph attention layer with a variable number of nodes is introduced. The graph attention layer focuses on node fusion through subgraph partitioning, thereby capturing global structure and effectively compressing information.
[0169] Step 3.1, graph attention calculation
[0170] In a graph attention network, information propagation is achieved through graph convolutional layers. Each node is updated based on the information of its neighbors, capturing the relationships between nodes and the deep structure of the network. This section uses the graph attention computation at layer p+1 as an example to explain this process.
[0171] The input feature of the p+1 layer is H (p) =[h1 (p) ,h2 (p) ,…,h N (P) ], where each For node v i The feature representation of d (p) is the dimension of the node feature vector. The output of this layer is H (p+1) =[h1 (p+1) ,h2 (p+1) ,…,h N (p +1) ], each of which Then use a shared weight matrix Map the input features to a higher or equal dimensional space d (p+1) .
[0172] Each node vi Its adjacent node v j The attention coefficient α between ij It is calculated through the graph attention mechanism, which uses a simple feed-forward network and a weight vector The specific attention coefficient is calculated as follows:
[0173]
[0174] Where LeakyReLU(·) is the activation function, || represents the row connection operation, and j∈(1,2,…,N). ij is the mask matrix M masked The elements in V i is the node v i The set of adjacent nodes. The output feature of each node is the weighted sum of the features of its adjacent nodes, and the weight is determined by the attention coefficient α ik Decide:
[0175]
[0176] Here σ(·) is the ReLU(·) activation function, which represents a nonlinear transformation.
[0177] Step 3.2, subgraph partitioning
[0178] In order to further improve the efficiency and accuracy of graph neural networks, a node fusion strategy based on edge pruning is designed to extract more relevant local information by dividing the subgraph, such as Figure 5 As shown. First, each edge (i, j) in the graph is evaluated according to the preset attention coefficient threshold τ. If the edge attention coefficient α ij If it is less than the threshold τ, the edge is removed from the graph to form an edge cut set S τ ={(i,j)∈E||α ij <τ}. Remove all τ After adding the edges in, we get the graph G′=(V,E′), where E ′ =E / S τ This process will be G ′ Divide into K subgraphs G1, G2, ..., G K , where each subgraph G k =(V k ,E k ) contains a group of nodes with strong correlation. The node set in each subgraph Indicates a CRD metric with high correlation, and the correlation between subgraphs is weak.
[0179] The node features of each subgraph are then aggregated by averaging the features of all nodes in the subgraph:
[0180]
[0181] In this way, the node features in the subgraph are compressed and the information becomes richer. Then, these aggregated node features will also pass through the graph attention layer, but in this process they are no longer affected by the original relationship matrix M. r Constraints are set, and all edges between nodes are allowed to be established. Finally, the output of this layer is the updated node feature set H (P+1) =[h1 (P+1) ,h2 (P+1) ,…,h K (P+1) ], each of which
[0182] Step 4: Prediction network and model training
[0183] Figure 6 The feature vector of CRD patients is extracted by L=P+Q+1 layer graph attention feature to obtain vector H (L) , and then input into the prediction network process. The structure of the prediction network depends on the specific target task. The training of this model needs to be divided into two parts: pre-training and formal training, such as Figure 7 shown.
[0184] During pre-training, the τ in step 3.2 varies, and the value of τ for each sample depends on the pre-set number of subgraphs, K. Based on the performance metrics of the pre-trained model, a reasonable K value is found for formal training. During formal training, the subgraph partitioning method is based not only on the edge pruning method described above, but also on the following three medical principles based on CRD phenotypes:
[0185] (1) Indicators in the same category usually exhibit redundancy due to high correlation and are grouped in the same subgraph.
[0186] (2) Indicators from the same type of test may collectively represent specific symptoms, showing strong interconnectedness.
[0187] (3) There may also be correlations between indicators across categories.
[0188] According to this criterion and the obtained pre-training model, the specific formal training subgraph partitioning algorithm is as follows:
[0189] Algorithm 1: Formal training of subgraph partitioning algorithm.
[0190] Input: pre-trained model, validation set V, N CRD indicators, medical guidelines P med ;
[0191] Output: A set C containing K indicator setsK (nodes of K subgraphs);
[0192] Step 1: Collect all subgraph node sets generated by the pre-trained model in the validation set V;
[0193] Step 2: Arrange these node sets in ascending order of frequency of occurrence and form a set S;
[0194] Step 3: Initialize the empty set C K ;
[0195] Step 4: For each s in S, perform the following operations:
[0196] if but:
[0197] ① If all indicators in s have not yet appeared in C K and s satisfies P med , then add s to C K middle;
[0198] ② Otherwise, if s is C K A superset of the existing elements in and s satisfies P med , then replace the element with s;
[0199] Step 5: For each s in S, perform the following operations:
[0200] If |s|=1 and |C K |≠K, then remove C K The same index as in s, and add s to C K middle;
[0201] Step 6, output C K .
[0202] In formal training, the subgraph partitioning method output by Algorithm 1 is directly used. Both stages of training require calculating the loss function and updating the network parameters until the model converges.
[0203] The feature extraction method for chronic respiratory disease patients based on graph attention network in the disclosed embodiment focuses on optimizing the model's feature learning ability for medical data. It can be widely used in scenarios such as chronic disease prediction, disease classification, and medical risk assessment. The model is more interpretable and provides strong support for clinical decision-making.
[0204] Through the above embodiment, by stacking multiple graph attention layers, deep features can be effectively extracted, especially improving the CRD indicators with weak correlation. Through subgraph partitioning and node fusion strategies, the correlation between indicators is integrated, and it is possible to effectively group highly correlated indicators, enhance the extraction of local information, and reduce redundant connections, thereby improving model efficiency and accuracy. A masking mechanism is used to handle missing data to ensure that the model can still work normally and make effective predictions even when clinical data is missing. This mechanism can prevent missing indicators from affecting the update of adjacent nodes, thereby improving the adaptability of the model to different patient data patterns.
[0205] It should be noted that the method of the embodiments of the present disclosure can be performed by a single device, such as a computer or server. The method of the embodiments of the present disclosure can also be applied in a distributed scenario, where multiple devices cooperate to perform the method. In such a distributed scenario, one of the multiple devices may only perform one or more steps of the method of the embodiments of the present disclosure, and the multiple devices will interact with each other to complete the method.
[0206] It should be noted that the above description is limited to some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in an order different from that described in the above embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0207] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present disclosure also provides a patient feature extraction device based on a graph attention network.
[0208] refer to Figure 9 , the patient feature extraction device based on graph attention network includes:
[0209] An acquisition module 301 is configured to acquire sample data of patients with respiratory diseases and convert the sample data to obtain a data matrix;
[0210] A relationship graph construction module 302 is configured to determine a feature vector and a target relationship matrix based on the indicator features in the data matrix, and to construct a relationship graph based on the feature vector and the target relationship matrix;
[0211] A pre-training module 303 is configured to input the feature vector into an initial graph attention network, prune the relationship graph based on the initial graph attention network to obtain a first subgraph, and pre-train the initial graph attention network based on the first subgraph to obtain an updated graph attention network;
[0212] A formal training module 304 is configured to input the feature vector into the update graph attention network, partition the relationship graph based on the update graph attention network to obtain a second subgraph, and formally train the update graph attention network based on the second subgraph to obtain a target graph attention network;
[0213] The feature extraction module 305 is configured to obtain patient data of patients with respiratory diseases, and use the target graph attention network to perform feature extraction processing on the patient data to obtain patient features.
[0214] In some embodiments, the acquisition module 301 includes:
[0215] an acquisition unit configured to acquire sample data of patients with respiratory diseases and divide the sample data into continuous indicator data and categorical indicator data;
[0216] a data processing unit configured to perform normalization processing on the continuous indicator data to obtain continuous indicator features, and to perform encoding processing on the categorical indicator data to obtain categorical indicator features;
[0217] The splicing processing unit is configured to perform splicing processing on the continuous indicator features and the categorical indicator features to obtain a data matrix.
[0218] In some embodiments, the relationship graph construction module 302 includes:
[0219] a feature vector determining unit configured to perform standardization processing on a plurality of indicator features in the data matrix to obtain standard features, and map the standard features to a first preset space to obtain a feature vector;
[0220] an initial relationship matrix construction unit, configured to determine whether any two indicator features in the data matrix have a direct relationship based on prior knowledge to obtain a correlation determination result, and construct an initial relationship matrix based on the correlation determination result;
[0221] a mask processing unit configured to determine missing data from the data matrix, construct a mask matrix based on the missing data, and perform mask processing on the initial relationship matrix based on the mask matrix to obtain a target relationship matrix;
[0222] The relationship graph construction unit is configured to construct nodes of the relationship graph based on the feature vector, construct edges of the relationship graph based on the target relationship matrix, and obtain the relationship graph according to the nodes and the edges.
[0223] In some embodiments, the pre-training module 303 includes:
[0224] an input feature determination unit, configured to input the feature vector into an initial graph attention network, and determine an input feature corresponding to each node in the relationship graph from the feature vector;
[0225] an attention coefficient determining unit, configured to determine adjacent nodes of each node from the relationship graph, and determine an attention coefficient between each node and the adjacent nodes through a graph attention mechanism;
[0226] a relationship graph node updating unit, configured to update input features of all nodes in the relationship graph according to the attention coefficient based on the initial graph attention network to obtain a relationship graph node feature set;
[0227] a subgraph node updating unit configured to prune the relationship graph according to the attention coefficient to obtain a first subgraph, determine subgraph node features of all nodes in the first subgraph from the relationship graph node feature set, and update the subgraph node features based on the graph attention network to obtain a first subgraph node feature set;
[0228] The first network updating unit is configured to update the model parameters of the initial graph attention network based on the first subgraph node feature set to obtain an updated graph attention network.
[0229] In some embodiments, the attention coefficient determination unit includes:
[0230] an adjacent node determination subunit, configured to determine, for each target node in the target node, an adjacent node of the target node;
[0231] an attention coefficient determination subunit, configured to determine the attention coefficient between the target node and the adjacent node through a graph attention mechanism,
[0232]
[0233] Among them, α ij is the attention coefficient between the i-th target node and the j-th adjacent node, LeakyReLU(·) is the activation function, || represents the row connection operation, a is the weight vector, W is the shared weight matrix, and h i (p) is the input feature of the i-th target node of the p+1-th graph attention layer, hj (p) is the input feature of the jth adjacent node of the p+1th graph attention layer, h n (p) is the input feature of the nth adjacent node of the p+1th graph attention layer, m ij is the element in the mask matrix, V i is the set of adjacent nodes consisting of all adjacent nodes of the i-th target node, v k is the kth adjacent node in the set of adjacent nodes.
[0234] In some embodiments, the relationship graph node updating unit includes:
[0235] The relationship graph node updating subunit is configured to update the input features of each node in the relationship graph according to the attention coefficient based on the initial graph attention network to obtain corresponding relationship graph node features,
[0236]
[0237] Among them, h i (p+1) is the feature of the i-th graph node in the p+1-th graph attention layer, σ(·) is the ReLU(·) activation function, and α ij is the attention coefficient between the i-th target node and the j-th adjacent node, W is the shared weight matrix, h n (p) is the input feature of the nth adjacent node of the p+1th graph attention layer, V i is the set of adjacent nodes consisting of all adjacent nodes of the i-th target node, v k is the kth adjacent node in the set of adjacent nodes;
[0238] The combining subunit is configured to combine the relationship graph node features of all nodes in the relationship graph to obtain a relationship graph node feature set,
[0239] H (p+1) =[h1 (p+1) ,h2 (p+1) ,…,h N (p+1) ]
[0240] Among them, H (p+1) is the feature set of the graph nodes in the p+1th graph attention layer, h N (p+1) It is the Nth relationship graph node feature of the p+1th graph attention layer.
[0241] In some embodiments, the subgraph node updating unit includes:
[0242] a comparison processing subunit, configured to compare, for each target node in the nodes, an attention coefficient between the target node and an adjacent node with a preset attention coefficient threshold;
[0243] a first subgraph determining subunit, configured to, in response to determining that the attention coefficient is less than a preset attention coefficient threshold, remove a target edge between the target node and the adjacent node in the relationship graph to obtain a first subgraph;
[0244] a subgraph node feature determination subunit, configured to determine subgraph node features of all nodes in the first subgraph from the relationship graph node feature set;
[0245] The aggregation processing subunit is configured to aggregate the subgraph node features to obtain aggregate node features,
[0246]
[0247] Among them, h k (P) is the aggregate node feature of the k subgraph node features of the P-th graph attention layer, h i (P) is the feature of the ith subgraph node in the Pth graph attention layer, V k is the set of k subgraph nodes in the P-th graph attention layer, v i is the i-th subgraph node of the P-th graph attention layer;
[0248] The subgraph node updating subunit is configured to update the aggregated node features using the graph attention network to obtain a first subgraph node feature set,
[0249] H (P+1) =[h1 (P+1) ,h2 (P+1) ,…,h K (P+1) ]
[0250] Among them, H (P+1) is the first subgraph node feature set of the P+1th graph attention layer, h K (P+1) is the kth aggregate node feature in the P+1th graph attention layer.
[0251] In some embodiments, the formal training module 304 includes:
[0252] a subgraph number determining unit, configured to input the feature vector into the update graph attention network and determine the number of subgraphs according to a preset attention coefficient threshold;
[0253] a second subgraph division unit configured to divide the relationship graph according to the number of subgraphs to obtain second subgraphs, and sort the second subgraph node feature sets of the second subgraphs according to the frequency of occurrence;
[0254] a second subgraph node determination unit configured to determine, for each second subgraph node in the second subgraph node feature set, whether the second subgraph node is in the initialization set;
[0255] a first update set determining unit configured to, in response to determining that the second subgraph node is not in the initialization set and the second subgraph node meets a preset criterion, add the second subgraph node to the initialization set to obtain an update set; or
[0256] A second update set determining unit is configured to, in response to determining that the second subgraph node is in the initialization set and the second subgraph node meets a preset criterion, replace the corresponding element in the initialization set with the second subgraph node to obtain an update set;
[0257] The second network updating unit is configured to update the model parameters of the updated graph attention network based on the update set to obtain a target graph attention network.
[0258] For the convenience of description, the above devices are described as being functionally divided into various modules. Of course, when implementing the present disclosure, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0259] The device of the above embodiment is used to implement the corresponding patient feature extraction method based on graph attention network in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0260] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor, wherein when the processor executes the program, the patient feature extraction method based on the graph attention network described in any of the above embodiments is implemented.
[0261] Figure 10 10 is a schematic diagram showing a more specific hardware structure of an electronic device provided in this embodiment. The device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are communicatively connected to each other within the device via the bus 1050.
[0262] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0263] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage devices, dynamic storage devices, etc. The memory 1020 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0264] The input / output interface 1030 is used to connect input / output modules to implement information input and output. The input / output modules can be configured as components within the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. Input devices may include a keyboard, mouse, touch screen, microphone, various sensors, etc., and output devices may include a display, speaker, vibrator, indicator light, etc.
[0265] The communication interface 1040 is used to connect to a communication module (not shown) to enable communication between the device and other devices. The communication module can communicate via a wired method (e.g., USB (Universal Serial Bus), network cable, etc.) or a wireless method (e.g., mobile network, WIFI (Wireless Fidelity), Bluetooth, etc.).
[0266] The bus 1050 comprises a path for transmitting information between the various components of the device (eg, the processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 ).
[0267] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, it will be understood by those skilled in the art that the above device may only include the components necessary to implement the embodiments of this specification, and does not necessarily include all the components shown in the figure.
[0268] The electronic device of the above embodiment is used to implement the corresponding patient feature extraction method based on graph attention network in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0269] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present disclosure also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the patient feature extraction method based on the graph attention network as described in any of the above embodiments.
[0270] The computer-readable media of this embodiment include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0271] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the patient feature extraction method based on the graph attention network as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0272] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a computer program product, including computer program instructions. When the computer program instructions are run on a computer, the computer executes the patient feature extraction method based on the graph attention network as described in any of the above embodiments, which has the beneficial effects of the corresponding method embodiments and will not be repeated here.
[0273] It is understandable that before using the technical solutions of each embodiment of the present disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved will be informed to the user in an appropriate manner, and the user's authorization will be obtained.
[0274] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operation of the disclosed technical solution based on the prompt message.
[0275] As an optional but non-limiting implementation, in response to a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0276] It is understandable that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0277] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure is limited to these examples. Based on the concept of the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of simplicity.
[0278] In addition, to simplify the description and discussion, and so as not to obscure the embodiments of the present disclosure, known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, devices may be shown in the form of block diagrams to avoid obscuring the embodiments of the present disclosure, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present disclosure are to be implemented (i.e., these details should be fully within the purview of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it will be apparent to those skilled in the art that the embodiments of the present disclosure may be implemented without these specific details or with variations in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0279] Although the present disclosure has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those skilled in the art based on the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0280] The embodiments of the present disclosure are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the present disclosure. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present disclosure should be included in the scope of protection of the present disclosure.
Claims
1. A patient feature extraction method based on graph attention network, characterized in that: The method comprises: Obtaining sample data of patients with respiratory diseases, and converting the sample data to obtain a data matrix; Determine a characteristic vector and a target relationship matrix based on the indicator features in the data matrix, and construct a relationship graph based on the characteristic vector and the target relationship matrix; Inputting the feature vector into an initial graph attention network, pruning the relationship graph based on the initial graph attention network to obtain a first subgraph, and pre-training the initial graph attention network based on the first subgraph to obtain an updated graph attention network; Inputting the feature vector into the update graph attention network, dividing the relationship graph based on the update graph attention network to obtain a second subgraph, and formally training the update graph attention network based on the second subgraph to obtain a target graph attention network; Acquire patient data of patients with respiratory diseases, and use the target graph attention network to perform feature extraction processing on the patient data to obtain patient features.
2. The method according to claim 1, characterized in that The step of obtaining sample data of patients with respiratory diseases and converting the sample data to obtain a data matrix includes: Acquire sample data of patients with respiratory diseases, and divide the sample data into continuous indicator data and categorical indicator data; Normalizing the continuous indicator data to obtain continuous indicator features, and encoding the categorical indicator data to obtain categorical indicator features; The continuous indicator features and the categorical indicator features are concatenated to obtain a data matrix.
3. The method according to claim 1, characterized in that The determining of a characteristic vector and a target relationship matrix based on the indicator features in the data matrix, and constructing a relationship graph based on the characteristic vector and the target relationship matrix, includes: Standardizing the plurality of indicator features in the data matrix to obtain standard features, and mapping the standard features to a first preset space to obtain a feature vector; Based on prior knowledge, it is determined whether any two indicator features in the data matrix have a direct relationship to obtain a correlation determination result, and an initial relationship matrix is constructed based on the correlation determination result; Determining missing data from the data matrix, constructing a mask matrix based on the missing data, and performing masking processing on the initial relationship matrix based on the mask matrix to obtain a target relationship matrix; Nodes of a relationship graph are constructed based on the feature vectors, edges of the relationship graph are constructed based on the target relationship matrix, and a relationship graph is obtained according to the nodes and the edges.
4. The method according to claim 1, wherein The step of inputting the feature vector into an initial graph attention network, pruning the relationship graph based on the initial graph attention network to obtain a first subgraph, and pre-training the initial graph attention network based on the first subgraph to obtain an updated graph attention network includes: Inputting the feature vector into an initial graph attention network, and determining the input features corresponding to each node in the relationship graph from the feature vector; Determining adjacent nodes of each node from the relationship graph, and determining an attention coefficient between each node and the adjacent nodes through a graph attention mechanism; Based on the initial graph attention network, updating the input features of all nodes in the relationship graph according to the attention coefficient to obtain a relationship graph node feature set; Pruning the relationship graph according to the attention coefficient to obtain a first subgraph, determining subgraph node features of all nodes in the first subgraph from the relationship graph node feature set, and updating the subgraph node features based on the graph attention network to obtain a first subgraph node feature set; The model parameters of the initial graph attention network are updated based on the first subgraph node feature set to obtain an updated graph attention network.
5. The method according to claim 4, characterized in that The step of determining the adjacent nodes of each node from the relationship graph, and determining the attention coefficient between each node and the adjacent nodes through a graph attention mechanism, includes: For a target node in each of the nodes, determining an adjacent node of the target node; Determine the attention coefficient between the target node and the adjacent nodes through the graph attention mechanism, Among them, α ij is the attention coefficient between the i-th target node and the j-th adjacent node, LeakyReLU(·) is the activation function, || represents the row connection operation, a is the weight vector, W is the shared weight matrix, and h i (p) is the input feature of the i-th target node of the p+1-th graph attention layer, h j (p) is the input feature of the jth adjacent node of the p+1th graph attention layer, h n (p) is the input feature of the nth adjacent node of the p+1th graph attention layer, m ij is the element in the mask matrix, V i is the set of adjacent nodes consisting of all adjacent nodes of the i-th target node, v k is the kth adjacent node in the set of adjacent nodes.
6. The method according to claim 4, characterized in that The initial graph attention network is based on the attention coefficient, and the input features of all nodes in the relationship graph are updated to obtain a relationship graph node feature set, including: Based on the initial graph attention network, the input features of each node in the relationship graph are updated according to the attention coefficient to obtain the corresponding relationship graph node features, Among them, h i (p+1) is the feature of the i-th graph node in the p+1-th graph attention layer, σ(·) is the ReLU(·) activation function, and α ij is the attention coefficient between the i-th target node and the j-th adjacent node, W is the shared weight matrix, h n (p) is the input feature of the nth adjacent node of the p+1th graph attention layer, V i is the set of adjacent nodes consisting of all adjacent nodes of the i-th target node, v k is the kth adjacent node in the set of adjacent nodes; Combining the relationship graph node features of all nodes in the relationship graph to obtain a relationship graph node feature set, H (p+1) =[h1 (p+1) ,h2 (p+1) ,…,h N (p+1) ] Among them, H (p+1) is the feature set of the graph nodes in the p+1th graph attention layer, h N (p+1) It is the Nth relationship graph node feature of the p+1th graph attention layer.
7. The method according to claim 4, characterized in that The pruning of the relationship graph according to the attention coefficient to obtain a first subgraph, determining subgraph node features of all nodes in the first subgraph from the relationship graph node feature set, and updating the subgraph node features based on the graph attention network to obtain a subgraph node feature set, including: For the target node in each node, the attention coefficient between the target node and the adjacent node is compared with a preset attention coefficient threshold; In response to determining that the attention coefficient is less than a preset attention coefficient threshold, removing the target edge between the target node and the adjacent node in the relationship graph to obtain a first subgraph; Determining subgraph node features of all nodes in the first subgraph from the relationship graph node feature set; Aggregate the subgraph node features to obtain aggregate node features, Among them, h k (P) is the aggregate node feature of the k subgraph node features of the P-th graph attention layer, h i (P) is the feature of the ith subgraph node in the Pth graph attention layer, V k is the set of k subgraph nodes in the P-th graph attention layer, v i is the i-th subgraph node of the P-th graph attention layer; The graph attention network is used to update the aggregate node features to obtain a first subgraph node feature set. H (P+1) =[h1 (P+1) ,h2 (P+1) ,…,h K (P+1) ] Among them, H (P+1) is the first subgraph node feature set of the P+1th graph attention layer, h K (P+1) is the kth aggregate node feature in the P+1th graph attention layer.
8. The method according to claim 1, characterized in that The step of inputting the feature vector into the update graph attention network, dividing the relationship graph based on the update graph attention network to obtain a second subgraph, and formally training the update graph attention network based on the second subgraph to obtain a target graph attention network includes: Inputting the feature vector into the updated graph attention network, and determining the number of subgraphs according to a preset attention coefficient threshold; Dividing the relationship graph according to the number of subgraphs to obtain a second subgraph, and sorting the second subgraph node feature sets of the second subgraph according to the frequency of occurrence; For each second subgraph node in the second subgraph node feature set, determining whether the second subgraph node is in the initialization set; In response to determining that the second subgraph node is not in the initialization set and the second subgraph node meets a preset criterion, adding the second subgraph node to the initialization set to obtain an updated set; or, In response to determining that the second subgraph node is in the initialization set and the second subgraph node meets a preset criterion, replacing a corresponding element in the initialization set with the second subgraph node to obtain an updated set; The model parameters of the updated graph attention network are updated based on the update set to obtain a target graph attention network.
9. A patient feature extraction device based on graph attention network, characterized in that: include: an acquisition module configured to acquire sample data of patients with respiratory diseases and convert the sample data to obtain a data matrix; a relationship graph construction module, configured to determine a feature vector and a target relationship matrix based on the indicator features in the data matrix, and to construct a relationship graph based on the feature vector and the target relationship matrix; a pre-training module configured to input the feature vector into an initial graph attention network, prune the relationship graph based on the initial graph attention network to obtain a first subgraph, and pre-train the initial graph attention network based on the first subgraph to obtain an updated graph attention network; a formal training module configured to input the feature vector into the update graph attention network, partition the relationship graph based on the update graph attention network to obtain a second subgraph, and formally train the update graph attention network based on the second subgraph to obtain a target graph attention network; The feature extraction module is configured to obtain patient data of patients with respiratory diseases and use the target graph attention network to perform feature extraction processing on the patient data to obtain patient features.
10. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and running on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 8 is implemented.