Training method, control device and storage medium of user portrait recognition system

Through in-depth analysis and feature extraction of dialogue samples, the deep learning model is used to generate user portraits, which solves the problem of insufficient text data analysis in the existing technology and achieves accurate identification of user portraits and personalized medical service support.

CN118132736BActive Publication Date: 2024-10-01QINGDAO GUOCHUANG INTELLIGENT HOME APPLIANCES RES INSTITU +1
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410558526.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-08
Publication Date
2024-10-01
Estimated Expiration
2044-05-08

AI Technical Summary

Technical Problem

The existing technology lacks in-depth analysis of text data, especially question and answer data, resulting in the inability to effectively refine user portraits.

Method used

By obtaining dialogue samples consisting of patient consultations and doctor responses, we conduct in-depth analysis and feature extraction, and use deep learning models such as bidirectional gated recurrent units and capsule convolutional neural networks to generate user portraits.

Benefits of technology

It achieves accurate identification of user portraits from text data, improving the accuracy of user portraits and the ability to support personalized medical services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118132736B_ABST
    Figure CN118132736B_ABST
Patent Text Reader

Abstract

The present invention relates to a training method, a control device and a storage medium for a user portrait recognition system. The method comprises: obtaining a conversation sample, wherein the conversation sample comprises a first reply sample and a first consultation sample, wherein the first reply sample and the first consultation sample use the same label; obtaining a first fusion vector based on the first reply sample and the first consultation sample in the conversation sample; performing feature extraction on the first fusion vector to obtain a second feature vector; obtaining a user portrait based on the second feature vector, and training a user portrait recognition system based on the user portrait and the label through a back propagation algorithm. By obtaining a conversation sample consisting of a first reply sample and a first consultation sample, and performing in-depth analysis and feature extraction on the first reply sample and the first consultation sample after fusion, accurate recognition of the user portrait is achieved through text data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of user portrait recognition, and specifically provides a training method, a control device and a storage medium for a user portrait recognition system. Background Art

[0002] In the existing user portrait construction technology, two main methods are adopted: statistics-based user modeling and model-based user modeling.

[0003] However, the existing technology usually only associates data with user portraits, lacks in-depth analysis of text data, especially lacks analysis of question-answer data, so the existing technology cannot effectively extract user portraits from text data.

[0004] Accordingly, this field needs a new user portrait recognition solution to solve the above problems. Summary of the invention

[0005] In order to overcome the above-mentioned defects, the present invention is proposed to provide a solution or at least partially solve the technical problem in the prior art that user portraits cannot be extracted from text data.

[0006] In a first aspect, the present invention provides a training method for a user portrait recognition system, the method comprising: obtaining a conversation sample consisting of a patient consultation and a doctor's reply, wherein the conversation sample comprises a first reply sample and a first consultation sample, wherein the first reply sample and the first consultation sample use the same label; obtaining a first fusion vector based on the first reply sample and the first consultation sample in the conversation sample; performing feature extraction on the first fusion vector to obtain a second feature vector; obtaining a user portrait based on the second feature vector, and training the user portrait recognition system based on the user portrait and the label through a back propagation algorithm.

[0007] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, the first fusion vector is obtained based on the first reply sample and the first consultation sample in the conversation sample, including: preprocessing based on the first reply sample and the first consultation sample to obtain a first reply vector and a first consultation vector; assigning a first weight to the first reply vector and a second weight to the first consultation vector, and fusing the weighted vectors to obtain a second fusion vector; mapping the second fusion vector to obtain a reply mapping vector and a consultation mapping vector respectively; obtaining a first fusion vector based on the reply mapping vector, the consultation mapping vector, the first reply vector and the first consultation vector.

[0008] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, obtaining a first fusion vector based on the response mapping vector, the consultation mapping vector, the first response vector and the first consultation vector includes: calculating the similarity between the response mapping vector and the first response vector to obtain response similarity; calculating the similarity between the consultation mapping vector and the first consultation vector to obtain consultation similarity; obtaining a first fusion vector based on the response similarity, the consultation similarity, the first response vector and the first consultation vector.

[0009] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, wherein the first weight and / or the second weight are weights that can be changed through self-learning, the method also includes: reducing the dimension and reconstructing the first fusion vector to obtain a reconstructed vector; calculating the loss based on the reconstructed vector and the first fusion vector; and optimizing the first weight and / or the second weight based on the loss.

[0010] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, the user portrait recognition system includes: a bidirectional gated recurrent unit and a capsule convolutional neural network, and the feature extraction of the first fusion vector to obtain the second feature vector includes: performing feature extraction on the first fusion vector based on the bidirectional gated recurrent unit and the capsule convolutional neural network to obtain the second feature vector.

[0011] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, the feature extraction of the first fusion vector based on the bidirectional gated recurrent unit and the capsule convolutional neural network to obtain a second feature vector includes: extracting features of the first fusion vector through the bidirectional gated recurrent unit to obtain a first global vector; extracting features of the first global vector through an attention mechanism to obtain a second global vector; extracting features of the first global vector through the capsule convolutional neural network to obtain a first local vector; and obtaining a second feature vector based on the second global vector and the first local vector.

[0012] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, the second feature vector is obtained based on the second global vector and the first local vector, including: obtaining attention scores of the two based on the second global vector and the first local vector; normalizing the attention scores to obtain a third weight; and obtaining the second feature vector based on the third weight, the second global vector and the first local vector.

