A portrait matching and recommendation method and device based on hierarchical graph attention mechanism
By combining the hierarchical attention network and the graph attention mechanism, the user portrait matching method is optimized, and the problem of failure to fully utilize edge information in the existing technology is solved, and efficient and accurate user matching and recommendation effects are achieved.
Patent Information
- Application Number
- CN202411220191.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-09-02
AI Technical Summary
The existing graph attention mechanism fails to fully utilize edge information when processing user networks and interactive graphs, resulting in increased computational complexity and storage overhead, and poor performance under large-scale graph structures.
Introduce portrait matching and recommendation methods based on hierarchical map attention mechanism, combine hierarchical attention network and graph attention mechanism to aggregate feature information in each dimension, enhance the feature vectors of patients and caregivers, and use multi-layer perceptrons to perform scoring and prediction. , optimize model training and matching decisions.
It improves the efficiency and accuracy of user portrait matching, reduces the complexity and overhead of the system, meets the efficient care needs in medical scenarios, and achieves a 60% efficiency improvement.
Smart Images

Figure CN118737415B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of computer science and technology and software engineering, and in particular to a portrait matching and recommendation method and device based on a hierarchical graph attention mechanism. Background Art
[0002] Recommendation systems are a type of program and application that provides personalized services to users. It builds a user profile based on the user's basic information, interaction history, behavior records and other data, infers the user's interests, and provides candidate items that may suit the user's preferences. Among them, "item" can refer to anything recommended to the user, and the meaning is different in different scenarios. For example, a product, a movie, a piece of music, and a piece of news can all be called a "item" in their respective recommendation fields. Usually, recommendation systems need to solve two problems: rating prediction and Top-N recommendation. As the name suggests, rating prediction is to use the target user's historical rating data on the project to train the corresponding model to predict the user's rating of the new project. Top-N recommendation is to display the top N projects that the target user may be interested in for selection.
[0003] User portrait is a comprehensive description of users in an application or system. In other words, computers can fully define each individual through user portraits, so as to provide personalized services such as product recommendations and information retrieval. As early as the 1970s, related research already existed. In the late 1990s and early 21st century, the emergence of e-commerce has made network personalization gain widespread attention. Whether it is possible to tailor product supply and advertising push for users based on user browsing data, purchase history and other information has become the key to success. Traditional large-scale marketing has gradually shifted to personalized "one-to-one" services. After entering 2010, hot topics such as "data mining", "machine learning" and "deep learning" have attracted much attention, so many works are exploring how to apply them well to user portraits.
[0004] The idea most closely related to this method is to use the graph attention mechanism (GAT), which mainly processes graph structure data, such as user networks, interaction graphs, etc. It pays different degrees of attention to the embedding sequence of the input nodes, allowing the model to focus on some more important features, thereby enhancing its ability to capture and understand complex patterns in the data. However, GAT does not make full use of the information of the edges, but only considers the connectivity, and because GAT needs to aggregate the information of all neighbor nodes, when the graph scale is large, the computational complexity and storage overhead will increase. Summary of the invention
[0005] The purpose of the present invention is to address the deficiencies of the prior art and provide a portrait matching and recommendation method and device based on a hierarchical graph attention mechanism.
[0006] The object of the present invention is to achieve the following technical solution: a portrait matching and recommendation method based on a hierarchical graph attention mechanism, comprising the following steps:
[0007] (1) Based on the patient's public health information and the nursing care platform data, the patient data and the nursing data are obtained, and the patient data and the nursing data are preprocessed respectively to obtain the preprocessed patient data and the preprocessed nursing data;
[0008] (2) Based on the pre-processed patient data and pre-processed nursing staff data, by mining the hierarchical relationship of the features of each dimension of patients and nursing staff, a hierarchical attention network is introduced to aggregate the information of the features of each dimension, realize the embedding of the portraits of patients and nursing staff, and obtain the hierarchically processed patient data and hierarchically processed nursing staff data;
[0009] (3) Introducing the graph attention mechanism, the hierarchically processed patient data and the hierarchically processed caregiver data are enhanced to obtain the enhanced patient feature vector and the enhanced caregiver feature vector;
[0010] (4) Based on the enhanced patient feature vector and the enhanced caregiver feature vector, a multi-layer perceptron is introduced to calculate the prediction score matrix;
[0011] (5) Based on the patient's public health information and the nursing care platform data, the real score matrix of the preprocessed patient data and the preprocessed nursing data is obtained; and the predicted score matrix and the real score matrix are updated through back propagation to obtain the optimal model;
[0012] (6) Perform portrait matching on the patient data to be predicted and the caregiver data to be predicted. Repeat steps (1) to (4) based on the optimal model to obtain a prediction score matrix for the patient and caregiver data to be predicted. Use the prediction score matrix to make decisions for the two-way matching of patients and caregivers.
[0013] Furthermore, the step (1) specifically includes the following sub-steps:
[0014] (1.1) Obtain patient data from patient public health information : ,in, represents the number of patients, Indicates feature set of each patient; All have Patient characteristics: ,in, Indicates The patient's The characteristic value of each patient characteristic;
[0015] Obtain nursing data from nursing care platform data : ,in, Indicates the number of care workers, Indicates feature set of a caregiver; each feature set All have Characteristics of a caregiver: ,in, Indicates The first The characteristic value of each caregiver characteristic;
[0016] (1.2) Patient data and nursing staff data Perform preprocessing, which includes: cleaning, missing value detection, filling, and normalization to obtain preprocessed patient data and preprocessed nursing data .
[0017] Furthermore, the sub-step (1.2) specifically includes the following sub-steps:
[0018] (1.2.1) First, the patient data and nursing staff data Perform cleaning to obtain cleaned patient data And the cleaned nursing data , the cleaning process specifically includes:
[0019] a.1) For patient data and nursing staff data Among the repeated feature sets, only one feature set is retained and the rest of the repeated feature sets are cleared;
[0020] a.2) For patient data and nursing staff data For features of string type, remove the spaces at the beginning and end of the feature;
[0021] a.3) Use regular expressions to verify patient data and nursing staff data Check whether the format of ID number, mobile phone number and email address is correct, and correct any incorrect features;
[0022] (1.2.2) Then clean the patient data And the cleaned nursing data Perform missing value processing to obtain patient data after missing value processing And the missing care worker data ;
[0023] The sub-step (1.2.2) specifically includes the following sub-steps:
[0024] b.1) Detect missing values on the cleaned patient data And the cleaned nursing data Count the missing values in to get the number of missing patient characteristics 、The number of missing nursing staff features , the number of patients with missing features and ,in, Indicates The number of patient characteristics missing for each patient, Indicates The number of missing caregiver features for each caregiver, Indicates missing Number of patients with each patient characteristic, Indicates missing The number of caregivers with each caregiver’s characteristics;
[0025] b.2) First, No. patients and No. The feature set of each caregiver is deleted, and then No. Patient characteristics and No. The characteristics of each nurse are deleted to obtain the patient data after missing processing And the missing care worker data ;
[0026] (1.2.3) Then, the missing patient data were processed separately And the missing care worker data Each feature set in is filled to obtain the filled patient data : And the filled caregiver data : ;in, represents the number of patients, Indicates The characteristics of each patient, Indicates the number of care workers, Indicates feature set of a caregiver; each feature set All have Patient characteristics: ,in, Indicates The patient's patient characteristics; each characteristic set All have Characteristics of a caregiver: ,in, Indicates The first Characteristics of individual caregivers;
[0027] (1.2.4) Finally, the filled patient data And the filled caregiver data Perform normalization to obtain preprocessed patient data and preprocessed nursing data ;
[0028] The sub-step (1.2.4) specifically includes the following sub-steps:
[0029] c.1) First, for the filled patient data Any patient characteristic After normalization, all patients were obtained The mean of the patient characteristics and standard deviation , the calculation formula is: and ; and through the mean and standard deviation , get the normalized patient characteristics : ;
[0030] For populated patient data Each patient characteristic Repeat the above steps to obtain the preprocessed patient data ;
[0031] c.2) Secondly, for the filled nursing data Any one of the caregiver characteristics After normalization, we can get the The mean of the caregiver characteristics and standard deviation , the calculation formula is: ;and ; and through the mean and standard deviation , get the normalized care worker features : ;
[0032] For the filled nursing data Each caregiver characteristic Repeat the above steps to obtain the preprocessed nursing data .
[0033] Furthermore, the step (2) specifically includes the following sub-steps:
[0034] (2.1) Preprocessed patient data middle The patient characteristics are divided into word typical and numerical types, and the patient word typical feature set is obtained. and patient numerical feature set ,in, , represents the number of typical patient characteristics, Represents the number of numerical patient features; and the preprocessed nursing data middle The features of the nurses are divided into word typical and numerical types, and the typical feature set of the nurses is obtained. and the caregiver numerical feature set ,in, , The number of typical caregiver features of the word, Indicates the number of numeric caregiver characteristics;
[0035] According to the above classification, the pre-processed patient data Typical patient data divided into words and numerical patient data , and the pre-processed nursing data Typical nursing data divided into words and numerical nursing data ;
[0036] Typical patient data for words Typical patient characteristics in each word The corresponding feature values of all patients are removed to obtain the corresponding value range , the value range size is ,use Such index values replace the typical patient data Patient characteristics The corresponding characteristic values of all patients are obtained to obtain the typical patient data after discretization ;
[0037] Typical nursing data for words Typical nursing characteristics of each word The corresponding characteristic values of all caregivers are deduplicated to obtain the corresponding value range , the value range size is ,use Such index value replacement word typical caregiver data Characteristics of middle school nurses The corresponding eigenvalues of all caregivers are obtained to obtain the typical caregiver data after discretization ;
[0038] In order to uniformly initialize the features of each dimension to dimensional vector space, respectively, the discretized word typical patient data , Numerical patient data , discretized characters, typical nursing data and numerical nursing data Perform a linear transformation to obtain typical patient data after a linear transformation , numerical patient data after a linear transformation , Typical nursing data after a linear transformation and the numerical nursing data after a linear transformation ,Right now: ; ; ; ;
[0039] in, , , and are weight matrices respectively; , , and are bias weights respectively;
[0040] Typical patient data after a linear transformation for Matrix, numerical patient data after a linear transformation for The matrix of a linear transformation is a typical nursing data for Matrix, numerical nursing data after a linear transformation for Matrix of
[0041] Then, after activation by the LeakyReLU function, the linearly transformed word is converted into a typical patient data. And the numerical patient data after a linear transformation exist The initialized patient data is obtained by splicing in the dimension , the initialized patient data for The matrix of the typical nursing data after a linear transformation and the numerical nursing data after a linear transformation exist The initialized nursing data is obtained by splicing on the dimension of , the initialized caregiver data for Matrix of
[0042] (2.2) For initialized patient data , divided into three layers, from bottom to top , and It indicates that, is the top layer, which contains only one patient node; It is the middle layer, and the nodes it contains are the top-level nodes. The child node of The parent node of several nodes; is the bottom layer, each node contained in it is The patient characteristics correspond one to one, and their size satisfies ;
[0043] For initialized nursing data , divided into three layers, from bottom to top , and It indicates that, It is the top layer, which contains only one caregiver node; It is the middle layer, and the nodes it contains are the top-level nodes. The child node of The parent node of several nodes; is the bottom layer, each node contained in it is The characteristics of each caregiver correspond to each other, and their size satisfies ;
[0044] (2.3) Construct a patient-level attention network consisting of two layers of hierarchical attention network layers and and build a caregiver hierarchical attention network, which consists of 2 layers of hierarchical attention network layers and composition;
[0045] For the hierarchical attention network layer , input is the initialized patient data , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is , transform to get the transformed patient data : ; Define a size of The parameter matrix , the transformed patient data With parameter matrix Take the element-wise product and sum over the last dimension while retaining that dimension to get the matrix ; After activation by the LeakyReLU function, the matrix implement Independent softmax normalization; after each independent softmax normalization, the softmax normalized matrix With the transformed patient data Do the element-wise product and Summing up and retaining this dimension, we get The size is The tensor will The tensor in Finally, the output matrix is obtained. ;
[0046] For the hierarchical attention network layer , the input is a matrix , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is , transform to get the transformed patient data : ; Define a size of The parameter matrix , the transformed patient data With parameter matrix Take the element-wise product and sum over the last dimension while retaining that dimension to get the matrix ; After activation by the LeakyReLU function, the matrix Perform 1 independent softmax normalization; after independent softmax normalization, the softmax normalized matrix With the transformed patient data Taking the element-wise product, we get , and convert the size of the tensor into , and finally obtain the hierarchically processed patient data ;
[0047] For the hierarchical attention network layer , input is the initialized caregiver data , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is , transform to get the transformed nursing data : ; Define a size of The parameter matrix , the transformed nursing data With parameter matrix Take the element-wise product and sum over the last dimension while retaining that dimension to get the matrix ; After activation by the LeakyReLU function, the matrix implement Independent softmax normalization; after each independent softmax normalization, the softmax normalized matrix With the transformed nursing data Do the element-wise product and Summing up and retaining this dimension, we get The size is The tensor will The tensor in Finally, the output matrix is obtained. ;
[0048] For the hierarchical attention network layer , the input is a matrix , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is , transform to get the transformed nursing data : ; Define a size of The parameter matrix , the transformed nursing data With parameter matrix Take the element-wise product and sum over the last dimension while retaining that dimension to get the matrix ; After activation by the LeakyReLU function, the matrix Perform 1 independent softmax normalization; after independent softmax normalization, the softmax normalized matrix With the transformed nursing data Taking the element-wise product, we get , and convert the size of the tensor into , and finally get the hierarchically processed nursing data .
[0049] Furthermore, the step (3) specifically includes the following sub-steps:
[0050] (3.1) Patient data after hierarchical processing , get the patient map The patient's picture Contains nodes, each node represents a patient. Patient Nodes The embedding of : ; Also contains edges, each edge , which means that there is a path from the starting node Point to the end node The edge of , Patient diagram Middle The starting node of the edge, starting node Corresponding to the initialized patient data Middle Patient nodes, Patient diagram Middle The end node of the edge, the end node Corresponding to the initialized patient data Middle patient nodes; thus obtaining the patient starting node set and the patient terminal node set ;
[0051] Caregiver data after hierarchical processing , get the care worker map ; The nursing worker diagram Contains nodes, each node represents a caregiver, Nursing Node The embedding of : ; Also contains edges, each edge , which means that there is a path from the starting node Point to the end node The edge of , Represents a nursing worker diagram Middle The starting node of the edge, starting node Corresponding to the initialized nursing data Middle Nursing nodes, Represents a nursing worker diagram Middle The end node of the edge, the end node Corresponding to the initialized nursing data Middle Caregiver nodes; thus obtaining the caregiver starting node set and the set of caregiver termination nodes ;
[0052] (3.2) Construct a patient graph attention network consisting of two graph attention layers and and build a caregiver graph attention network, which consists of 2 layers of graph attention layers and composition;
[0053] For the graph attention layer , the input is the patient data after hierarchical processing , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is ,in, Representation graph attention layer The number of attention heads included, transformed to obtain the transformed patient data : ; Then define the size of The parameter matrix and the parameter matrix ; The parameter matrix and the parameter matrix Respectively with the transformed patient data Do the element-wise product and sum it over the last dimension to get the result and results ,result The values in represent the attention scores of each attention head generated on the edge when each patient node is used as the starting node. The value in represents the attention score of each attention head generated on the edge when each patient node is used as the terminal node; according to the patient starting node set The order of the transformed patient data is and results The tensor corresponding to the index forms a new matrix and matrix : , where the matrix Middle Tensor The transformed patient data Middle Tensors, matrices The size is ; , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is ; According to the patient termination node set The order of results The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is ; Then the matrix With the matrix Add and activate with LeakyReLU function to get the matrix ,in, Representation Matrix Middle tensors; create a tensor of size The all-zero matrix , and the matrix Middle Tensor Add to all zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle Tensors; terminal node set according to the patient The order from the matrix The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the matrix Middle tensor; then the edge Perform softmax normalization calculation to obtain any edge attention : ; Get patient image The attention set ; The matrix With patient diagram The attention set Perform element-wise product and get a size of The matrix ; Then create a size of The all-zero matrix ; Sequentially transform the matrix Middle tensors added to an all-zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle tensors; then the matrix Each attention The end-to-end concatenation of the dimensional embedding finally results in the graph attention layer. Output ;
[0054] For the graph attention layer , the input is a matrix , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is ,in, Representation graph attention layer The number of attention heads included, transformed to obtain the transformed patient data : ; Then define the size of The parameter matrix and the parameter matrix ; The parameter matrix and the parameter matrix Respectively with the transformed patient data Do the element-wise product and sum it over the last dimension to get the result and results ,result The values in represent the attention scores of each attention head generated on the edge when each patient node is used as the starting node. The value in represents the attention score of each attention head generated on the edge when each patient node is used as the terminal node; according to the patient starting node set The order of the transformed patient data is and results The tensor corresponding to the index forms a new matrix and matrix : , where the matrix Middle Tensor The transformed patient data Middle Tensors, matrices The size is ; , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is ; According to the patient termination node set The order of results The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is ; Then the matrix With the matrix Add and activate with LeakyReLU function to get the matrix ,in, Representation Matrix Middle tensors; create a tensor of size The all-zero matrix , and the matrix Middle Tensor Add to all zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle Tensors; terminal node set according to the patient The order from the matrix The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the matrix Middle tensor; then the edge Perform softmax normalization calculation to obtain any edge attention : ; Get patient image The attention set ; The matrix With patient diagram The attention set Perform element-wise product and get a size of The matrix ; Then create a size of The all-zero matrix ; Sequentially transform the matrix Middle tensors added to an all-zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle tensors; then the matrix Each attention The average of the dimensional embedding is The enhanced patient feature vector As a graph attention layer The output of , Representation Matrix Middle tensor;
[0055] For the graph attention layer , the input is the hierarchical processed nursing data , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is ,in, Representation graph attention layer The number of attention heads included, transformed to obtain the transformed caregiver data : ; Then define the size of The parameter matrix and the parameter matrix ; The parameter matrix and the parameter matrix Respectively with the transformed nursing data Do the element-wise product and sum it over the last dimension to get the result and results ,result The value in represents the attention score of each attention head generated on the edge when each caregiver node is used as the starting node. The value in represents the attention score of each attention head generated on the edge when each caregiver node is used as the terminal node; according to the caregiver starting node set The order of the transformed nursing data is and results The tensor corresponding to the index forms a new matrix and matrix : , where the matrix Middle Tensor The transformed nursing data Middle Tensors, matrices The size is ; , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is ; According to the caregiver termination node set The order of results The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is ; Then the matrix With the matrix Add and activate with LeakyReLU function to get the matrix ,in, Representation Matrix Middle tensors; create a tensor of size The all-zero matrix , and the matrix Middle Tensor Add to all zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle Tensor; according to the caregiver termination node set The order from the matrix The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the matrix Middle tensors; then the edges Perform softmax normalization calculation to obtain any edge attention : ; Get the care worker map The attention set ; The matrix Illustration with care worker The attention set Perform element-wise product and get a size of The matrix ; Then create a size of The all-zero matrix ; Sequentially transform the matrix Middle tensors added to an all-zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle tensors; then the matrix Each attention The end-to-end concatenation of the dimensional embedding finally results in the graph attention layer. Output ;
[0056] For the graph attention layer , the input is a matrix , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is ,in, Representation graph attention layer The number of attention heads included, transformed to obtain the transformed caregiver data : ; Then define the size of The parameter matrix and the parameter matrix ; The parameter matrix and the parameter matrix Respectively with the transformed nursing data Do the element-wise product and sum it over the last dimension to get the result and results ,result The value in represents the attention score of each attention head generated on the edge when each caregiver node is used as the starting node. The value in represents the attention score of each attention head generated on the edge when each caregiver node is used as the terminal node; according to the caregiver starting node set The order of the transformed nursing data is and results The tensor corresponding to the index forms a new matrix and matrix : , where the matrix Middle Tensor The transformed nursing data Middle Tensors, matrices The size is ; , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is ; Then the matrix With the matrix Add and activate with LeakyReLU function to get the matrix ,in, Representation Matrix Middle tensors; create a tensor of size The all-zero matrix , and the matrix Middle Tensor Add to all zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle Tensor; according to the caregiver termination node set The order from the matrix The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the matrix Middle tensor; then the edge Perform softmax normalization calculation to obtain any edge attention : ; Get the care worker map The attention set ; The matrix Illustration with care worker The attention set Perform element-wise product and get a size of The matrix ; Then create a size of The all-zero matrix ; Sequentially transform the matrix Middle tensors added to an all-zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle tensors; then the matrix Each attention The average of the dimensional embedding is The enhanced caregiver feature vector As a graph attention layer The output of , Representation Matrix Middle A tensor.
[0057] Furthermore, the step (4) specifically includes the following sub-steps:
[0058] (4.1) Through the enhanced patient feature vector Constructing a new matrix :
[0059] ;
[0060] And through the enhanced caregiver feature vector Constructing a new matrix : ;
[0061] Then the matrix and matrix Concatenate on the last dimension to get the training data ;
[0062] (4.2) Construct a 2-layer multi-layer perceptron, using and express;
[0063] For multi-layer perceptron , input is training data , perform linear transformation, output matrix : ,in, is the weight matrix, is the bias weight, is the activation function;
[0064] For multi-layer perceptron , the input is a matrix , perform linear transformation and output the predicted score matrix : ,in, , is the weight matrix, is the bias weight.
[0065] Furthermore, the step (5) specifically includes the following sub-steps:
[0066] (5.1) Obtain a true scoring matrix based on patient public health information and nursing care platform data : ,in, Indicates Patients Ratings of individual caregivers;
[0067] (5.2) The predicted score matrix and the true rating matrix Calculate the mean square error and get the total loss : ,in, Represents the prediction score matrix Middle Prediction scores, Represents the rating matrix Middle Ratings;
[0068] Based on total loss Update the weight matrix , , , , , , , , , , , , and , bias weight , , , , and And the parameter matrix , , , , , , , , , , and , while recording the total loss The state of the entire network at the minimum is saved as the optimal model.
[0069] The present invention also provides a portrait matching and recommendation device based on a hierarchical graph attention mechanism, the device comprising: a preprocessing module, a portrait embedding module, an enhancement module, a rating prediction module, a training module and a recommendation module;
[0070] The preprocessing module is used to obtain patient data and nursing data based on the patient's public health information and nursing care platform data, and preprocess the patient data and nursing data respectively to obtain preprocessed patient data and preprocessed nursing data;
[0071] The portrait embedding module is used to mine the hierarchical relationship of the features of each dimension of patients and nurses according to the pre-processed patient data and the pre-processed nurse data, introduce a hierarchical attention network, aggregate the information of the features of each dimension, realize the embedding of the portraits of patients and nurses, and obtain the hierarchically processed patient data and the hierarchically processed nurse data;
[0072] The enhancement module is used to introduce a graph attention mechanism to enhance the hierarchically processed patient data and the hierarchically processed caregiver data respectively to obtain an enhanced patient feature vector and an enhanced caregiver feature vector;
[0073] The score prediction module is used to introduce a multi-layer perceptron according to the enhanced patient feature vector and the enhanced caregiver feature vector to calculate a prediction score matrix;
[0074] The training module is used to obtain the real score matrix of the pre-processed patient data and the pre-processed nursing data based on the patient's public health information and the nursing care platform data; and to update the predicted score matrix and the real score matrix through back propagation to obtain the optimal model;
[0075] The recommendation module is used to perform portrait matching on the patient data to be predicted and the caregiver data to be predicted, and obtain a prediction score matrix for the patient and caregiver data to be predicted based on the optimal model; the prediction score matrix is used to make decisions for the two-way matching of patients and caregivers.
[0076] The present invention also includes a portrait matching and recommendation device based on a hierarchical graph attention mechanism, including a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, it is used for the above-mentioned portrait matching and recommendation method based on a hierarchical graph attention mechanism.
[0077] The present invention also includes a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the above-mentioned portrait matching and recommendation method based on the hierarchical graph attention mechanism is implemented.
[0078] The beneficial effects of the present invention are: by introducing rules and nursing knowledge with certain authority or recognized in the field, the generation process of patient and care worker portraits is enhanced, and HAN and GAT are applied to learn the representation of patient and care worker nodes, and finally MLP is trained to complete the matching degree prediction task, which can not only greatly improve the efficiency of assigning patients to care workers or recommending care workers to patients in real scenarios, but also ensure the excellent performance and high-precision performance of the entire system. The results produced by the present invention are expected to be trial-run in 2 hospitals, empowering 300 care workers, serving 32,000+ patients, improving efficiency by 60%, solving the problems of finding care workers like "opening a blind box" and frequently changing care workers during hospitalization, and meeting the growing care needs in medical scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] Figure 1 This is a flowchart of a portrait matching and recommendation method based on a hierarchical graph attention mechanism;
[0080] Figure 2 A schematic diagram of an embodiment of a portrait matching and recommendation device based on a hierarchical graph attention mechanism;
[0081] Figure 3A schematic diagram of another embodiment of a portrait matching and recommendation device based on a hierarchical graph attention mechanism. DETAILED DESCRIPTION
[0082] In order to make the purpose, technical scheme and advantages of the present invention more clear, the present invention is further described in detail in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0083] The core technology of the present invention is to enhance the generation process of patient and caregiver portraits by introducing rules and nursing knowledge that are authoritative or recognized in the field, and to apply HAN and GAT to learn the representation of patient and caregiver nodes. Finally, MLP is trained to complete the matching degree prediction task, thereby achieving high-quality and efficient two-way matching of patients and caregivers.
[0084] Example 1: Figure 1 As shown, the present invention provides a portrait matching and recommendation method based on a hierarchical graph attention mechanism, comprising the following steps:
[0085] (1) Based on the patient's public health information and the nursing care platform data, the patient data and the nursing data are obtained, and the patient data and the nursing data are preprocessed respectively to obtain the preprocessed patient data and the preprocessed nursing data.
[0086] The step (1) specifically includes the following sub-steps:
[0087] (1.1) Obtain patient data from patient public health information : ,in, represents the number of patients, Indicates feature set of each patient; All have Patient characteristics: ,in, Indicates The patient's The characteristic value of each patient characteristic.
[0088] Obtain nursing data from nursing care platform data : ,in, Indicates the number of care workers, Indicates feature set of a caregiver; each feature set All have Characteristics of a caregiver: ,in, Indicates The first The eigenvalues of the caregiver characteristics.
[0089] (1.2) Patient data and nursing staff data Perform preprocessing, which includes: cleaning, missing value detection, filling, and normalization to obtain preprocessed patient data and preprocessed nursing data .
[0090] The sub-step (1.2) specifically includes the following sub-steps:
[0091] (1.2.1) First, the patient data and nursing staff data Perform cleaning to obtain cleaned patient data And the cleaned nursing data The cleaning process specifically includes
[0092] a.1) For patient data and nursing staff data If there is a repeated feature set in , only one feature set is retained and the rest of the repeated feature sets are cleared.
[0093] a.2) For patient data and nursing staff data For string-type features, remove the spaces at the beginning and end of the feature.
[0094] a.3) Use regular expressions to verify patient data and nursing staff data Check whether the formats of ID number, mobile phone number and email address are correct, and correct any incorrect features.
[0095] (1.2.2) Then clean the patient data And the cleaned nursing data Perform missing value processing to obtain patient data after missing value processing And the missing care worker data .
[0096] The sub-step (1.2.2) specifically includes the following sub-steps:
[0097] b.1) Detect missing values on the cleaned patient data And the cleaned nursing data Count the missing values in to get the number of missing patient characteristics , the number of missing nursing staff features , the number of patients with missing features and ,in, Indicates The number of patient characteristics missing for each patient, Indicates The number of missing caregiver features for each caregiver, Indicates missing Number of patients with each patient characteristic, Indicates missing The number of caregivers with the same caregiver characteristics.
[0098] b.2) First, No. patients and No. The feature set of each caregiver is deleted, and then No. Patient characteristics and No. The characteristics of each nurse are deleted to obtain the patient data after missing processing And the missing care worker data .
[0099] (1.2.3) Then, the missing patient data were processed separately And the missing care worker data Each feature set in is filled to obtain the filled patient data : And the filled caregiver data : ;in, represents the number of patients, Indicates The characteristics of each patient, Indicates the number of care workers, Indicates feature set of a caregiver; each feature set All have Patient characteristics: ,in, Indicates The patient's patient characteristics; each characteristic set All have Characteristics of a caregiver: ,in, Indicates The first Characteristics of a caregiver.
[0100] (1.2.4) Finally, the filled patient data And the filled caregiver data Perform normalization to obtain preprocessed patient data and preprocessed nursing data .
[0101] The sub-step (1.2.4) specifically includes the following sub-steps:
[0102] c.1) First, for the filled patient data Any patient characteristic After normalization, all patients were obtained The mean of the patient characteristics and standard deviation , the calculation formula is: and ; and through the mean and standard deviation , get the normalized patient characteristics : .
[0103] For populated patient data Each patient characteristic Repeat the above steps to obtain the preprocessed patient data .
[0104] c.2) Secondly, for the filled nursing data Any one of the caregiver characteristics Normalize and get the The mean of the caregiver characteristics and standard deviation , the calculation formula is: ;and ; and through the mean and standard deviation , get the normalized care worker features : .
[0105] For the filled nursing data Each caregiver characteristic Repeat the above steps to obtain the preprocessed nursing data .
[0106] (2) Based on the preprocessed patient data and preprocessed nursing data, the hierarchical relationship of the characteristics of each dimension of patients and nursing staff is mined, a hierarchical attention network is introduced, and the information of the characteristics of each dimension is aggregated to realize the embedding of the portraits of patients and nursing staff, thus obtaining the hierarchically processed patient data and the hierarchically processed nursing staff data.
[0107] The step (2) specifically includes the following sub-steps:
[0108] (2.1) Preprocessed patient data middle The patient characteristics are divided into word typical and numerical types, and the patient word typical feature set is obtained. and patient numerical feature set ,in, , represents the number of typical patient characteristics, Represents the number of numerical patient features; and the preprocessed nursing data middle The features of the nurses are divided into word typical and numerical types, and the typical feature set of the nurses is obtained. and the caregiver numerical feature set ,in, , The number of typical caregiver features of the word, Indicates the number of numeric caregiver features.
[0109] According to the above classification, the pre-processed patient data Typical patient data divided into words and numerical patient data , and the pre-processed nursing data Typical nursing data divided into words and numerical nursing data .
[0110] Typical patient data for words Typical patient characteristics in each word The corresponding feature values of all patients are removed to obtain the corresponding value range , the value range size is ,use Such index values replace the typical patient data Patient characteristics The corresponding characteristic values of all patients are obtained to obtain the typical patient data after discretization .
[0111] Typical nursing data for words Typical nursing characteristics of each word The corresponding characteristic values of all caregivers are deduplicated to obtain the corresponding value range , the value range size is ,use Such index value replacement word typical caregiver data Characteristics of middle school nurses The corresponding eigenvalues of all caregivers are obtained to obtain the typical caregiver data after discretization .
[0112] In order to uniformly initialize the features of each dimension to dimensional vector space, respectively, the discretized word typical patient data , Numerical patient data , discretized characters, typical nursing data and numerical nursing data Perform a linear transformation to obtain typical patient data after a linear transformation , numerical patient data after a linear transformation , Typical nursing data after a linear transformation and the numerical nursing data after a linear transformation ,Right now: ; ; ; .
[0113] in, , , and are weight matrices respectively; , , and are the bias weights respectively.
[0114] Typical patient data after a linear transformation for Matrix, numerical patient data after a linear transformation for The matrix of a linear transformation is a typical nursing data for Matrix, numerical nursing data after a linear transformation for The matrix of .
[0115] Then, after activation by the LeakyReLU function, the linearly transformed word is converted into a typical patient data. And the numerical patient data after a linear transformation exist The initialized patient data is obtained by splicing in the dimension , the initialized patient data for The matrix of the typical nursing data after a linear transformation and the numerical nursing data after a linear transformation exist The initialized nursing data is obtained by splicing on the dimension of , the initialized caregiver data for The matrix of .
[0116] (2.2) For initialized patient data , divided into three layers, from bottom to top , and It indicates that, is the top layer, which contains only one patient node; It is the middle layer, and the nodes it contains are the top-level nodes. The child node of The parent node of several nodes; is the bottom layer, each node contained in it is The patient characteristics correspond one to one, and their size satisfies .
[0117] For initialized nursing data , divided into three layers, from bottom to top , and It indicates that, It is the top layer, which contains only one caregiver node; It is the middle layer, and the nodes it contains are the top-level nodes. The child node of The parent node of several nodes; is the bottom layer, each node contained in it is The characteristics of each caregiver correspond to each other, and their size satisfies .
[0118] (2.3) Construct a patient-level attention network consisting of two layers of hierarchical attention network layers and and build a caregiver hierarchical attention network, which consists of 2 layers of hierarchical attention network layers and composition.
[0119] For the hierarchical attention network layer , input is the initialized patient data , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is , transform to get the transformed patient data : ; The transformed patient data The size is ; Define a size of The parameter matrix , the transformed patient data With parameter matrix Take the element-wise product and sum over the last dimension while retaining that dimension to get the matrix ,matrix The size is , where the value is no longer the original feature value, but the attention score contributed by each feature; after being activated by the LeakyReLU function, the matrix implement Independent softmax normalizations are performed, each time for a different feature set; after each independent softmax normalization, the softmax normalized matrix is With the transformed patient data Do the element-wise product and Summing up and preserving that dimension gives The size is The tensor will The tensor in Finally, the output matrix is obtained. , the matrix The size is .
[0120] For the hierarchical attention network layer , the input is a matrix , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is , transform to get the transformed patient data : ; The transformed patient data The size is ; Define a size of The parameter matrix , the transformed patient data With parameter matrix Take the element-wise product and sum over the last dimension while retaining that dimension to get the matrix ,matrix The size is , where the value is no longer the original feature value, but the attention score contributed by each feature; after being activated by the LeakyReLU function, the matrix Perform 1 independent softmax normalization; after independent softmax normalization, the softmax normalized matrix With the transformed patient data Taking the element-wise product, we get , and convert the size of the tensor into , and finally obtain the hierarchically processed patient data , the matrix The size is .
[0121] For the hierarchical attention network layer , input is the initialized caregiver data , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is , transform to get the transformed nursing data : ; The transformed nursing data The size is ; Define a size of The parameter matrix , the transformed nursing data With parameter matrix Take the element-wise product and sum over the last dimension while retaining that dimension to get the matrix ,matrix The size is , where the value is no longer the original feature value, but the attention score contributed by each feature; after being activated by the LeakyReLU function, the matrix implement Independent softmax normalizations are performed, each time for a different feature set; after each independent softmax normalization, the softmax normalized matrix is With the transformed nursing data Do the element-wise product and Summing up and retaining this dimension, we get The size is The tensor will The tensor in Finally, the output matrix is obtained. , the matrix The size is .
[0122] For the hierarchical attention network layer , the input is a matrix , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is , transform to get the transformed nursing data : ; The transformed nursing data The size is ; Define a size of The parameter matrix , the transformed nursing data With parameter matrix Take the element-wise product and sum over the last dimension while retaining that dimension to get the matrix ,matrix The size is , where the value is no longer the original feature value, but the attention score contributed by each feature; after being activated by the LeakyReLU function, the matrix Perform 1 independent softmax normalization; after independent softmax normalization, the softmax normalized matrix With the transformed nursing data Taking the element-wise product, we get , and convert the size of the tensor into , and finally get the hierarchically processed nursing data , the matrix The size is .
[0123] (3) The graph attention mechanism is introduced to enhance the hierarchically processed patient data and the hierarchically processed caregiver data respectively, and the enhanced patient feature vector and the enhanced caregiver feature vector are obtained.
[0124] The step (3) specifically includes the following sub-steps:
[0125] (3.1) Patient data after hierarchical processing , get the patient map The patient's picture Contains nodes, each node represents a patient. Patient Nodes The embedding of : ; Also contains edges, each edge , which means that there is a path from the starting node Point to the end node The edge of , Patient diagram Middle The starting node of the edge, starting node Corresponding to the initialized patient data Middle Patient nodes, Patient diagram Middle The end node of the edge, the end node Corresponding to the initialized patient data Middle patient nodes; thus obtaining the patient starting node set and the patient terminal node set .
[0126] Caregiver data after hierarchical processing , get the care worker map ; The nursing worker diagram Contains nodes, each node represents a caregiver, Nursing Node The embedding of : ; Also contains edges, each edge , which means that there is a path from the starting node Point to the end node The edge of , Represents a nursing worker diagram Middle The starting node of the edge, starting node Corresponding to the initialized nursing data Middle Nursing nodes, Represents a nursing worker diagram Middle The end node of the edge, the end node Corresponding to the initialized nursing data Middle Caregiver nodes; thus obtaining the caregiver starting node set and the set of caregiver termination nodes .
[0127] (3.2) Construct a patient graph attention network consisting of two graph attention layers and and build a caregiver graph attention network, which consists of 2 layers of graph attention layers and composition.
[0128] For the graph attention layer , the input is the patient data after hierarchical processing , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is ,in, Representation graph attention layer The number of attention heads included, transformed to obtain the transformed patient data : ; Transformed patient data The size is .
[0129] Then define the size as The parameter matrix and the parameter matrix , parameter matrix Used to calculate the contribution of the starting node to the edge attention score, parameter matrix Used to calculate the contribution of the terminal node to the edge attention score; the parameter matrix and the parameter matrix Respectively with the transformed patient data Do the element-wise product and sum it over the last dimension to get the result and results ,result The values in represent the attention scores of each attention head generated on the edge when each patient node is used as the starting node. The values in represent the attention scores of each attention head generated on the edge when each patient node is used as the terminal node.
[0130] According to the patient starting node set The order of the transformed patient data is and results The tensor corresponding to the index forms a new matrix and matrix : , where the matrix Middle Tensor The transformed patient data Middle Tensors, matrices The size is ; , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is .
[0131] According to the patient's termination node set The order of results The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is .
[0132] Then the matrix With the matrix Add and activate with LeakyReLU function to get the matrix ,in, Representation Matrix Middle A tensor.
[0133] Create a size The all-zero matrix , and the matrix Middle Tensor Add to all zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle Tensors; terminal node set according to the patient The order from the matrix The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the matrix Middle A tensor.
[0134] Then the opposite side Perform softmax normalization calculation to obtain any edge attention : ; Get patient image The attention set .
[0135] The matrix With patient diagram The attention set Perform element-wise product and get a size of The matrix ; Then create a size of The all-zero matrix ; Sequentially transform the matrix Middle tensors added to an all-zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle tensors; then the matrix Each attention The end-to-end concatenation of the dimensional embedding finally results in the graph attention layer. Output .
[0136] For the graph attention layer , the input is a matrix , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is ,in, Representation graph attention layer The number of attention heads included, transformed to obtain the transformed patient data : .
[0137] Then define the size as The parameter matrix and the parameter matrix , parameter matrix Used to calculate the contribution of the starting node to the edge attention score, parameter matrix Used to calculate the contribution of the terminal node to the edge attention score; the parameter matrix and the parameter matrix Respectively with the transformed patient data Do the element-wise product and sum it over the last dimension to get the result and results ,result The values in represent the attention scores of each attention head generated on the edge when each patient node is used as the starting node. The values in represent the attention scores of each attention head generated on the edge when each patient node is used as the terminal node.
[0138] According to the patient starting node set The order of the transformed patient data is and results The tensor corresponding to the index forms a new matrix and matrix : , where the matrix Middle Tensor The transformed patient data Middle Tensors, matrices The size is ; , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is .
[0139] According to the patient's termination node set The order of results The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is .
[0140] Then the matrix With the matrix Add and activate with LeakyReLU function to get the matrix ,in, Representation Matrix Middle A tensor.
[0141] Create a size The all-zero matrix , and the matrix Middle Tensor Add to all zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle Tensors; terminal node set according to the patient The order from the matrix The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the matrix Middle A tensor.
[0142] Then the opposite side Perform softmax normalization calculation to obtain any edge attention : ; Get patient image The attention set .
[0143] The matrix With patient diagram The attention set Perform element-wise product and get a size of The matrix ; Then create a size of The all-zero matrix ; Sequentially transform the matrix Middle tensors added to an all-zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle A tensor.
[0144] Then the matrix Each attention The average of the dimensional embedding is The enhanced patient feature vector As a graph attention layer The output of , Representation Matrix Middle A tensor.
[0145] For the graph attention layer , the input is the hierarchical processed nursing data , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is ,in, Representation graph attention layer The number of attention heads included, transformed to obtain the transformed caregiver data : .
[0146] Then define the size as The parameter matrix and the parameter matrix , parameter matrix Used to calculate the contribution of the starting node to the edge attention score, parameter matrix Used to calculate the contribution of the terminal node to the edge attention score; the parameter matrix and the parameter matrix Respectively with the transformed nursing data Do the element-wise product and sum it over the last dimension to get the result and results ,result The value in represents the attention score of each attention head generated on the edge when each caregiver node is used as the starting node. The values in represent the attention scores of each attention head generated on the edge when each caregiver node is used as the terminal node.
[0147] According to the nursing worker starting node set The order of the transformed nursing data is and results The tensor corresponding to the index forms a new matrix and matrix : , where the matrix Middle Tensor The transformed nursing data Middle Tensors, matrices The size is ; , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is .
[0148] According to the caregiver termination node set The order of results The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is .
[0149] Then the matrix With the matrix Add and activate with LeakyReLU function to get the matrix ,in, Representation Matrix Middle A tensor.
[0150] Create a size The all-zero matrix , and the matrix Middle Tensor Add to all zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle Tensor; according to the caregiver termination node set The order from the matrix The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the matrix Middle A tensor.
[0151] Then the opposite side Perform softmax normalization calculation to obtain any edge attention : ; Get the care worker map The attention set .
[0152] The matrix Illustration with care worker The attention set Perform element-wise product and get a size of The matrix ; Then create a size of The all-zero matrix ; Sequentially transform the matrix Middle tensors added to an all-zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle tensors; then the matrix Each attention The end-to-end concatenation of the dimensional embedding finally results in the graph attention layer. Output .
[0153] For the graph attention layer , the input is a matrix , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is ,in, Representation graph attention layer The number of attention heads included, transformed to obtain the transformed caregiver data : .
[0154] Then define the size as The parameter matrix and the parameter matrix , parameter matrix Used to calculate the contribution of the starting node to the edge attention score, parameter matrix Used to calculate the contribution of the terminal node to the edge attention score; the parameter matrix and the parameter matrix Respectively with the transformed nursing data Do the element-wise product and sum it over the last dimension to get the result and results ,result The value in represents the attention score of each attention head generated on the edge when each caregiver node is used as the starting node. The values in represent the attention scores of each attention head generated on the edge when each caregiver node is used as the terminal node.
[0155] According to the nursing worker starting node set The order of the transformed nursing data is and results The tensor corresponding to the index forms a new matrix and matrix : , where the matrix Middle Tensor The transformed nursing data Middle Tensors, matrices The size is ; , where the matrix Middle Tensor For the results Middle Tensors, matrices The size is .
[0156] Then the matrix With the matrix Add and activate with LeakyReLU function to get the matrix ,in, Representation Matrix Middle A tensor.
[0157] Create a size The all-zero matrix , and the matrix Middle Tensor Add to all zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle Tensor; according to the caregiver termination node set The order from the matrix The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the matrix Middle A tensor.
[0158] Then the opposite side Perform softmax normalization calculation to obtain any edge attention : ; Get the care worker map The attention set .
[0159] The matrix Illustration with care worker The attention set Perform element-wise product and get a size of The matrix ; Then create a size of The all-zero matrix ; Sequentially transform the matrix Middle tensors added to an all-zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle A tensor.
[0160] Then the matrix Each attention The average of the dimensional embedding is The enhanced caregiver feature vector As a graph attention layer The output of , Representation Matrix Middle A tensor.
[0161] (4) Based on the enhanced patient feature vector and the enhanced caregiver feature vector, a multi-layer perceptron is introduced to calculate the prediction score matrix.
[0162] The step (4) specifically includes the following sub-steps:
[0163] (4.1) Through the enhanced patient feature vector Constructing a new matrix :
[0164] .
[0165] And through the enhanced caregiver feature vector Constructing a new matrix : .
[0166] Then the matrix and matrix Concatenate on the last dimension to get the training data .
[0167] (4.2) Construct a 2-layer multi-layer perceptron, using and express.
[0168] For multi-layer perceptron , input is training data , perform linear transformation, output matrix : ,in, is the weight matrix, is the bias weight, is the activation function.
[0169] For multi-layer perceptron , the input is a matrix , perform linear transformation and output the predicted score matrix , the prediction score matrix The size is : ,in, , is the weight matrix, is the bias weight.
[0170] For multi-layer perceptron , input is training data , perform linear transformation, output matrix : ,in, is the weight matrix, is the bias weight, is the activation function.
[0171] For multi-layer perceptron , the input is a matrix , perform linear transformation and output the predicted score matrix , the prediction score matrix The size is : ,in, is the weight matrix, is the bias weight.
[0172] (5) Based on the patient's public health information and the nursing care platform data, the true scoring matrix of the preprocessed patient data and the preprocessed nursing data is obtained; and according to the predicted scoring matrix and the true scoring matrix, it is updated through back propagation to obtain the optimal model.
[0173] The step (5) specifically includes the following sub-steps:
[0174] (5.1) Obtain a true scoring matrix based on patient public health information and nursing care platform data : ,in, Indicates Patients Rating of the caregiver.
[0175] (5.2) The predicted score matrix and the true rating matrix Calculate the mean square error and get the total loss : ,in, Represents the prediction score matrix Middle Prediction scores, Represents the rating matrix Middle Ratings.
[0176] Based on total loss Update the weight matrix , , , , , , , , , , , , and , bias weight , , , , and And the parameter matrix , , , , , , , , , , and , while recording the total loss The state of the entire network at the minimum is saved as the optimal model.
[0177] (6) Perform portrait matching on the patient data to be predicted and the caregiver data to be predicted. Repeat steps (1) to (4) based on the optimal model to obtain a prediction score matrix for the patient and caregiver data to be predicted. Use the prediction score matrix to make decisions for the two-way matching of patients and caregivers.
[0178] Example 2: Figure 2As shown, the present invention provides a portrait matching and recommendation device based on a hierarchical graph attention mechanism, the device comprising: a preprocessing module, a portrait embedding module, an enhancement module, a rating prediction module, a training module and a recommendation module.
[0179] The preprocessing module is used to obtain patient data and nursing data based on the patient's public health information and nursing care platform data, and preprocess the patient data and nursing data respectively to obtain preprocessed patient data and preprocessed nursing data.
[0180] The portrait embedding module is used to embed the portraits of patients and caregivers based on the preprocessed patient data and the preprocessed caregiver data, by mining the hierarchical relationship of the features of each dimension of patients and caregivers, introducing a hierarchical attention network, and aggregating the information of the features of each dimension to achieve the embedding of the portraits of patients and caregivers, and obtain the hierarchically processed patient data and the hierarchically processed caregiver data.
[0181] The enhancement module is used to introduce a graph attention mechanism to enhance the hierarchically processed patient data and the hierarchically processed caregiver data respectively, to obtain an enhanced patient feature vector and an enhanced caregiver feature vector.
[0182] The score prediction module is used to introduce a multi-layer perceptron according to the enhanced patient feature vector and the enhanced caregiver feature vector to calculate a prediction score matrix.
[0183] The training module is used to obtain the real scoring matrix of pre-processed patient data and pre-processed nursing data based on the patient's public health information and the nursing care platform data; and update the predicted scoring matrix and the real scoring matrix through back propagation to obtain the optimal model.
[0184] The recommendation module is used to perform portrait matching on the patient data to be predicted and the caregiver data to be predicted, and obtain a prediction score matrix for the patient and caregiver data to be predicted based on the optimal model; the prediction score matrix is used to make decisions for the two-way matching of patients and caregivers.
[0185] Embodiment 3: Corresponding to the aforementioned embodiment 1 of a portrait matching and recommendation method based on a hierarchical graph attention mechanism, the present invention also provides an embodiment of a portrait matching and recommendation device based on a hierarchical graph attention mechanism.
[0186] See also Figure 3 An embodiment of the present invention provides a portrait matching and recommendation device based on a hierarchical graph attention mechanism, comprising one or more processors for implementing a portrait matching and recommendation method based on a hierarchical graph attention mechanism in the above-mentioned embodiment.
[0187] An embodiment of a portrait matching and recommendation device based on a hierarchical graph attention mechanism of the present invention can be applied to any device with data processing capabilities, and the device with data processing capabilities can be a device or apparatus such as a computer. The device embodiment can be implemented through software, or through hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of any device with data processing capabilities in which it is located reading the corresponding computer program instructions in the non-volatile memory into the memory for execution. From a hardware perspective, if Figure 3 As shown, it is a hardware structure diagram of a portrait matching and recommendation device based on the hierarchical graph attention mechanism of the present invention, in which any device with data processing capability is located, except Figure 3 In addition to the processor, memory, network interface, and non-volatile memory shown, any device with data processing capabilities in which the apparatus in the embodiments is located may also include other hardware, generally based on the actual functions of the device with data processing capabilities, which will not be described in detail.
[0188] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0189] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention. Ordinary technicians in this field can understand and implement it without paying creative work.
[0190] The embodiment of the present invention also provides a computer-readable storage medium, on which a program is stored. When the program is executed by a processor, a portrait matching and recommendation method based on a hierarchical graph attention mechanism in the above embodiment is implemented. The computer-readable storage medium can be an internal storage unit of any device with data processing capability described in any of the above embodiments, such as a hard disk or a memory. The computer-readable storage medium can also be an external storage device of any device with data processing capability, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), an SD card, a flash card (Flash Card), etc. equipped on the device. Further, the computer-readable storage medium can also include both an internal storage unit and an external storage device of any device with data processing capability. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capability, and can also be used to temporarily store data that has been output or is to be output.
[0191] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A portrait matching and recommendation method based on hierarchical graph attention mechanism, It is characterized in that The following steps are involved: (1) Based on the patient's public health information and the nursing care platform data, the patient data and the nursing data are obtained, and the patient data and the nursing data are preprocessed respectively to obtain the preprocessed patient data and the preprocessed nursing data; (2) Based on the pre-processed patient data and pre-processed nursing staff data, by mining the hierarchical relationship of the features of each dimension of patients and nursing staff, a hierarchical attention network is introduced to aggregate the information of the features of each dimension, realize the embedding of the portraits of patients and nursing staff, and obtain the hierarchically processed patient data and hierarchically processed nursing staff data; (3) Introducing the graph attention mechanism, the hierarchically processed patient data and the hierarchically processed caregiver data are enhanced to obtain the enhanced patient feature vector and the enhanced caregiver feature vector; (4) Based on the enhanced patient feature vector and the enhanced caregiver feature vector, a multi-layer perceptron is introduced to calculate the prediction score matrix; (5) Based on the patient's public health information and the nursing care platform data, the real score matrix of the preprocessed patient data and the preprocessed nursing data is obtained; and the predicted score matrix and the real score matrix are updated through back propagation to obtain the optimal model; (6) Perform portrait matching on the patient data to be predicted and the caregiver data to be predicted. Repeat steps (1) to (4) based on the optimal model to obtain a prediction score matrix for the patient and caregiver data to be predicted. Use the prediction score matrix to make decisions for the two-way matching of patients and caregivers.
2. A portrait matching and recommendation method based on a hierarchical graph attention mechanism according to claim 1, It is characterized in that The step (1) specifically includes the following sub-steps: (1.1) Obtain patient data from patient public health information : ,in, represents the number of patients, Indicates feature set of each patient; All have Patient characteristics: ,in, Indicates The patient's The characteristic value of each patient characteristic; Obtain nursing data from nursing care platform data : ,in, Indicates the number of care workers, Indicates feature set of a caregiver; each feature set All have Characteristics of a caregiver: ,in, Indicates The first The characteristic value of each caregiver characteristic; (1.2) Patient data and nursing staff data Perform preprocessing, which includes: cleaning, missing value detection, filling, and normalization to obtain preprocessed patient data and preprocessed nursing data .
3. A portrait matching and recommendation method based on a hierarchical graph attention mechanism according to claim 2, It is characterized in that The sub-step (1.2) specifically includes the following sub-steps: (1.2.1) First, the patient data and nursing staff data Perform cleaning to obtain cleaned patient data And the cleaned nursing data , the cleaning process specifically includes: a.1) For patient data and nursing staff data Among the repeated feature sets, only one feature set is retained and the other repeated feature sets are cleared; a.2) For patient data and nursing staff data For features of string type, remove the spaces at the beginning and end of the feature; a.3) Use regular expressions to verify patient data and nursing staff data Check whether the format of ID number, mobile phone number and email address is correct, and correct any incorrect features; (1.2.2) Then clean the patient data And the cleaned nursing data Perform missing value processing to obtain patient data after missing value processing And the missing care worker data ; The sub-step (1.2.2) specifically includes the following sub-steps: b.1) Detect missing values on the cleaned patient data And the cleaned nursing data Count the missing values in to get the number of missing patient characteristics , the number of missing nursing staff features , the number of patients with missing features and ,in, Indicates The number of patient characteristics missing for each patient, Indicates The number of missing caregiver features for each caregiver, Indicates missing Number of patients with each patient characteristic, Indicates missing The number of caregivers with each caregiver’s characteristics; b.2) First, No. patients and No. The feature set of each caregiver is deleted, and then No. Patient characteristics and No. The characteristics of each nurse are deleted to obtain the patient data after missing processing And the missing care worker data ; (1.2.3) Then, the missing patient data were processed And the missing care worker data Each feature set in is filled to obtain the filled patient data : And the filled caregiver data : ;in, represents the number of patients, Indicates The characteristics of each patient, Indicates the number of care workers, Indicates feature set of a caregiver; each feature set All have Patient characteristics: ,in, Indicates The patient's patient characteristics; each characteristic set All have Characteristics of a caregiver: ,in, Indicates The first Characteristics of individual caregivers; (1.2.4) Finally, the filled patient data And the filled caregiver data Perform normalization to obtain preprocessed patient data and preprocessed nursing data ; The sub-step (1.2.4) specifically includes the following sub-steps: c.1) First, for the filled patient data Any patient characteristic After normalization, all patients were obtained The mean of the patient characteristics and standard deviation , the calculation formula is: and ; and through the mean and standard deviation , get the normalized patient characteristics : ; For populated patient data Each patient characteristic Repeat the above steps to obtain the preprocessed patient data ; c.2) Secondly, for the filled nursing data Any one of the caregiver characteristics After normalization, we can get the The mean of the caregiver characteristics and standard deviation , the calculation formula is: ;and ; and through the mean and standard deviation , get the normalized care worker features : ; For the filled nursing data Each caregiver characteristic Repeat the above steps to obtain the preprocessed nursing data .
4. A portrait matching and recommendation method based on a hierarchical graph attention mechanism according to claim 3, It is characterized in that The step (2) specifically includes the following sub-steps: (2.1) Preprocessed patient data middle The patient characteristics are divided into word typical and numerical types, and the patient word typical feature set is obtained. and patient numerical feature set ,in, , represents the number of typical patient characteristics, Represents the number of numerical patient features; and the preprocessed nursing data middle The features of the nurses are divided into word typical and numerical types, and the typical feature set of the nurses is obtained. and the caregiver numerical feature set ,in, , The number of typical caregiver features of the word, Indicates the number of numeric caregiver characteristics; According to the above classification, the pre-processed patient data Typical patient data divided into words and numerical patient data , and the pre-processed nursing data Typical nursing data divided into words and numerical nursing data ; Typical patient data for words Typical patient characteristics in each word The corresponding feature values of all patients are removed to obtain the corresponding value range , the value range size is ,use Such index values replace the typical patient data Patient characteristics The corresponding characteristic values of all patients are obtained to obtain the typical patient data after discretization ; Typical nursing data for words Typical nursing characteristics of each word The corresponding characteristic values of all caregivers are deduplicated to obtain the corresponding value range , the value range size is ,use Such index value replacement word typical caregiver data Characteristics of middle school nurses The corresponding eigenvalues of all caregivers are obtained to obtain the typical caregiver data after discretization ; In order to uniformly initialize the features of each dimension to dimensional vector space, respectively, the discretized word typical patient data , Numerical patient data , discretized characters, typical nursing data and numerical nursing data Perform a linear transformation to obtain typical patient data after a linear transformation , numerical patient data after a linear transformation , Typical nursing data after a linear transformation and the numerical nursing data after a linear transformation ,Right now: ; ; ; ; in, , , and are weight matrices respectively; , , and are bias weights respectively; Typical patient data after a linear transformation for Matrix, numerical patient data after a linear transformation for The matrix of a linear transformation is a typical nursing data for Matrix, numerical nursing data after a linear transformation for Matrix of Then, after activation by the LeakyReLU function, the typical patient data after a linear transformation And the numerical patient data after a linear transformation exist The initialized patient data is obtained by splicing in the dimension of , the initialized patient data for The matrix of the typical nursing data after a linear transformation and the numerical nursing data after a linear transformation exist The initialized nursing data is obtained by splicing on the dimension of , the initialized caregiver data for Matrix of (2.2) For initialized patient data , divided into three layers, from bottom to top , and It indicates that, is the top layer, which contains only one patient node; It is the middle layer, and the nodes it contains are the top-level nodes. The child node of The parent node of several nodes; is the bottom layer, each node contained in it is The patient characteristics correspond one to one, and their size satisfies ; For initialized nursing data , divided into three layers, from bottom to top , and It indicates that, The top layer contains only one caregiver node. It is the middle layer, and the nodes it contains are the top-level nodes. The child node of The parent node of several nodes; is the bottom layer, each node contained in it is The characteristics of each caregiver correspond to each other, and their size satisfies ; (2.3) Construct a patient-level attention network consisting of two layers of hierarchical attention network layers and and build a caregiver hierarchical attention network, which consists of 2 layers of hierarchical attention network layers and composition; For the hierarchical attention network layer , input is the initialized patient data , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is , transform to get the transformed patient data : ; Define a size of The parameter matrix , the transformed patient data With parameter matrix Do the element-wise product and sum over the last dimension and keep that dimension to get the matrix ; After activation by the LeakyReLU function, the matrix implement Independent softmax normalization; after each independent softmax normalization, the softmax normalized matrix With the transformed patient data Do the element-wise product and Summing up and retaining this dimension, we get The size is The tensor will The tensor in Finally, the output matrix is obtained. ; For the hierarchical attention network layer , the input is a matrix , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is , transform to get the transformed patient data : ; Define a size of The parameter matrix , the transformed patient data With parameter matrix Do the element-wise product and sum over the last dimension and keep that dimension to get the matrix ; After activation by the LeakyReLU function, the matrix Perform 1 independent softmax normalization; after independent softmax normalization, the softmax normalized matrix With the transformed patient data Taking the element-wise product, we get , and convert the size of the tensor into , and finally obtain the hierarchically processed patient data ; For the hierarchical attention network layer , input is the initialized caregiver data , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is , transform to get the transformed nursing data : ; Define a size of The parameter matrix , the transformed nursing data With parameter matrix Do the element-wise product and sum over the last dimension and keep that dimension to get the matrix ; After activation by the LeakyReLU function, the matrix implement Independent softmax normalization; after each independent softmax normalization, the softmax normalized matrix With the transformed nursing data Do the element-wise product and Summing up and retaining this dimension, we get The size is The tensor will The tensor in Finally, the output matrix is obtained. ; For the hierarchical attention network layer , the input is a matrix , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is , transform to get the transformed nursing data : ; Define a size of The parameter matrix , the transformed nursing data With parameter matrix Do the element-wise product and sum over the last dimension and keep that dimension to get the matrix ; After activation by the LeakyReLU function, the matrix Perform 1 independent softmax normalization; after independent softmax normalization, the softmax normalized matrix With the transformed nursing data Taking the element-wise product, we get , and convert the size of the tensor into , and finally get the hierarchically processed nursing data .
5. A portrait matching and recommendation method based on a hierarchical graph attention mechanism according to claim 4, It is characterized in that The step (3) specifically includes the following sub-steps: (3.1) Patient data after hierarchical processing , get the patient map The patient's picture Contains nodes, each node represents a patient. Patient Nodes The embedding of : ; Also contains edges, each edge , which means that there is a path from the starting node Point to the end node The edge of , Patient diagram Middle The starting node of the edge, starting node Corresponding to the initialized patient data Middle Patient nodes, Patient diagram Middle The end node of the edge, the end node Corresponding to the initialized patient data Middle patient nodes; thus obtaining the patient starting node set and the patient terminal node set ; Caregiver data after hierarchical processing , get the care worker map ; The nursing worker diagram Contains nodes, each node represents a caregiver, Nursing Node The embedding of : ; Also contains edges, each edge , which means that there is a path from the starting node Point to the end node The edge of , Represents a nursing worker diagram Middle The starting node of the edge, starting node Corresponding to the initialized nursing data Middle Nursing nodes, Represents a nursing worker diagram Middle The end node of the edge, the end node Corresponding to the initialized nursing data Middle Caregiver nodes; thus obtaining the caregiver starting node set and the set of caregiver termination nodes ; (3.2) Construct a patient graph attention network consisting of two graph attention layers and and build a caregiver graph attention network, which consists of 2 layers of graph attention layers and composition; For the graph attention layer , the input is the patient data after hierarchical processing , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is ,in, Representation graph attention layer The number of attention heads included, transformed to obtain the transformed patient data : ; Then define the size of The parameter matrix and the parameter matrix ; The parameter matrix and the parameter matrix Respectively with the transformed patient data Do the element-wise product and sum it over the last dimension to get the result and results ,result The values in represent the attention scores of each attention head generated on the edge when each patient node is used as the starting node. The value in represents the attention score of each attention head generated on the edge when each patient node is used as the terminal node; according to the patient starting node set The order of the transformed patient data is and results The tensor corresponding to the index forms a new matrix and matrix : , where the matrix Middle Tensor The transformed patient data Middle Tensors, matrices The size is ; , where the matrix Middle Tensor For the result Middle Tensors, matrices The size is ; According to the patient termination node set The order of results The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the result Middle Tensors, matrices The size is ; Then the matrix With the matrix Add and activate with LeakyReLU function to get the matrix ,in, Representation Matrix Middle tensors; create a tensor of size The all-zero matrix , and the matrix Middle Tensor Add to all zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle Tensors; terminal node set according to the patient The order from the matrix The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the matrix Middle tensor; then the edge Perform softmax normalization calculation to obtain any edge attention : ; Get patient image The attention set ; The matrix With patient diagram The attention set Perform element-wise product and get a size of The matrix ; Then create a size of The all-zero matrix ; Sequentially transform the matrix Middle tensors added to an all-zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle tensors; then the matrix Each attention The end-to-end concatenation of the dimensional embedding finally results in the graph attention layer. Output ; For the graph attention layer , the input is a matrix , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is ,in, Representation graph attention layer The number of attention heads included, transformed to obtain the transformed patient data : ; Then define the size of The parameter matrix and the parameter matrix ; The parameter matrix and the parameter matrix Respectively with the transformed patient data Do the element-wise product and sum it over the last dimension to get the result and results ,result The values in represent the attention scores of each attention head generated on the edge when each patient node is used as the starting node. The value in represents the attention score of each attention head generated on the edge when each patient node is used as the terminal node; according to the patient starting node set The order of the transformed patient data is and results The tensor corresponding to the index forms a new matrix and matrix : , where the matrix Middle Tensor The transformed patient data Middle Tensors, matrices The size is ; , where the matrix Middle Tensor For the result Middle Tensors, matrices The size is ; According to the patient termination node set The order of results The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the result Middle Tensors, matrices The size is ; Then the matrix With the matrix Add and activate with LeakyReLU function to get the matrix ,in, Representation Matrix Middle tensors; create a tensor of size The all-zero matrix , and the matrix Middle Tensor Add to all zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle Tensors; terminal node set according to the patient The order from the matrix The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the matrix Middle tensor; then the edge Perform softmax normalization calculation to obtain any edge attention : ; Get patient image The attention set ; The matrix With patient diagram The attention set Perform element-wise product and get a size of The matrix ; Then create a size of The all-zero matrix ; Sequentially transform the matrix Middle tensors added to an all-zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle tensors; then the matrix Each attention The average of the dimensional embedding is The enhanced patient feature vector As a graph attention layer The output of , Representation Matrix Middle tensor; For the graph attention layer , the input is the hierarchical processed nursing data , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is ,in, Representation graph attention layer The number of attention heads included, transformed to obtain the transformed caregiver data : ; Then define the size of The parameter matrix and the parameter matrix ; The parameter matrix and the parameter matrix Respectively with the transformed nursing data Do the element-wise product and sum it over the last dimension to get the result and results ,result The value in represents the attention score of each attention head generated on the edge when each caregiver node is used as the starting node. The value in represents the attention score of each attention head generated on the edge when each caregiver node is used as the terminal node; according to the caregiver starting node set The order of the transformed nursing data is and results The tensor corresponding to the index forms a new matrix and matrix : , where the matrix Middle Tensor The transformed nursing data Middle Tensors, matrices The size is ; , where the matrix Middle Tensor For the result Middle Tensors, matrices The size is ; According to the caregiver termination node set The order of results The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the result Middle Tensors, matrices The size is ; Then the matrix With the matrix Add and activate with LeakyReLU function to get the matrix ,in, Representation Matrix Middle tensors; create a tensor of size The all-zero matrix , and the matrix Middle Tensor Add to all zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle Tensor; according to the caregiver termination node set The order from the matrix The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the matrix Middle tensor; then the edge Perform softmax normalization calculation to obtain any edge attention : ; Get the care worker map The attention set ; The matrix Illustration with care worker The attention set Perform element-wise product and get a size of The matrix ; Then create a size of The all-zero matrix ; Sequentially transform the matrix Middle tensors added to an all-zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle tensors; then the matrix Each attention The end-to-end concatenation of the dimensional embedding finally results in the graph attention layer. Output ; For the graph attention layer , the input is a matrix , first do a linear transformation, the input dimension is , the output dimension is , the corresponding weight matrix The size is ,in, Representation graph attention layer The number of attention heads included, transformed to obtain the transformed caregiver data : ; Then define the size of The parameter matrix and the parameter matrix ; The parameter matrix and the parameter matrix Respectively with the transformed nursing data Do the element-wise product and sum it over the last dimension to get the result and results ,result The value in represents the attention score of each attention head generated on the edge when each caregiver node is used as the starting node. The value in represents the attention score of each attention head generated on the edge when each caregiver node is used as the terminal node; according to the caregiver starting node set The order of the transformed nursing data is and results The tensor corresponding to the index forms a new matrix and matrix : , where the matrix Middle Tensor The transformed nursing data Middle Tensors, matrices The size is ; , where the matrix Middle Tensor For the result Middle Tensors, matrices The size is ; Then the matrix With the matrix Add and activate with LeakyReLU function to get the matrix ,in, Representation Matrix Middle tensors; create a tensor of size The all-zero matrix , and the matrix Middle Tensor Add to all zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle Tensor; according to the caregiver termination node set The order from the matrix The tensor corresponding to the index forms a new matrix : , where the matrix Middle Tensor For the matrix Middle tensor; then the edge Perform softmax normalization calculation to obtain any edge attention : ; Get the care worker map The attention set ; The matrix Illustration with care worker The attention set Perform element-wise product and get a size of The matrix ; Then create a size of The all-zero matrix ; Sequentially transform the matrix Middle tensors added to an all-zero matrix Middle tensors, we get the matrix ,in, Representation Matrix Middle tensors; then the matrix Each attention The average of the dimensional embedding is The enhanced caregiver feature vector As a graph attention layer The output of , Representation Matrix Middle A tensor.
6. A portrait matching and recommendation method based on a hierarchical graph attention mechanism according to claim 5, It is characterized in that The step (4) specifically includes the following sub-steps: (4.1) Through the enhanced patient feature vector Constructing a new matrix : ; And through the enhanced caregiver feature vector Constructing a new matrix : ; Then the matrix and matrix Concatenate on the last dimension to get the training data ; (4.2) Construct a 2-layer multi-layer perceptron, using and express; For multi-layer perceptron , input is training data , perform linear transformation, and output matrix : ,in, is the weight matrix, is the bias weight, is the activation function; For multi-layer perceptron , the input is a matrix , perform linear transformation and output the predicted score matrix : ,in, , is the weight matrix, is the bias weight.
7. A portrait matching and recommendation method based on a hierarchical graph attention mechanism according to claim 6, It is characterized in that The step (5) specifically includes the following sub-steps: (5.1) Obtain a true scoring matrix based on patient public health information and nursing care platform data : ,in, Indicates Patients Ratings of individual caregivers; (5.2) The predicted score matrix and the true rating matrix Calculate the mean square error and get the total loss : ,in, Represents the prediction score matrix Middle Prediction scores, Represents the rating matrix Middle Ratings; Based on total loss Update the weight matrix , , , , , , , , , , , , and , bias weight , , , , and And the parameter matrix , , , , , , , , , , and , while recording the total loss The state of the entire network at the minimum is saved as the optimal model.
8. A portrait matching and recommendation device based on hierarchical graph attention mechanism, It is characterized in that The device comprises: a preprocessing module, a portrait embedding module, an enhancement module, a rating prediction module, a training module and a recommendation module; The preprocessing module is used to obtain patient data and nursing data based on the patient's public health information and nursing care platform data, and preprocess the patient data and nursing data respectively to obtain preprocessed patient data and preprocessed nursing data; The portrait embedding module is used to mine the hierarchical relationship of the features of each dimension of patients and nurses according to the pre-processed patient data and the pre-processed nurse data, introduce a hierarchical attention network, aggregate the information of the features of each dimension, realize the embedding of the portraits of patients and nurses, and obtain the hierarchically processed patient data and the hierarchically processed nurse data; The enhancement module is used to introduce a graph attention mechanism to enhance the hierarchically processed patient data and the hierarchically processed caregiver data respectively to obtain an enhanced patient feature vector and an enhanced caregiver feature vector; The score prediction module is used to introduce a multi-layer perceptron according to the enhanced patient feature vector and the enhanced caregiver feature vector to calculate a prediction score matrix; The training module is used to obtain the real score matrix of the pre-processed patient data and the pre-processed nursing data based on the patient's public health information and the nursing care platform data; and to update the predicted score matrix and the real score matrix through back propagation to obtain the optimal model; The recommendation module is used to perform portrait matching on the patient data to be predicted and the caregiver data to be predicted, and obtain a prediction score matrix for the patient and caregiver data to be predicted based on the optimal model; the prediction score matrix is used to make decisions for the two-way matching of patients and caregivers.
9. A portrait matching and recommendation device based on hierarchical graph attention mechanism, It is characterized in that It includes a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, it is used to implement a portrait matching and recommendation method based on a hierarchical graph attention mechanism as described in any one of claims 1-7.
10. A computer-readable storage medium, It is characterized in that A program is stored thereon, and when the program is executed by a processor, a portrait matching and recommendation method based on a hierarchical graph attention mechanism as described in any one of claims 1-7 is implemented.
