Intelligent drug recommendation method and system based on speech recognition
By employing a multi-head attention mechanism and cosine similarity calculation, combined with encryption algorithms, the problem of insufficient semantic information capture in existing drug recommendation systems is solved, achieving high accuracy and personalization in drug recommendations, and improving system security and data protection.
Patent Information
- Application Number
- CN202411398043.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-10-09
AI Technical Summary
Existing intelligent drug recommendation systems rely on simple semantic matching and keyword search, which cannot effectively capture subtle differences and multi-level semantic information in users' voice expressions, and it is difficult to comprehensively consider the interaction between drugs, thus limiting the accuracy and personalization of the recommendation results.
A drug intelligent recommendation method based on multi-head attention mechanism is adopted. By constructing semantic representation vectors and drug feature vectors, calculating weighted sum vectors, generating comprehensive feature vectors, and using cosine similarity to calculate the matching score between drugs and users, a drug recommendation list is finally generated, and the data is stored and uploaded using an encryption algorithm.
It improves the accuracy and personalization of drug recommendations, enabling more precise capture of the match between user needs and drug characteristics, thereby enhancing the accuracy and security of the recommendation system and preventing data leakage and tampering.
Smart Images

Figure CN118897891B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of drug recommendation, and in particular to a method and system for intelligent drug recommendation based on speech recognition. Background Art
[0002] Drugs usually have complex instructions for use, which include a lot of usage specifications and contraindications. With the development of natural language processing (NLP) technology, especially the improvement of speech recognition and semantic understanding technology, the medical field has begun to try to use voice data for health management and drug recommendations;
[0003] However, most existing intelligent drug recommendation systems rely on simple semantic matching and keyword search, which fail to capture the subtle differences in user voice expressions and multi-level semantic information, resulting in limited accuracy and personalization of recommendation results. Secondly, traditional drug recommendation systems mostly rely on predefined rules or simple statistical models, which make it difficult to comprehensively consider the user's description and the interaction between drugs, reducing the efficiency of drug recommendations. Summary of the invention
[0004] In view of the problems existing in the above-mentioned existing intelligent drug recommendation method and system based on speech recognition, the present invention is proposed.
[0005] Therefore, the problem to be solved by the present invention is that most of the existing intelligent drug recommendation systems rely on simple semantic matching and keyword search, and fail to capture the subtle differences in user voice expressions and multi-level semantic information, resulting in limited accuracy and personalization of recommendation results. Secondly, traditional drug recommendation systems mostly rely on predefined rules or simple statistical models, which make it difficult to comprehensively consider the user's description and the interaction between drugs, reducing the efficiency of drug recommendations.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions: a method for intelligent drug recommendation based on speech recognition, which comprises:
[0007] Collect user voice data and drug data to construct semantic representation vectors and drug feature vectors;
[0008] Based on the multi-head attention mechanism, the weighted sum value vector is calculated, the weighted sum value vector of multiple heads is integrated to output the comprehensive feature vector, and the demand probability of the drug is calculated;
[0009] Calculate the drug recommendation score based on the comprehensive feature vector, build a two-dimensional comparison matrix to analyze the matching score between drugs and users, and calculate the total score of the drug based on the demand probability of the drug;
[0010] Generate a recommendation list based on the total score of the drug, and use an encryption algorithm to store and upload the data.
[0011] As a preferred solution of the method for intelligent drug recommendation based on speech recognition of the present invention, wherein: the collecting of user speech data and drug data, and the construction of semantic representation vectors and drug feature vectors include:
[0012] Collect voice data based on different users, and remove noise from the collected voice data through bandpass filtering;
[0013] Use the speech recognition model DeepSpeech to convert the noise-removed speech data into text data;
[0014] Use the pre-trained language model BERT to input text data into the model, and the language model BERT outputs a semantic representation vector ;
[0015] Based on the existing drug data set, collect detailed drug information and drug-drug interaction data;
[0016] The drug attributes, ingredients, and indications information are used as drug feature nodes to construct a graph structure. The graph embedding algorithm Node2Vec is used to construct the feature vector of each drug node. The drug node embedding vector is used as the drug feature vector. .
[0017] As a preferred solution of the method for intelligent drug recommendation based on speech recognition of the present invention, wherein: the weighted sum value vector is calculated based on the multi-head attention mechanism, including:
[0018] Based on the multi-head attention mechanism, the query vector, key vector and value vector are defined according to the semantic representation vector and the drug feature vector, respectively, as follows:
[0019] ;
[0020] ;
[0021] ;
[0022] in , and are the weight matrices of the i-th query vector, i-th key vector and i-th value vector, respectively. , and denote the i-th query vector, i-th key vector and i-th value vector respectively, and denote the semantic representation vector and drug feature vector respectively;
[0023] And a weighted sum value vector is calculated based on the query vector, the shutdown vector and the value vector.
[0024] As a preferred solution of the method for intelligent drug recommendation based on speech recognition of the present invention, wherein: the weighted sum value vector of the comprehensive multi-head outputs a comprehensive feature vector, and calculates the demand probability of the drug, including:
[0025] The calculation based on the weighted sum value vector concatenates the outputs of all weighted sum value vectors, expressed as:
[0026] ;
[0027] in represents the comprehensive feature vector, represents the hth weighted sum value vector, represents the concatenated vector of the comprehensive feature vector output;
[0028] Calculate the loss using the cross entropy loss function over the training set;
[0029] The output after linear layer mapping is determined based on the comprehensive feature vector, which is expressed as:
[0030] ;
[0031] in represents the comprehensive feature vector output after the i-th linear layer mapping, represents the linear weight for drug i, represents the bias term;
[0032] The sigmoid function is used to convert the matching feature vector of user semantic features and drug features into the probability of selecting a drug, which is expressed as:
[0033] ;
[0034] in represents the demand probability of drug i;
[0035] Use the Adam optimizer to calculate the loss L for each parameter matrix by gradient descent. , and as well as and The gradient value is calculated and the parameters are iteratively optimized. When the loss L calculated in the continuous iteration process no longer decreases significantly, the iterative output parameters are stopped.
[0036] As a preferred solution of the method for intelligent drug recommendation based on speech recognition of the present invention, wherein: the drug recommendation score is calculated based on the comprehensive feature vector, a two-dimensional comparison matrix is constructed to analyze the matching score between the drug and the user, and the total score of the drug is calculated by comprehensively analyzing the demand probability of the drug, including:
[0037] Based on the comprehensive feature vector of the multi-head attention calculation output, a vector is constructed based on the output of the h heads included, and the drug feature vector The vectors are constructed for the characteristics of each drug, which are expressed as follows:
[0038] ;
[0039] ;
[0040] in represents the final output of the multi-head attention mechanism, Represents the characteristics of the nth drug;
[0041] The cosine similarity is introduced to accurately match the output of each head of the comprehensive feature vector and the characteristics of each drug, which is expressed as:
[0042] ;
[0043] in represents the recommendation score of drug i, represents the transpose of the i-th drug feature;
[0044] Sequentially compare the user's semantic expression with drug features;
[0045] Construct a two-dimensional contrast matrix M, where The matching score between the i-th component of the user demand vector and the j-th component of the drug feature vector is expressed as:
[0046] ;
[0047] ;
[0048] in represents the i-th user semantic vector, represents the j-th drug feature vector, represents the cosine similarity between the i-th user semantic vector and the j-th drug feature vector, Indicates skipping the jth component of the drug feature vector and only considering the best matching scores between the first i−1 components of the user semantic vector and the first j components of the drug feature. Indicates skipping the i-th component of the user semantic vector and only considering the best matching scores of the first i components of the user semantic vector and the first j-1 components of the drug feature vector. represents the best score of the previous match, represents the transpose calculation of the j-th drug feature vector;
[0049] according to The calculation fills the matrix M, and selects the cumulative score in the matrix as the final matching score of drug i;
[0050] Taking into account the demand probability and recommendation score of drug i, the total score of the drug is calculated and expressed as:
[0051] ;
[0052] in represents the total score of drug i, represents the final matching score of drug i, represents the demand probability of drug i.
[0053] As a preferred solution of the method for intelligent drug recommendation based on speech recognition of the present invention, wherein: the recommendation list is generated based on the total score of the drug, including:
[0054] Calculate the total score of all drugs and count the maximum and minimum values of the total score;
[0055] The total scores of the drugs are standardized, and all drugs are sorted from high to low according to the standardized scores to generate a drug recommendation list.
[0056] As a preferred solution of the method for intelligent drug recommendation based on speech recognition of the present invention, wherein: the use of encryption algorithm to store and upload data includes:
[0057] The drug recommendation score data is encrypted using the AES encryption algorithm and stored in categories according to the source users of the semantic representation vectors;
[0058] Establish a secure connection with the remote server through SFTP, and upload the encrypted data file to the specified server directory for secure data transmission;
[0059] Log files that record data storage and upload, including the time of data encryption, key usage, and encrypted file name information.
[0060] Another object of the present invention is to provide a system for intelligent drug recommendation method based on speech recognition, which comprises:
[0061] The data collection module collects the user's voice data, collects and processes the detailed information and efficacy data of the drug, performs preprocessing, and generates feature vectors;
[0062] The multi-head attention module calculates the matching score between the semantic representation vector and the drug feature vector based on the multi-head attention mechanism and generates a weighted sum value vector;
[0063] The drug recommendation score calculation module calculates the drug recommendation score and the user demand matching score based on the comprehensive feature vector and the two-dimensional comparison matrix, and generates the total score of the drug;
[0064] The recommendation list generation module sorts the drugs based on their total scores and generates the final drug recommendation list;
[0065] The data storage module encrypts the drug recommendation data and uploads the data to the remote server for storage through a secure channel.
[0066] A computer device comprises: a memory and a processor; the memory stores a computer program, and the processor implements the steps of the above-mentioned method for intelligent drug recommendation based on speech recognition when executing the computer program.
[0067] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned method for intelligent drug recommendation based on speech recognition.
[0068] The beneficial effects of the present invention are as follows: through the multi-head attention mechanism, the multi-dimensional matching relationship between users and drugs can be fully expressed, so as to more accurately capture the matching degree between user needs and drug features, and the user's semantic demand information and drug feature information are matched in multiple dimensions by comprehensive feature vectors, and the calculation of cosine similarity is cited, so that the similarity between user needs and drug features in various dimensions can be clearly judged, and the accuracy of matching results can be improved; by performing a detailed comparison of the user's semantic expression with the drug features component by component, the order and relationship matching problems between the semantic expression and the drug features can be effectively solved, and the order information of each component in the user's semantic expression is fully considered to improve the accuracy of recommendations. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0070] Figure 1 This is a flowchart of the intelligent drug recommendation method based on speech recognition.
[0071] Figure 2 This is a structural diagram of the intelligent drug recommendation system based on speech recognition. DETAILED DESCRIPTION
[0072] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings.
[0073] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0074] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor is it a separate or selective embodiment that is mutually exclusive with other embodiments.
[0075] Example 1, reference Figure 1 , which is the first embodiment of the present invention, and provides a method for intelligently recommending drugs based on speech recognition. The method for intelligently recommending drugs based on speech recognition includes:
[0076] S1, collect user voice data and drug data, and construct semantic representation vectors and drug feature vectors;
[0077] Preferably, collecting user voice data and drug data, constructing a semantic representation vector and a drug feature vector, includes:
[0078] Collect voice data based on different users, and remove noise from the collected voice data through bandpass filtering;
[0079] Use the speech recognition model DeepSpeech to convert the noise-removed speech data into text data;
[0080] Use the pre-trained language model BERT to input text data into the model, and the language model BERT outputs a semantic representation vector ;
[0081] Based on the existing drug data set, collect detailed drug information and drug-drug interaction data;
[0082] The drug attributes, ingredients, and indications information are used as drug feature nodes to construct a graph structure. The graph embedding algorithm Node2Vec is used to construct the feature vector of each drug node. The drug node embedding vector is used as the drug feature vector. .
[0083] By collecting voice data from different users and using bandpass filtering to remove noise, the accuracy of the speech recognition model can be effectively improved. Data cleaning and noise reduction based on the voice characteristics of individual users can reduce the model's sensitivity to background noise, allowing the model to more accurately understand the user's voice content. The denoised voice data is converted into text using the DeepSpeech model, and then the pre-trained BERT model is used to perform semantic analysis on the text data, which can accurately capture the subtle semantic differences in user expressions. By forming a feature vector for the drug, the multi-dimensional attribute information of the drug (such as ingredients, efficacy, indications, etc.) can be comprehensively considered, which helps to capture the complex relationship and interaction between drugs and provide a more comprehensive feature representation for drug recommendations. By embedding drug node information into the vector space, a multi-dimensional feature representation can be constructed for each drug. Compared with the traditional keyword or rule-based drug matching method, the graph embedding method can more accurately express the relationship and difference between drugs, significantly improving the expressiveness and generalization capabilities of the recommendation system.
[0084] S2, based on the multi-head attention mechanism, calculates the weighted sum value vector, integrates the weighted sum value vectors of multiple heads to output a comprehensive feature vector, and calculates the demand probability of the drug;
[0085] Preferably, based on the multi-head attention mechanism, the weighted sum value vector is calculated, including:
[0086] Based on the multi-head attention mechanism, the query vector, key vector and value vector are defined according to the semantic representation vector and the drug feature vector, respectively, as follows:
[0087] ;
[0088] ;
[0089] ;
[0090] in , and are the weight matrices of the i-th query vector, i-th key vector and i-th value vector, respectively. , and denote the i-th query vector, i-th key vector and i-th value vector respectively, and denote the semantic representation vector and drug feature vector respectively;
[0091] The query vector represents the information to be "queried" at present, which will be matched with the key vector to find the most relevant information. The key vector is used to represent the characteristics of the candidate information and will be compared with the query vector to determine whether it matches the query vector. The value vector usually contains detailed information about the drug;
[0092] And the weighted sum value vector is calculated based on the query vector, the shutdown vector and the value vector, which is expressed as:
[0093] ;
[0094] in represents the i-th weighted sum value vector, represents the transpose calculation of the i-th key matrix, Represents the mapping of the same feature quantity value between the semantic representation vector and the drug feature vector. Based on the dimension of the semantic representation vector and the different dimensions of the drug feature vector (the number of vector features), re-match and define the same feature quantity of the semantic representation vector and the drug feature vector, usually 64.
[0095] The multi-head attention mechanism can use multiple heads (multiple query-key-value combinations) to focus on different aspects of user semantic needs and drug characteristics. The query-key-value setting matches the user's semantic needs and the characteristic information of the drug, which can accurately capture the user's personalized needs and improve the accuracy of the recommendation system and user satisfaction. Through the combination of multi-head weighted summation value vectors, the user needs and different dimensions of drug characteristics can be weighted and summed, thereby improving the overall information extraction capability. By defining the semantic representation vector and the drug feature vector as the query vector, the key vector and the value vector, and using the multi-head attention mechanism for weighted summation calculation, the accuracy, personalization and interpretability of the drug recommendation system can be effectively improved.
[0096] Furthermore, the weighted sum value vector of the integrated multi-head is output as a comprehensive feature vector, and the demand probability of the drug is calculated, including,
[0097] The calculation based on the weighted sum value vector concatenates the outputs of all weighted sum value vectors, expressed as:
[0098] ;
[0099] in represents the comprehensive feature vector, represents the hth weighted sum value vector, represents the concatenated vector of the comprehensive feature vector output;
[0100] The loss is calculated using the cross entropy loss function over the training set, expressed as:
[0101] ;
[0102] in represents the calculated loss, n represents the number of drugs, represents the real label, i.e. the actual demand for drug i, represents the calculated probability that drug i meets the demand;
[0103] The output after linear layer mapping is determined based on the comprehensive feature vector, which is expressed as:
[0104] ;
[0105] in represents the comprehensive feature vector output after the i-th linear layer mapping, represents the linear weight for drug i, represents the bias term;
[0106] The sigmoid function is used to convert the matching feature vector of user semantic features and drug features into the probability of selecting a drug, which is expressed as:
[0107] ;
[0108] in represents the demand probability of drug i;
[0109] Use the Adam optimizer to calculate the loss L for each parameter matrix by gradient descent. , and as well as and The gradient value is calculated and the parameters are iteratively optimized. When the loss L calculated in the continuous iteration process no longer decreases significantly, the iterative output parameters are stopped.
[0110] Through the multi-head attention mechanism, the weighted sum value vectors are concatenated to obtain a comprehensive feature vector, which can fully express the multi-dimensional matching relationship between users and drugs, thereby more accurately capturing the matching degree between user needs and drug characteristics. The comprehensive feature vector is mapped to the probability of drug selection through a linear layer, which can further adjust the weight of the comprehensive feature and highlight the important matching information between user needs and drug characteristics, thereby improving the accuracy and personalization of recommendations. Through the loss function, Adam optimizer and gradient calculation, better training effects can be achieved in a shorter time. The Sigmoid function is used to calculate the probability of drug demand, which can well express the applicability and risk of drugs. The introduction of the Sigmoid function can smooth the extreme values in the matching score. Compared with the characteristics of drugs and the analysis of the comprehensive feature vector, the demand degree of drugs can be analyzed more intuitively, providing assistance for medication decisions.
[0111] S3, calculates the drug recommendation score based on the comprehensive feature vector, constructs a two-dimensional comparison matrix to analyze the matching score between drugs and users, and comprehensively analyzes the demand probability of drugs to calculate the total score of drugs;
[0112] Preferably, the drug recommendation score is calculated based on the comprehensive feature vector, a two-dimensional comparison matrix is constructed to analyze the matching score between the drug and the user, and the demand probability of the drug is comprehensively analyzed to calculate the total score of the drug, including:
[0113] Based on the comprehensive feature vector of the multi-head attention calculation output, a vector is constructed based on the output of the h heads included, and the drug feature vector The vectors are constructed for the characteristics of each drug, which are expressed as follows:
[0114] ;
[0115] ;
[0116] in represents the final output of the multi-head attention mechanism, Represents the characteristics of the nth drug;
[0117] The cosine similarity is introduced to accurately match the output of each head of the comprehensive feature vector and the characteristics of each drug, which is expressed as:
[0118] ;
[0119] in represents the recommendation score of drug i, represents the transpose of the i-th drug feature;
[0120] Sequentially compare the user's semantic expression with drug features;
[0121] Construct a two-dimensional contrast matrix M, where The matching score between the i-th component of the user demand vector and the j-th component of the drug feature vector is expressed as:
[0122] ;
[0123] ;
[0124] in represents the i-th user semantic vector, represents the j-th drug feature vector, represents the cosine similarity between the i-th user semantic vector and the j-th drug feature vector, Indicates skipping the jth component of the drug feature vector and only considering the best matching scores between the first i−1 components of the user semantic vector and the first j components of the drug feature. Indicates skipping the i-th component of the user semantic vector and only considering the best matching scores of the first i components of the user semantic vector and the first j-1 components of the drug feature vector. represents the best score of the previous match, represents the transpose calculation of the j-th drug feature vector;
[0125] The calculation formula is: By calculating the best score of the previous match and the cumulative cosine similarity score of the user semantic component and the drug feature component, we can consider and If there is a higher similarity (larger similarity value), the cumulative score will be higher, indicating that the current component matching is part of the optimal path. The formula applies the idea of dynamic programming, decomposing the problem into sub-problems, and solving them step by step through recursive relationships. The solution of each sub-problem depends on the solution of the previous sub-problem, ensuring the calculation of the global optimal solution. The maximum value selection in the recursive calculation of the formula ensures that each step of the calculation is the current optimal decision, that is, each step selects the current optimal score accumulation path. This step-by-step optimal selection ensures that the final solution is the global optimal solution. Therefore, when there are many dimensions of user semantic expression and drug features, the formula can flexibly handle matching relationships of different dimensions;
[0126] according to The calculation fills the matrix M, and selects the cumulative score in the matrix as the final matching score of drug i;
[0127] Taking into account the demand probability and recommendation score of drug i, the total score of the drug is calculated and expressed as:
[0128] ;
[0129] in represents the total score of drug i, represents the final matching score of drug i, It represents the demand probability of drug i. The participation of the logarithm of drug demand probability in the calculation can increase the discrimination of high-probability drugs.
[0130] By using comprehensive feature vectors to match the user's semantic demand information with drug feature information in multiple dimensions and citing the calculation of cosine similarity, we can clearly judge the similarity between user demand and drug features in various dimensions, improve the accuracy of matching results, especially the refined distinction of similar drugs. At the same time, by comparing the user's semantic expression with drug features in detail component by component, the order information of each component in the user's semantic expression is fully considered to improve the accuracy of recommendations. Based on the two-dimensional comparison matrix, we can intuitively understand the matching of user semantic expression and drug features. By observing the matrix, we can intuitively understand which components play a key role in the matching score. At the same time, the matrix-related data can also become the traceability source of drug recommendations, which is convenient for detailed explanation of the source of each drug recommendation score.
[0131] In the calculation of the total score, by introducing the demand probability, it is possible to effectively avoid the incorrect recommendation of drugs with low demand probability but high recommendation score, thereby improving the safety of the recommendation, and thus dynamically adjusting the priority of drugs according to actual demand conditions, better protecting the health and medication safety of users.
[0132] S4, generates a recommendation list based on the total score of the drug, uses an encryption algorithm to store and upload the data;
[0133] Preferably, a recommendation list is generated based on the total score of the drug, including:
[0134] Calculate the total score of all drugs and count the maximum and minimum values of the total score;
[0135] The total scores of the drugs are standardized, and all drugs are sorted from high to low according to the standardized scores to generate a drug recommendation list.
[0136] By standardizing the total scores of all drugs, the match between drugs and user needs can be more intuitively reflected. By generating a recommendation list, users or doctors can easily understand the priority of drugs and make more reasonable choices based on the sorting results, thereby improving user experience. By calculating the total score of drugs, standardizing and sorting them in real time, the system can quickly adjust the recommendation results and provide dynamic recommendation plans when users input different needs or preferences.
[0137] Furthermore, encryption algorithms are used to store and upload data, including:
[0138] The drug recommendation score data is encrypted using the AES encryption algorithm and stored in categories according to the source users of the semantic representation vectors;
[0139] Establish a secure connection with the remote server through SFTP, and upload the encrypted data file to the specified server directory for secure data transmission;
[0140] Log files that record data storage and upload, including the time of data encryption, key usage, and encrypted file name information.
[0141] Through encryption processing, even if the data is intercepted during transmission or storage, the user's drug recommendation information cannot be directly obtained, thereby effectively preventing data leakage and tampering. When transmitting data using the SFTP protocol, the data transmission adopts a packet verification mechanism, which can effectively prevent packet loss and information leakage. By recording log files such as data encryption time, key usage, and encrypted file name information, it helps to achieve transparency and traceability of data management, enhance data privacy protection and security, and prevent data leakage and tampering during storage and transmission.
[0142] Example 2, reference Figure 2 , which is the second embodiment of the present invention, and which is different from the previous embodiment, provides a system for intelligent drug recommendation method based on speech recognition, including:
[0143] The data collection module collects the user's voice data, collects and processes the detailed information and efficacy data of the drug, performs preprocessing, and generates feature vectors;
[0144] The multi-head attention module calculates the matching score between the semantic representation vector and the drug feature vector based on the multi-head attention mechanism and generates a weighted sum value vector;
[0145] The drug recommendation score calculation module calculates the drug recommendation score and the user demand matching score based on the comprehensive feature vector and the two-dimensional comparison matrix, and generates the total score of the drug;
[0146] The recommendation list generation module sorts the drugs based on their total scores and generates the final drug recommendation list;
[0147] The data storage module encrypts the drug recommendation data and uploads the data to the remote server for storage through a secure channel.
[0148] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0149] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0150] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0151] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit with a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit with a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0152] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. An intelligent drug recommendation method based on speech recognition, characterized in that: include, Collect user voice data and drug data to construct semantic representation vectors and drug feature vectors; Based on the multi-head attention mechanism, the weighted sum value vector is calculated, the weighted sum value vector of multiple heads is integrated to output the comprehensive feature vector, and the demand probability of the drug is calculated; Calculate the drug recommendation score based on the comprehensive feature vector, construct a two-dimensional comparison matrix to analyze the matching score between drugs and users, and calculate the total score of drugs by comprehensively analyzing the demand probability of drugs; Generate a recommendation list based on the total score of the drug, and use an encryption algorithm to store and upload the data; Collect user voice data and drug data, construct semantic representation vectors and drug feature vectors, including: Collect voice data based on different users, and remove noise from the collected voice data through bandpass filtering; Use the speech recognition model DeepSpeech to convert the noise-removed speech data into text data; Use the pre-trained language model BERT, input text data into the model, and the language model BERT outputs the semantic representation vector Sf; Based on the existing drug data set, collect detailed drug information and drug-drug interaction data; The drug attributes, ingredients, and indications information are used as drug feature nodes to construct a graph structure, and the graph embedding algorithm Node2Vec is used to construct the feature vector of each drug node, and the drug node embedding vector is used as the drug feature vector Df; Based on the multi-head attention mechanism, the weighted sum value vector is calculated, including: Based on the multi-head attention mechanism, the query vector, key vector and value vector are defined according to the semantic representation vector and the drug feature vector, respectively, as follows: in and are the weight matrices of the ith query vector, ith key vector, and ith value vector, respectively; Qi, Ki, and Vi represent the ith query vector, ith key vector, and ith value vector, respectively; Sf and Df represent the semantic representation vector and the drug feature vector, respectively; and calculating a weighted sum value vector based on the query vector, the shutdown vector and the value vector; The weighted sum value vector of the integrated multi-head outputs the integrated feature vector and calculates the demand probability of the drug, including, The calculation based on the weighted sum value vector concatenates the outputs of all weighted sum value vectors, expressed as: MH(Q,K,V)=concat(Att1,Att2,…,Atth)·W O ; Where MH(Q,K,V) represents the comprehensive feature vector, Atth represents the hth weighted sum value vector, W O represents the concatenated vector of the comprehensive feature vector output; Calculate the loss using the cross entropy loss function over the training set; The output after linear layer mapping is determined based on the comprehensive feature vector, which is expressed as: in represents the comprehensive feature vector output after the i-th linear layer mapping, Wi represents the linear weight for drug i, and bi represents the bias term; The sigmoid function is used to convert the matching feature vector of user semantic features and drug features into the probability of selecting a drug, which is expressed as: where p i represents the demand probability of drug i; Use the Adam optimizer to calculate the loss L for each parameter matrix by gradient descent. and As well as the gradient values of Wi and bi, and perform iterative optimization of parameters. When the loss L calculated in the continuous iteration process no longer decreases significantly, the iterative output parameters are stopped; Calculate the drug recommendation score based on the comprehensive feature vector, construct a two-dimensional comparison matrix to analyze the matching score between drugs and users, and comprehensively analyze the demand probability of drugs to calculate the total score of drugs, including: Based on the comprehensive feature vector calculated by multi-head attention, a vector is constructed according to the output of the h heads, and a vector is constructed for the characteristics of each drug according to the drug feature vector Df, which are expressed as: Ama=[Att1,Att2,…,Atth]; Df=[d1,d2,d3,…,dn]; Where Ama represents the final output of the multi-head attention mechanism, and dn represents the characteristics of the nth drug; The cosine similarity is introduced to accurately match the output of each head of the comprehensive feature vector and the characteristics of each drug, which is expressed as: Where Ri represents the recommendation score of drug i, represents the transpose of the i-th drug feature; Sequentially compare the user's semantic expression with drug features; Construct a two-dimensional comparison matrix M, where M(i,j) represents the matching score between the i-th component of the user demand vector and the j-th component of the drug feature vector, expressed as: M(i,j)=max(M(i-1,j-1))+Sim(ei,dj),M(i-1,j),M(i,j-1); Where ei represents the i-th user semantic vector, dj represents the j-th drug feature vector, Sim(ei,dj) represents the cosine similarity between the i-th user semantic vector and the j-th drug feature vector, M(i-1,j) represents skipping the j-th component of the drug feature vector and only considering the best matching score between the first i-1 components of the user semantic vector and the first j components of the drug feature, M(i,j-1) represents skipping the i-th component of the user semantic vector and only considering the best matching score between the first i components of the user semantic vector and the first j-1 components of the drug feature vector, max(M(i-1,j-1)) represents the best score of the previous match, represents the transpose calculation of the j-th drug feature vector; Fill the matrix M according to the calculation of M(i,j), and select the cumulative score in the matrix as the final matching score of drug i; Taking into account the demand probability and recommendation score of drug i, the total score of the drug is calculated and expressed as: Where Rif represents the total score of drug i, Ri M represents the final matching score of drug i, and pi represents the demand probability of drug i.
2. The method for intelligent drug recommendation based on speech recognition according to claim 1, characterized in that: The generating of the recommendation list based on the total score of the drug comprises: Calculate the total score of all drugs and count the maximum and minimum values of the total score; The total scores of the drugs are standardized, and all drugs are sorted from high to low according to the standardized scores to generate a drug recommendation list.
3. The method for intelligent drug recommendation based on speech recognition according to claim 2, characterized in that: The use of encryption algorithms to store and upload data includes: The drug recommendation score data is encrypted using the AES encryption algorithm and stored in categories according to the source users of the semantic representation vectors; Establish a secure connection with the remote server through SFTP, and upload the encrypted data file to the specified server directory for secure data transmission; Log files that record data storage and upload, including the time of data encryption, key usage, and encrypted file name information.
4. A system based on the method for intelligent drug recommendation based on speech recognition according to any one of claims 1 to 3, characterized in that: include, The data collection module collects the user's voice data, collects and processes the detailed information and efficacy data of the drug, performs preprocessing, and generates feature vectors; The multi-head attention module calculates the matching score between the semantic representation vector and the drug feature vector based on the multi-head attention mechanism and generates a weighted sum value vector; The drug recommendation score calculation module calculates the drug recommendation score and the user demand matching score based on the comprehensive feature vector and the two-dimensional comparison matrix, and generates the total score of the drug; The recommendation list generation module sorts the drugs based on their total scores and generates the final drug recommendation list; The data storage module encrypts the drug recommendation data and uploads the data to the remote server for storage through a secure channel.
5. A computer device comprising: Memory and processor; The memory stores a computer program, characterized in that: when the processor executes the computer program, the steps of the method for intelligent drug recommendation based on speech recognition described in any one of claims 1 to 3 are implemented.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for intelligent drug recommendation based on speech recognition described in any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Artificial intelligence-based medication recommendation method and apparatus, electronic device and medium
CN112214613A
Medical resource docking method and system based on artificial intelligence
CN117112729A