[0013] As an alternative or supplement to the above solution, in a method according to an embodiment of the present invention, the user is a patient, the first reply sample includes at least one patient consultation, and the first consultation sample includes at least one doctor's reply.

[0014] In a second aspect, a control device is provided, which includes a processor and a storage device, wherein the storage device is suitable for storing multiple computer programs, and the computer programs are suitable for being loaded and run by the processor to execute the user portrait recognition system training method described in any one of the technical solutions of the user portrait recognition system training method mentioned above.

[0015] In a third aspect, a computer-readable storage medium is provided, which stores a plurality of computer programs, wherein the computer programs are suitable for being loaded and run by a processor to execute the user portrait recognition system training method described in any one of the technical solutions of the user portrait recognition system training method described above.

[0016] The above one or more technical solutions of the present invention have at least one or more of the following beneficial effects:

[0017] In the technical solution of the present invention, by obtaining a conversation sample consisting of a first reply sample and a first consultation sample, and performing in-depth analysis and fusion of the first reply sample and the first consultation sample to perform feature extraction, it is possible to successfully and accurately identify the user portrait through text data. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The disclosure of the present invention will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present invention. In addition, similar numbers in the figures are used to represent similar components, among which:

[0019] Figure 1 is a flowchart of main steps of a method for training a user portrait recognition system according to an embodiment of the present invention;

[0020] Figure 2 is a flowchart of the secondary steps of a training method for a user portrait recognition system according to an embodiment of the present invention;

[0021] Figure 3 is a schematic flow chart of steps for obtaining a first fusion vector according to a training method for a user portrait recognition system according to an embodiment of the present invention;

[0022] Figure 4 is a schematic flow chart of steps for obtaining a second feature vector according to a training method for a user portrait recognition system according to an embodiment of the present invention;

[0023] Figure 5 is a schematic diagram of a process of obtaining a first fusion vector according to a training method of a user portrait recognition system according to an embodiment of the present invention;

[0024] Figure 6 is a GRU schematic diagram of a training method for a user portrait recognition system according to an embodiment of the present invention;

[0025] Figure 7 It is a sub-process diagram of a training method for a user portrait recognition system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0026] Some embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.

[0027] In the description of the present invention, "module" and "processor" may include hardware, software or a combination of the two. A module may include hardware circuits, various suitable sensors, communication ports, and memories, and may also include software parts, such as computer programs, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, hardware, or a combination of the two. Non-temporary computer-readable storage media include any suitable medium that can store computer programs, such as magnetic disks, hard disks, optical disks, flash memory, read-only memory, random access memory, etc. The term "A and / or B" means all possible combinations of A and B, such as only A, only B, or A and B. The term "at least one A or B" or "at least one of A and B" has a similar meaning to "A and / or B", and may include only A, only B, or A and B. The singular terms "one" and "the" may also include plural forms.

[0028] In an example of an application scenario of the present invention, the user is a patient for illustration.

[0029] See attached Figure 1 , Figure 1 FIG. 1 is a flow chart showing the main steps of a method for identifying a user portrait according to an embodiment of the present invention. Figure 1 As shown, the training method of the user portrait recognition system in the embodiment of the present invention mainly includes the following steps A and B.

[0030] Step A: Get the conversation.

[0031] In this embodiment, the conversation consists of patient consultation and doctor response.

[0032] In this embodiment, a conversation refers to a record of communication between a patient and a doctor through an online medical platform or a hospital information system. Each conversation usually includes at least one patient consultation and at least one corresponding doctor response. A patient consultation refers to a patient's inquiry regarding his or her condition or health problem, while a doctor response refers to the doctor's answer and suggestions to the patient's consultation.

[0033] In one implementation, a patient consultation and a doctor's response in a conversation are as follows:

[0034]

[0035] In one implementation, a conversation may include multiple patient consultations and multiple doctor responses, forming a complete communication record.

[0036] Furthermore, in one embodiment, in a conversation, the specific identity of the doctor can be changed, for example, multiple doctors can chat with one patient. That is, in one scenario, the patient himself or the person who describes the patient's symptoms sends one or more patient consultations, and multiple doctors send multiple doctor replies based on the patient consultations.

[0037] Furthermore, in one implementation, the specific identity of a patient in a conversation can be changed, which does not mean that multiple patients appear in one patient consultation, but rather that conversations corresponding to multiple patients are regarded as one conversation.

[0038] In this embodiment, the present application will be described hereinafter with reference to one patient for each patient consultation in the conversation.

[0039] Step B: Input the conversation into the trained user portrait recognition system to obtain the user portrait.

[0040] In this embodiment, the user portrait is a patient portrait.

[0041] In this embodiment, the patient portrait refers to a comprehensive description of the patient's personal characteristics and health status obtained after analysis and processing by the user portrait recognition system based on the patient's consultation and the doctor's response. In this embodiment, the user portrait recognition system is a neural network structure.

[0042] In one embodiment, the patient portrait includes at least one of age, gender, and department. For example, based on the above patient consultation and doctor's response, the patient portrait recognition neural network may recognize that the patient's age is adult, gender is female, and department is gastroenterology. The generation of patient portraits depends on the training and optimization of the patient portrait recognition neural network. The network extracts useful features by learning a large number of similar conversation samples, and classifies and recognizes according to these features, thereby realizing accurate recognition and construction of patient portraits.

[0043] For further information, see Appendix Figure 2 , Figure 2 The diagram is a flow chart of the main steps of a training method for a user portrait recognition system according to an embodiment of the present invention. Specifically, a conversation sample is first obtained, wherein the conversation sample includes a first reply sample and a first consultation sample, wherein the first reply sample and the first consultation sample use the same label.

[0044] Next, the first reply sample and the first consultation sample in the conversation sample are fused into a unified representation, namely the first fused vector. This fusion process usually includes text preprocessing (such as word segmentation, stop word removal, etc.), vectorization (such as using word embedding technology to convert text into vectors), and fusion (such as combining the vector representations of consultation and reply through weighted averaging or concatenation). The generation of the fused vector aims to integrate the information in the consultation and reply to better capture the semantic characteristics of the conversation.

[0045] After that, feature extraction is performed on the first fused vector to obtain the second feature vector. This step involves using deep learning models (such as bidirectional gated recurrent units and capsule convolutional neural networks) to further extract and optimize features. Through these advanced models, more global and local features that are more useful for patient portrait recognition can be extracted from the fused vector.

[0046] Finally, based on the obtained second eigenvector, a classification algorithm (such as softmax regression) is used to predict the patient portrait. During the training process, the system calculates the loss based on the predicted results and the true label, and optimizes the model parameters through the back propagation algorithm. This process is repeated until the performance of the model reaches a satisfactory level.

[0047] Through this series of steps, the user portrait recognition system can learn how to accurately infer the user's portrait information based on the conversation, thereby providing support for personalized medical services.

[0048] like Figure 2As shown, the training method of the user portrait recognition system in the embodiment of the present invention mainly includes the following steps S10-S40, which are as follows: Step S10: Obtain a conversation sample, wherein the conversation sample includes a first reply sample and a first consultation sample.

[0049] In this embodiment, the conversation sample consists of patient consultation and doctor response.

[0050] In this embodiment, the first response sample and the first consultation sample use the same label, where the label is the patient portrait.

[0051] In one embodiment, the conversation samples are generally derived from a healthcare platform, an online medical consultation service, or an electronic medical record system, and include patients' inquiries regarding their health conditions and doctors' responses to these inquiries.

[0052] In this embodiment, the first reply sample and the first consultation sample constitute a conversation sample, and the first reply sample and the first consultation sample share the same label, namely, the patient portrait. This label usually includes information such as the patient's age, gender, symptom description, disease diagnosis, etc., which is used to describe the patient's health status and characteristics. By giving the same label to the patient consultation and the doctor's reply, the system can learn how to identify the patient's portrait based on the content in these conversation samples. In this embodiment, the first reply sample includes at least one doctor's reply, and the first consultation sample includes at least one patient consultation.

[0053] It should be noted that although the first response sample and the first consultation sample share the same label, the processing methods for the two may be different in the subsequent processing. For example, in the subsequent processing, since the first response sample and the first consultation sample have different degrees of association with the patient portrait, different weights may be assigned to the two samples in the subsequent operation, thereby indicating the different degrees of influence of the first response sample and the first consultation sample on the patient portrait.

[0054] Furthermore, in one embodiment, in order to protect patient privacy, all sample data will be desensitized to remove personal identification information, such as the patient's name, birthday, ID number, etc.

[0055] Step S20: Obtain a first fusion vector based on the first reply sample and the first consultation sample in the conversation sample.

[0056] In one implementation, the first response sample and the first consultation sample are fused so that these two types of information can be fully utilized to extract features in subsequent processing, thereby more accurately identifying the patient's portrait.

[0057] In this embodiment, the first fusion vector fuses the first reply sample and the first consultation sample, and has richer semantic information and context information. This fusion method enables subsequent feature extraction and model training to not only consider the patient's own consultation content, but also comprehensively consider the doctor's reply information, so as to more comprehensively understand the patient's health status and needs, and improve the accuracy of patient portrait recognition.

[0058] In one embodiment, the first fusion vector is obtained through steps S201 - S204, as Figure 3 and Figure 5 shown below: Step S201: Preprocess the first reply sample and the first consultation sample to obtain a first reply vector and a first consultation vector.

[0059] In one embodiment, the main purpose of preprocessing is to convert the original text data into a format suitable for machine learning models, while removing noise and irrelevant information to improve the quality and usability of the data.

[0060] In one embodiment, the preprocessing can be divided into two parts. The first part is data processing, and the second part is vector representation.

[0061] In one embodiment, in data processing, a combination of unsupervised and supervised methods is used for data processing. First, the original text is cleaned in an unsupervised manner to remove some irrelevant information, such as links, special symbols, etc. Then, stop words are removed in a supervised manner. Stop words refer to words that frequently appear in the text but do not contribute much to understanding the main content of the text, such as "de" (的), "shi" (是), "zai" (在), etc. Removing these words can reduce noise and highlight the key information of the text. In this embodiment, in the unsupervised method, the removal can be performed according to a predefined stop word list. Further, in this embodiment, word segmentation is then performed. Especially for Chinese text, word segmentation is to split continuous text into individual words. This step is crucial for understanding the semantic structure of the text. Tools such as jieba can be used for word segmentation. For example, the sentence "我今天感觉不太舒服" (I don't feel well today) can be segmented into "我 / 今天 / 感觉 / 不太 / 舒服".

[0062] In the data processing of this embodiment, first, unsupervised data processing is performed by machine, and then supervised processing is performed manually, which can ensure the quality of data processing.

[0063] In one embodiment, in the vectorized representation, the above-mentioned word segmentation after data processing is vectorized. In this process, each word is mapped to a vector of a fixed dimension. These vectors can capture the semantic information and contextual relationship of the vocabulary. Specifically as follows: In this embodiment, the first reply sample and the first consultation sample after data processing are input into the selected word embedding model to obtain the first reply vector and the first consultation vector. In one embodiment, for example, a pre-trained word embedding model such as RoBERTa-wwm-ext is used to perform vectorization operations. RoBERTa-wwm-ext is a language model based on the Transformer architecture. RoBERTa-wwm-ext can learn the deep semantic relationship between words by pre-training on a large-scale text corpus.

[0064] Furthermore, in this embodiment, the first reply sample and the first consultation sample after data processing are input into the selected word embedding model to obtain the first reply vector and the first consultation vector, including: inputting each word in the first reply sample and the first consultation sample after word segmentation into the selected word embedding model to obtain the corresponding first reply vector and the first consultation vector. For example, if the RoBERTa-wwm-ext model is used, each word will be mapped to a 768-dimensional vector. This vector contains the semantic information of the word and its relationship with other words.

[0065] Afterwards, for the first reply sample or the first consultation sample, its representation can be obtained by combining the vectors of the words therein. Common combination methods include averaging, concatenating vectors, etc. In this way, the entire text segment is converted into a vector of fixed dimension, which can be used for subsequent calculations and analysis.

[0066] In this embodiment, the advantage of using the RoBERTa-wwm-ext word embedding model is that, compared with traditional static word vectors (such as Word2Vec), the RoBERTa-wwm-ext model can provide dynamic word vectors based on the context of the word in the sentence, thereby more accurately representing the meaning of the word. And by converting the segmented text into a word vector representation, it can provide high-quality input data for subsequent text analysis and model training, thereby improving the performance of the user portrait recognition system.

[0067] In a specific example, the first reply sample and the first consultation sample after word segmentation are as follows:

[0068] and ,

[0069] Among them, S1 represents the first consultation sample after word segmentation, and S2 represents the first response sample after word segmentation. Indicates the first consultation sample characters, Indicates the first response sample characters.

[0070] Then, the first reply sample and the first consultation sample after word segmentation are input into the RoBERTa-wwm-ext model to learn the representation vectors corresponding to the two samples. Taking the first consultation sample as an example, the first consultation sample is learned through the 12-layer Transformer encoder in the RoBERTa model, and then the output of the 12-layer Transformer encoder is spliced ​​to obtain the vector representation of the two subjects. The specific formula is as follows:

[0071] ,

[0072] in, The first The vector after encoding the characters has a dimension of 768; is the representation before encoding; is the sequence number of the Transformer layer.

[0073] After completing the coding of the entire sequence, we obtained the first response sample and the first consultation sample. Figure 7 The flowchart of this step is as follows: Figure 7 As shown, the embedding representation of the first reply sample and the first consultation sample is:

[0074] ,

[0075] ,

[0076] in, is the first consultation vector in the form of a coding matrix, is the first reply vector in the form of the encoding matrix, express OK, A text matrix of columns.

[0077] Step S202: assigning a first weight to the first reply vector and a second weight to the first consultation vector, and fusing the weighted vectors to obtain a second fused vector.

[0078] In one implementation, the fusion in this step adjusts the contribution of the reply vector and the consultation vector in the fusion process by assigning different weights to achieve more effective information integration.

[0079] In this embodiment, different types of text information may have different importance in constructing a patient portrait. For example, a doctor's reply may contain more professional information about disease diagnosis and treatment, while a patient's consultation may reflect more of the patient's symptoms and concerns. By adjusting the weights, more important information can be emphasized, thereby improving the accuracy and efficiency of the model.

[0080] The fusion process is essentially a weighted summation of two vectors. The second fused vector obtained contains both the reply information and the consultation information, but by adjusting the weights, one aspect of the information can occupy a more important position in the fused vector. This weighted fusion method helps the model better understand and utilize the key information in the text data, providing a more balanced and rich feature foundation for subsequent mapping, feature extraction and classification tasks.

[0081] In one embodiment, the mathematical representation used for fusion is as follows:

[0082] ,

[0083] Where H is the second fusion vector, is the first weight, is the second weight.

[0084] Furthermore, in one embodiment, the first weight and the second weight are not necessarily set independently, that is, two unrelated parameters are used. In one embodiment, the sum of the first weight and the second weight is 1.

[0085] Step S203: Mapping the second fusion vector to obtain a reply mapping vector and a consultation mapping vector respectively.

[0086] In one embodiment, the second fused vector is converted into a reply mapping vector and a consultation mapping vector through a mapping process to further extract and strengthen key information in the text. The mapping process can be linear or nonlinear, depending on the design and requirements of the model.

[0087] In this embodiment, the purpose of the mapping process is to transform the original fusion vector into a higher-dimensional or lower-dimensional space in order to better capture the potential features in the text data. For example, if a linear mapping is used, it can be achieved by matrix multiplication and addition of bias terms; if a nonlinear mapping is used, an activation function such as ReLU or Sigmoid can be introduced to increase the expressive power of the model.

[0088] In this implementation, taking linear mapping as an example, the details are as follows:

[0089] ,

[0090] ,

[0091] in, , is the weight matrix, and is the bias, To consult the mapping vector, is the reply mapping vector.

[0092] In this embodiment, the response mapping vector and the consultation mapping vector obtained by mapping represent the feature representations of the first response vector and the first consultation vector after the mapping process, respectively. These mapping vectors not only retain the key information of the original text, but also enhance the model's ability to capture important features in the text through the conversion of the mapping process.

[0093] Step S204: Obtain a first fusion vector based on the reply mapping vector, the consultation mapping vector, the first reply vector and the first consultation vector.

[0094] In one implementation, further, the first fusion vector is obtained through steps S204 - 1 to S204 - 3 , which are specifically as follows: Step S204 - 1 : Calculate the similarity between the restored mapping vector and the first restored vector to obtain the restored similarity.

[0095] In one implementation, the similarity can be calculated using a variety of methods, such as cosine similarity, Euclidean distance, Jaccard similarity, Pearson correlation coefficient, average inner product, etc.

[0096] The mathematical representation of reply similarity is as follows:

[0097] ,

[0098] Where p2 represents the similarity between the reply mapping vector and the first reply vector, Indicates the similarity calculation method used.

[0099] In one implementation, the average inner product is used to calculate the similarity. Specifically, the inner product between two vectors is first calculated, and then the inner product value is divided by the number of dimensions of the vectors to obtain the average inner product value as a measure of the similarity.

[0100] The calculation formula of the average inner product can be expressed as: similarity (recovery mapping vector dot product first recovery vector) / vector dimension, where dot product represents the inner product operation of the vector, and the vector dimension is the number of elements in the vector.

[0101] Step S204 - 2 : Calculate the similarity between the consultation mapping vector and the first consultation vector to obtain the consultation similarity.

[0102] In one implementation, the mathematical representation of the consultation similarity is as follows:

[0103] ,

[0104] in The similarity between the consultation mapping vector and the first consultation vector is represented by the similarity calculation method similar to step S204-1, which will not be described again.

[0105] Step S204 - 3 : obtaining a first fusion vector based on the reply similarity, the consultation similarity, the first reply vector and the first consultation vector.

[0106] In one implementation, using consultation similarity Similarity to reply , normalized by the softmax function, and the corresponding contribution is obtained and The function of the softmax function is to convert the similarity into a probability distribution, ensure that the sum of the contributions is 1, and highlight the parts with higher similarity. The calculation formula is as follows: Re-weighted combination: Then, according to the calculated contribution and , for the first consulting vector and the first reply vector Perform re-weighted combination. Get the first fusion vector The calculation formula is as follows:

[0107] ,

[0108] In this embodiment, through the above steps, the first fusion vector obtained fully combines the information of the first reply vector and the first consultation vector, and dynamically adjusts the contribution ratio of the two in the fusion vector according to the different similarities. Such a fusion method can better capture the correlation and distinction between patient consultation and doctor's reply, and provide a richer and deeper information basis for subsequent tasks such as feature extraction, classification and patient portrait generation. This comprehensive fusion method helps the model to understand and process medical text data more comprehensively, and improve the performance and accuracy of the model.

[0109] Furthermore, in step S20, the first weight and / or the second weight are weights that can be changed through self-learning, and step S20 also includes: reducing the dimension and reconstructing the first fusion vector to obtain a reconstructed vector; calculating the loss based on the reconstructed vector and the first fusion vector; and optimizing the first weight and / or the second weight at least based on the loss.

[0110] In one embodiment, in order to enable the model to automatically modify the first weight and the second weight to better complete information fusion, the first fusion vector is passed into a dynamic learning module. This module contains two fully connected layers and The first fully connected layer Used to Convert to an auto-fused vector , and the second fully connected layer Used to Reconstruct back into a vector , the reconstructed vector and the first fusion vector Same dimensions.

[0111] Loss function and optimization: To measure the reconstruction vector Fusion vector with the original The similarity between them is measured using the mean square error (MSE) as the loss function:

[0112] ,

[0113] in, is the total dimension of the vector, and i is the dimension in which the vector is located. This loss function measures and By minimizing this loss, the model learns how to better reconstruct the original fusion vector and optimizes the first weight and the second weight in the process. These weights are variable through self-learning, which means that they will automatically adjust according to the back propagation of the loss function to achieve the best fusion effect. In this embodiment, this loss function will work together with other loss functions and optimize the first weight and / or the second weight.

[0114] In this embodiment, this method enables the first weight and the second weight to accurately judge which part is more important, patient consultation or doctor's response, in the process of obtaining a patient portrait during the self-learning process, thereby obtaining appropriate weights for the more important parts through self-learning.

[0115] Step S30: extracting features from the first fusion vector to obtain a second feature vector.

[0116] In one implementation, feature extraction is performed on the first fusion vector based on a bidirectional gated recurrent unit and a capsule convolutional neural network to obtain a second feature vector.

[0117] In one embodiment, feature extraction is performed on the first fusion vector by combining a bidirectional gated recurrent unit (Bi-GRU) and a capsule convolutional neural network (CapsuleCNN), aiming to fully extract the global and local information in the first fusion vector to improve the performance of the user portrait recognition system.

[0118] In this embodiment, the bidirectional gated recurrent unit can capture the contextual information in the text by processing the sequence data in two directions, so as to better understand the semantic relationship. In addition, the update gate and reset gate mechanism of the GRU unit help solve the gradient vanishing problem, enabling the model to learn longer-distance dependencies. The capsule convolutional neural network can capture the hierarchical relationship between local features through a dynamic routing mechanism, retain the spatial information of the features, and improve the model's sensitivity to small changes in the input. The dual-channel feature extraction network that combines the bidirectional gated recurrent unit and the capsule convolutional neural network can provide a more comprehensive and accurate feature representation, thereby improving the accuracy and robustness of patient portrait recognition.

[0119] Furthermore, in this embodiment, the GRU unit introduces the update gate and reset gate mechanism, which helps to solve the gradient vanishing problem in the traditional RNN, so that the model can learn longer-distance dependencies. Compared with the traditional convolutional neural network (CNN), the capsule convolutional neural network can retain the spatial information of the features, which helps to better understand the positional relationship and context structure of the text corresponding to each part in the first fusion vector.

[0120] In this embodiment, since there are many categories of subsequent patient portraits and there are many options in each category, in this embodiment, the use of the above technology can enhance the model's ability to accurately search for specific categories in patient portraits by improving the ability to understand the first fusion vector.

[0121] In one embodiment, the second feature vector is obtained through steps S301-S304, such as Figure 4 As shown, the details are as follows: Step S301: extract features from the first fusion vector through a bidirectional gated recurrent unit to obtain a first global vector.

[0122] In one embodiment, the bidirectional gated recurrent unit is provided with a dropout module, wherein the function of the dropout module is to prevent overfitting. When dealing with complex natural language processing tasks in this application, the model often has a large number of parameters. This makes the model have a strong fitting ability, but it is also prone to overfitting, that is, the model performs well on the training data, but performs poorly on unseen test data. Dropout is a commonly used regularization technique that can effectively reduce the risk of overfitting by randomly discarding a portion of neurons during the training process. The GRU unit such as Figure 6 shown.

[0123] Further, the first fusion vector is feature extracted by the following formula to obtain the first global vector, which is as follows: In one embodiment, the first fusion vector is first passed through a fully connected layer to obtain an automatic fusion vector , and then the automatic fusion vector is used for subsequent feature extraction.

[0124] Compute update gate and reset gate , the main function of these two gates is to adjust the ratio of input, forgetting and output in the gated recurrent unit (GRU):

[0125] ,

[0126] ,

[0127] Calculate candidate values :

[0128] ,

[0129] ,

[0130] After the bidirectional GRU calculation, the hidden layer output features are obtained , and on the basis of global feature extraction, introduce the attention mechanism to focus on the weight information of different positions and allocate more attention to important semantic information:

[0131] ,

[0132] ,

[0133] ,

[0134] The global correlation information is obtained through the Bi-GRU gating mechanism, and the input sequence is processed from the forward and reverse directions. After attention weighting, the first global vector that integrates the context information is obtained. .

[0135] in Sigmoid activation function is used to compress the value between 0 and 1. It is used here to control the amount of information retained. is the weight matrix of the update gate, which is used as the input of the current time step . is the input vector for the current time step. is the recurrent weight matrix of the update gate, used for the hidden state of the previous time step . is the hidden state of the previous time step. is the bias term for the update gate.

[0136] To reset the gate weight matrix, used for the input of the current time step . Reset the gate's recurrent weight matrix to the hidden state at the previous time step . is the bias term for the reset gate. is a hyperbolic tangent activation function, which is used to compress the values ​​between -1 and 1 and provide non-linear activation for candidate hidden states. is the weight matrix of the candidate hidden state, used as input for the current time step . is the recurrent weight matrix of the candidate hidden state, used to reset the hidden state of the previous time step after the gate is adjusted . is the bias term for the candidate hidden state.

[0137] To apply the dropout operation to reduce overfitting, is the dropout probability .and Denote the hidden state outputs of the forward and reverse GRUs, respectively.

[0138] Step S302: extract features from the first global vector through an attention mechanism to obtain a second global vector.

[0139] In one implementation, the second global vector is obtained by the following formula.

[0140] ,

[0141] ,

[0142] in The intermediate variable used to calculate the attention score is usually obtained by comparing the hidden states at different time steps. is the attention weight, which indicates the importance of each time step when aggregating the hidden state.

[0143] Attention By weighted averaging the hidden states of all time steps, according to the attention weights Aggregation is performed to obtain the final feature representation.

[0144] Step S303: extract features from the first global vector using a capsule convolutional neural network to obtain a first local vector.

[0145] In one implementation, the capsule convolutional neural network is mainly composed of a convolutional layer, a main layer capsule layer, and a sub-layer capsule layer. The details are as follows:

[0146] The features are extracted at different positions of the first global vector through multiple different convolution kernels, using the convolution kernel Perform sliding convolution on the input sequence and introduce nonlinear changes through the activation function:

[0147] ,

[0148] ,

[0149] in, is the size of the convolution kernel, is the weight of the convolution kernel, and b is the bias term. is the convolution output, which is used to calculate the convolution sum of the input sequence and the convolution kernel, plus the bias term for.

[0150] is the convolution output processed by the ReLU activation function.

[0151] Then, the dynamic routing operation is used to replace the pooling operation in the prior art to extract the features of the capsule layer, and the output sequence is passed to the main capsule layer for affine transformation, so that the output of the convolution operation is replaced from scalar output to vector output, and the capsule vector is multiplied by the weight matrix to map it into a vector :

[0152] ,

[0153] Among them, i represents the sub-layer capsule, j represents the main layer capsule, represents the weight matrix.

[0154] and coupling coefficient Weighted summation is used to distribute the weights and obtain the output nodes :

[0155] ,

[0156] Among them, c is the coupling coefficient, which is iteratively updated by the dynamic routing algorithm and is calculated as follows:

[0157] ,

[0158] Then, the vector is squashed using the Squash function. Compress to get the first local vector:

[0159] ,

[0160] in is the vector after affine transformation, and the weight matrix from the sub-layer capsule i to the main layer capsule j is The output of the sub-layer capsule is To multiply is to get.

[0161] is the weight matrix used for the affine transformation from the sub-layer capsule layer to the main-layer capsule layer, converting the output of the sub-layer capsule into the input format of the corresponding main-layer capsule.

[0162] is the coupling coefficient, which is iteratively updated by the dynamic routing algorithm, indicating that the sub-layer capsule is is the contribution weight to the main layer capsule j.

[0163] It is a vector compressed by the Squash function, which is used to ensure that the length of the output vector is between 0 and 1 and keep the direction of the vector unchanged. The Squash function enables the output of the capsule network to express probability predictions and maintain the hierarchical structure between the vectors.

[0164] Step S304: obtaining a second eigenvector based on the second global vector and the first local vector.

[0165] In one implementation, the second feature vector is obtained by combining the global features and the local features and performing a weighted summation on them using an attention mechanism. Specifically, as follows:

[0166] In one embodiment, the second global vector is the global feature extracted by the bidirectional gated recurrent unit (Bi-GRU) and the attention mechanism, and the first local vector It is a local feature extracted by Capsule Convolutional Neural Network (CapsuleCNN). The combination of global features and local features can provide a more comprehensive and rich text representation.

[0167] Then, in order to effectively combine global features and local features, we first calculate the similarity between them. Set the global feature H and local feature P to K and Q respectively, and calculate the similarity between them to get the attention score a:

[0168] ,

[0169] Each element Indicates a specific key For inquiries The importance of. : Used for calculation query With key The function of the similarity or association between .

[0170] Among them, F is the similarity calculation function, which can usually be a dot product or other similarity measurement methods. Then, the attention score is normalized to obtain the third weight :

[0171] ,

[0172] in is the attention weight, which is calculated by normalizing the softmax function and is used to balance the contributions of different components. : Convert the score obtained by the dot product into a probability distribution, the formula is , ensuring that the sum of all weights is is the unnormalized attention score.

[0173] This step converts the attention score into a probability distribution, indicating the contribution of each local feature to the global feature. Then, the local features are weighted and summed according to the third weight to obtain the output R of the attention mechanism:

[0174] ,

[0175] ,

[0176] Among them, Attention The final attention output is calculated by weighted sum, where K is the key set and V is the value set. It is a query. : According to the calculated weight Pair Value Perform weighted summation to synthesize the final vector , for subsequent processing.

[0177] Finally, the attention mechanism output is As the second feature vector, it combines global features and weighted local features, providing a more accurate and comprehensive feature representation for subsequent user portrait classification tasks.

[0178] In summary, step S304 combines global features and local features and uses the attention mechanism for weighted summation to obtain a second feature vector that contains the overall semantics of the text and key detail information. This feature representation method helps improve the performance of the user portrait recognition system and more accurately capture the health status and needs of patients.

[0179] Step S40: Obtain a user portrait based on the second feature vector, and train the user portrait recognition system through a back propagation algorithm based on the user portrait and the label.

[0180] In one embodiment, the second feature vector obtained by feature extraction and fusion is Input into a softmax classifier. The role of the softmax classifier is to map the feature vector to the probability distribution of each patient portrait category. Specifically, for each patient portrait category, calculate its corresponding probability :

[0181] ,

[0182] Where n is the total number of patient portrait categories, is the eigenvector The value of the i-th element in . : The feature vector Each element of The probability of conversion to category i, n is the total number of categories.

[0183] This formula obtains the probability value of each category by performing an exponential operation on each element of the feature vector and normalizing it.

[0184] Based on the probability distribution output by the softmax classifier, we can determine the patient profile category that each sample is most likely to belong to. Specifically, for each sample, the category with the largest probability value is selected as the predicted category of its patient profile: , through which Select the class index with the highest predicted probability.

[0185] This step actually selects the category with the highest probability as the predicted label of the sample, thereby completing the identification of the patient portrait.

[0186] The resulting patient profile can be interpreted based on predefined category labels. For example, if the patient profile categories include different disease types, then the label for each category may be "heart disease", "diabetes", etc. Based on the predicted category, the patient's health status can be interpreted and analyzed accordingly.

[0187] Furthermore, in one implementation, the model is debugged through a training set to evaluate the operating effect of the model, and then a portion of representative samples are selected as a test set to repeatedly test the model to detect the classification performance of the model on unlearned samples.

[0188] In one implementation, the model is measured using precision, recall, and F1 value to verify the accuracy of the model in patient user portraits. The calculation formulas for each indicator are as follows:

[0189] ,

[0190] Among them, TP represents the number of positive samples judged correctly, and FP represents the number of positive samples judged as negative samples.

[0191] ,

[0192] Among them, FN is the number of negative sample misjudgments.

[0193] ,

[0194] Among them, the F1 value is the harmonic mean of precision and recall.

[0195] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effects of the present invention, different steps do not have to be performed in such an order. They can be performed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present invention.

[0196] It is understood by those skilled in the art that the present invention implements all or part of the processes in the method of the above embodiment, and can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of each of the above method embodiments when executed by the processor. Among them, the computer program includes a computer program, and the computer program can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium that can carry the computer program. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable storage medium does not include electric carrier signals and telecommunication signals.

[0197] Furthermore, the present invention also provides a control device. In an embodiment of a control device according to the present invention, the control device includes a processor and a storage device, the storage device can be configured to store a program for executing a training method for a user portrait recognition system of the above method embodiment, and the processor can be configured to execute the program in the storage device, which includes but is not limited to a program for executing a training method for a user portrait recognition system of the above method embodiment. For ease of explanation, only the parts related to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The control device can be a control device device formed by various electronic devices.

[0198] Furthermore, the present invention also provides a computer-readable storage medium. In a computer-readable storage medium embodiment according to the present invention, the computer-readable storage medium can be configured to store a program for executing the training method of the user portrait recognition system of the above-mentioned method embodiment, and the program can be loaded and run by the processor to implement the training method of the above-mentioned user portrait recognition system. For ease of explanation, only the parts related to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The computer-readable storage medium can be a storage device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present invention is a non-temporary computer-readable storage medium.

[0199] Further, it should be understood that since the setting of each module is only for illustrating the functional units of the device of the present invention, the physical devices corresponding to these modules may be the processor itself, or a part of the software in the processor, a part of the hardware, or a part of the combination of software and hardware. Therefore, the number of each module in the figure is only schematic.

[0200] Those skilled in the art will appreciate that the modules in the device can be adaptively split or merged. Such splitting or merging of specific modules will not cause the technical solution to deviate from the principle of the present invention, and therefore, the technical solutions after splitting or merging will fall within the protection scope of the present invention.

[0201] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. A training method for a user portrait recognition system, It is characterized in that include: Acquire a conversation sample, wherein the conversation sample includes a first reply sample and a first consultation sample, wherein the first reply sample and the first consultation sample use the same label; Obtaining a first fusion vector based on the first reply sample and the first consultation sample in the conversation sample; Performing feature extraction on the first fusion vector to obtain a second feature vector; Obtaining a user portrait based on the second feature vector, and training a user portrait recognition system through back propagation based on the user portrait and the label; The obtaining a first fusion vector based on the first reply sample and the first consultation sample in the conversation sample includes: Preprocessing is performed based on the first reply sample and the first consultation sample to obtain a first reply vector and a first consultation vector; Assigning a first weight to the first reply vector and a second weight to the first consultation vector, and fusing the weighted vectors to obtain a second fused vector, wherein the first weight and / or the second weight are weights that can be changed through self-learning; By mapping the second fusion vector, a reply mapping vector and a consultation mapping vector are obtained respectively; A first fusion vector is obtained based on the reply mapping vector, the consultation mapping vector, the first reply vector and the first consultation vector.

2. The training method of the user portrait recognition system according to claim 1, It is characterized in that The obtaining of a first fusion vector based on the reply mapping vector, the consultation mapping vector, the first reply vector and the first consultation vector comprises: Calculating the similarity between the reply mapping vector and the first reply vector to obtain reply similarity; Calculating the similarity between the consultation mapping vector and the first consultation vector to obtain consultation similarity; A first fusion vector is obtained based on the reply similarity, the consultation similarity, the first reply vector and the first consultation vector.

3. The training method of the user portrait recognition system according to claim 1, It is characterized in that The method further comprises: Performing dimensionality reduction and reconstruction on the first fused vector to obtain a reconstructed vector, wherein the reconstructed vector has the same dimension as the first fused vector; Calculating a loss based on the reconstructed vector and the first fused vector; The first weight and / or the second weight are optimized based at least on the loss.

4. The training method for the user portrait recognition system according to claim 1, It is characterized in that The user portrait recognition system includes: a bidirectional gated recurrent unit and a capsule convolutional neural network. The feature extraction of the first fusion vector to obtain the second feature vector includes: Based on the bidirectional gated recurrent unit and the capsule convolutional neural network, feature extraction is performed on the first fusion vector to obtain a second feature vector.

5. The training method for the user portrait recognition system according to claim 4, It is characterized in that The step of extracting features from the first fusion vector based on the bidirectional gated recurrent unit and the capsule convolutional neural network to obtain a second feature vector includes: Performing feature extraction on the first fusion vector by using the bidirectional gated recurrent unit to obtain a first global vector; Extract features from the first global vector through an attention mechanism to obtain a second global vector; Performing feature extraction on the first global vector by using the capsule convolutional neural network to obtain a first local vector; A second eigenvector is obtained based on the second global vector and the first local vector.

6. The training method for the user portrait recognition system according to claim 5, It is characterized in that The obtaining a second eigenvector based on the second global vector and the first local vector comprises: Based on the second global vector and the first local vector, obtaining attention scores of the two; Normalizing the attention score to obtain a third weight; A second eigenvector is obtained based on the third weight, the second global vector, and the first local vector.

7. The training method for the user portrait recognition system according to claim 1, It is characterized in that The user is a patient, the first response sample includes at least one patient consultation, and the first consultation sample includes at least one doctor's response.

8. A control device comprising a processor and a storage device, wherein the storage device is suitable for storing a plurality of computer programs. It is characterized in that The computer program is suitable for being loaded and run by the processor to execute the training method of the user portrait recognition system according to any one of claims 1 to 7.

9. A computer-readable storage medium having a plurality of computer programs stored therein, It is characterized in that The computer program is suitable for being loaded and run by a processor to execute the training method for a user portrait recognition system according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Dialogue-based user portrait generation method and device

    CN111798279A

  • User portrait label mining method and device based on session scene

    CN113704436A

  • Method and device for constructing user portrait based on inquiry session, equipment and medium

    CN113724882A

  • Multi-tag identification method and device, electronic equipment and storage medium

    CN114358007A

  • Conversation generation method fusing basic knowledge and user information

    CN116010575A