Electronic medical record analysis method and device based on machine learning and storage medium
Through a machine learning-based method, the Transformer network is used to process the text information of electronic medical records and generate text feature coding and position coding, which solves the problem of low similarity of electronic medical records in the existing technology and achieves more accurate medical record analysis and treatment plans. extract.
Patent Information
- Application Number
- CN202410542735.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-30
- Publication Date
- 2024-08-23
AI Technical Summary
In the existing technology, when similar electronic medical records are obtained based on clustering/text retrieval, the text information of the same disease has a large gap, resulting in low similarity and poor accuracy between medical records.
A method based on machine learning is used to obtain the text information of the electronic medical record to be analyzed, determine its text encoding and position encoding, and input it into the encoder and decoder in the Transformer network to generate text feature encoding and similar medical records, thereby obtaining the corresponding treatment and care options.
It improves the accuracy of electronic medical record analysis, accurately predicts similar medical records, and improves the accuracy of treatment and care plans.
Smart Images

Figure CN118538427A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to an electronic medical record analysis method, device and storage medium based on machine learning. Background Art
[0002] Electronic medical records are information-based related information used in the patient diagnosis process, and can provide reference for doctors and other relevant personnel when making diagnoses. Among them, similar electronic medical records will greatly assist doctors in their diagnosis.
[0003] In the prior art, similar medical records are obtained based on clustering / text retrieval. However, the text information of the same disease on the electronic medical record may be quite different, so the similarity between the medical records obtained by the above method is not high and the accuracy is poor. Summary of the invention
[0004] The present invention provides an electronic medical record analysis method, device and storage medium based on machine learning.
[0005] According to one aspect of the present disclosure, a method for analyzing electronic medical records based on machine learning is provided, the method comprising: obtaining text information of an electronic medical record to be analyzed, and determining a text encoding of the text information; inputting the text encoding into a target Transformer network, and obtaining a text feature encoding of the text information of the electronic medical record to be analyzed through an encoder in the target Transformer network; determining a position encoding of the text information of the electronic medical record to be analyzed; splicing the position encoding and the text encoding, and inputting the spliced encoding and the text feature encoding into a decoder of the target Transformer network to obtain a similar medical record corresponding to the electronic medical record to be analyzed; and obtaining a treatment and nursing plan corresponding to the electronic medical record to be analyzed based on the similar medical record.
[0006] According to another aspect of the present disclosure, there is provided an electronic medical record analysis device based on machine learning, the device comprising: an acquisition module, used to acquire text information of an electronic medical record to be analyzed, and determine a text encoding of the text information; a first processing module, used to input the text encoding into a target Transformer network, and obtain a text feature encoding of the text information of the electronic medical record to be analyzed through an encoder in the target Transformer network; a first determination module, used to determine a position encoding of the text information of the electronic medical record to be analyzed; a second processing module, used to splice the position encoding and the text encoding, and input the spliced encoding and the text feature encoding into a decoder of the target Transformer network to obtain a similar medical record corresponding to the electronic medical record to be analyzed; and a second determination module, used to obtain a treatment and nursing plan corresponding to the electronic medical record to be analyzed based on the similar medical record.
[0007] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the machine learning-based electronic medical record analysis method of the present disclosure.
[0008] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the electronic medical record analysis method based on machine learning of the present disclosure.
[0009] According to another aspect of the present disclosure, a computer program product is provided. When the computer program is executed by a processor, the electronic medical record analysis method based on machine learning of the present disclosure is implemented.
[0010] Compared with the prior art, the present invention has the following beneficial effects:
[0011] The encoder in the target Transformer network is used to obtain the text feature encoding of the text information of the electronic medical record, and the concatenated encoding of the position encoding and the text encoding and the text feature encoding are input into the decoder of the target Transformer network to accurately predict similar medical records corresponding to the electronic medical record to be analyzed, thereby improving the accuracy.
[0012] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0014] Figure 1 It is a flowchart of an electronic medical record analysis method based on machine learning provided according to an embodiment of the present disclosure;
[0015] Figure 2 is a structural schematic diagram of an electronic medical record analysis device based on machine learning provided according to an embodiment of the present disclosure;
[0016] Figure 3 is a block diagram of an electronic device for implementing an embodiment of the present disclosure. DETAILED DESCRIPTION
[0017] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0018] The following describes the electronic medical record analysis method and device based on machine learning according to an embodiment of the present disclosure with reference to the accompanying drawings.
[0019] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure.
[0020] like Figure 1 As shown, the electronic medical record analysis method based on machine learning may include:
[0021] Step 101, obtaining text information of the electronic medical record to be analyzed, and determining the text encoding of the text information.
[0022] Among them, it should be noted that the executor of the above-mentioned electronic medical record analysis method based on machine learning is an electronic medical record analysis device based on machine learning. The electronic medical record analysis device based on machine learning can be implemented by software and / or hardware. The electronic medical record analysis device based on machine learning in this embodiment can be configured in an electronic device.
[0023] In this example embodiment, the electronic device may include devices such as terminal devices and servers, and this embodiment does not limit the electronic device.
[0024] In the disclosed embodiment, text information of the electronic medical record to be analyzed may be obtained through user input.
[0025] In the embodiment of the present disclosure, after the text information of the electronic medical record to be analyzed is obtained, the text encoding of the text information can be determined according to a character encoding set, wherein the character encoding set can be determined in advance.
[0026] For example, in the embodiment of the present disclosure, Table 1 is the text encoding corresponding to the text information.
[0027] Table 1
[0028] head fan evil Heart vomit vomit 8 Small hour 3 4 5 6 7 8 9 10 11
[0029] As shown in Table 1, after obtaining the text information "headache, nausea and vomiting for 8 hours", the corresponding text encoding "34567891011" can be obtained from the character encoding set.
[0030] Step 102: Input the text code into the target Transformer network, and obtain the text feature code of the text information of the electronic medical record to be analyzed through the encoder in the target Transformer network.
[0031] In the disclosed embodiment, the target Transformer network may include an encoder and a decoder. The encoder may include a first multi-head attention layer, a first feedforward neural network layer, and a first residual connection layer; the decoder may include a masked multi-head attention layer, a second multi-head attention layer, a second feedforward neural network layer, and a second residual connection layer.
[0032] Among them, in the embodiment of the present disclosure, the method of inputting the text encoding into the target Transformer network and obtaining the text feature encoding of the text information of the electronic medical record to be analyzed through the encoder in the target Transformer network may include the following steps:
[0033] Step 1021: Input the text codes into the first multi-head attention layer respectively to obtain multiple first feature codes.
[0034] In the embodiment of the present disclosure, each of the above-mentioned first multi-head attention layers includes a self-attention layer. Based on this, the above-mentioned method of inputting the text encoding into the first multi-head attention layer respectively to obtain multiple first feature encodings may include the following steps:
[0035] Step 1, calculating multiple query feature vectors, multiple key feature vectors and multiple value feature vectors of the text encoding;
[0036] For example, in the disclosed embodiment, assuming that the text is encoded as X, X is input into the dynamic self-attention mechanism, and linear transformation is performed using weight matrices W1, W2, and W3 to obtain the corresponding query feature vector Q1=W1×X, the corresponding key feature vector K1=W2×X, and the corresponding value feature vector V1=W3×X, where the dimensions corresponding to Q1, K1, and V1 are the same.
[0037] Among them, in the embodiment of the present disclosure, different weight matrices correspond to different query feature vectors, key feature vectors and value feature vectors. Based on this, multiple query feature vectors, multiple key feature vectors and multiple value feature vectors can be obtained through multiple different weight matrices.
[0038] Step 2: Perform a dot product operation on the query feature vector and the key feature vector, scale the dot product result, use Softmax to normalize the result probability distribution, and multiply the distribution result with the value feature vector to obtain the first feature code.
[0039] In the embodiment of the present disclosure, the query feature vector and the key feature vector perform a dot product operation Attention(Q1, K1)=MatMul(Q1, K1 T ), and scale the dot product result Wherein, d is the dimension of Q1 or K1 (the dimensions of Q and K are the same). Also, in the embodiment of the present disclosure, Softmax is used to normalize the probability distribution of the result, and the distribution result is multiplied by the value feature vector V1 to obtain the first feature code, where the calculation formula is as follows:
[0040]
[0041] In the disclosed embodiment, the text codes are respectively input into the first multi-head attention layer, and multiple first feature codes are obtained through the above method.
[0042] Furthermore, in the embodiment of the present disclosure, the number of heads in the first multi-head attention layer can be set as needed. For example, it can be 8-head attention.
[0043] Step 1022: obtain a second feature code by concatenating and linearly transforming multiple first feature codes.
[0044] In the disclosed embodiment, after obtaining the first feature codes of all attention heads by the above method, multiple first feature codes can be spliced together, and the spliced attention matrix can be linearly transformed through a weight matrix to obtain the second feature code.
[0045] Step 1023: input the second feature code and the text code into the first residual connection layer for residual connection, and normalize the residual result to obtain the third feature code.
[0046] In the disclosed embodiment, the second feature code A1 is residually connected with the text code X (the elements at corresponding positions are added), and the residual result is normalized to obtain the third feature code B1=LN(X+A1).
[0047] Step 1024: input the third feature code into the first feedforward neural network to obtain a fourth feature code.
[0048] In the disclosed embodiment, the third feature code B is subjected to FFN (linear transformation to activation function) to obtain a fourth feature code C1=relu(linear(B1)).
[0049] Step 1025: input the fourth feature code and the third feature code into the first residual connection layer for residual connection, and normalize the residual result to obtain the text feature code of the text information of the electronic medical record to be analyzed.
[0050] In the disclosed embodiment, the fourth feature code C1 is residually connected with the third feature code B1, and the result of the residual connection is normalized to obtain the text feature code D1 = LN (B1 + C1) of the text information of the electronic medical record to be analyzed.
[0051] Step 103: Determine the position code of the text information of the electronic medical record to be analyzed.
[0052] In the disclosed embodiment, a vector is added to each embedded text word in the electronic medical record, and position encoding is introduced to embed the text symbol position information into the input encoding, so that the target Transformer network can consider the order information of the input sequence, thereby improving the accuracy of the electronic medical record analysis results.
[0053] Specifically, in the embodiment of the present disclosure, the method for determining the position code of the text information of the electronic medical record to be analyzed may include: determining the position code of the text information of the electronic medical record to be analyzed based on a first formula and a second formula, wherein the first formula is:
[0054]
[0055] The second formula above is:
[0056]
[0057] Where dmodel represents the dimension of the position vector, each row corresponds to a vector encoding, containing 32 (dmodel) values, each value range is between [-1,1], pos represents the position of the word in the text information, 2i and 2i+1 represent the even position and odd position of the position vector respectively, and i represents the index value in the word vector, that is, the i-th position of the word vector.
[0058] Step 104: concatenate the position code and the text code, and input the concatenated code and the text feature code into the decoder of the target Transformer network to obtain a similar medical record corresponding to the electronic medical record to be analyzed.
[0059] In the embodiment of the present disclosure, after obtaining the position code corresponding to each character, the position code and the text code can be spliced to obtain the spliced code, and the spliced code and the text feature code are input into the decoder of the target Transformer network to obtain the similar medical record corresponding to the electronic medical record to be analyzed.
[0060] Specifically, in the embodiment of the present disclosure, the method of inputting the concatenated code and the text feature code into the decoder of the target Transformer network to obtain a similar medical record corresponding to the electronic medical record to be analyzed may include the following steps:
[0061] Step 1041: input the concatenated code into the masked multi-head attention layer to obtain the fifth feature code.
[0062] In the embodiment of the present disclosure, the method of inputting the concatenated code into the masked multi-head attention layer to obtain the fifth feature code may include the following steps:
[0063] Step 1: Pass the concatenated codes through multiple sets of different weight matrices to obtain multiple sets of different query feature vectors, key feature vectors and value feature vectors;
[0064] Step 2: perform dot product calculation on each query feature vector and each key feature vector to obtain the corresponding first feature vector;
[0065] Step 3: Concatenate each first eigenvector with the attention mask to obtain the corresponding second eigenvector;
[0066] Step 4: Perform dot product calculation on the third eigenvector after Softmax of each second eigenvector and the corresponding value eigenvector to calculate the masked single-head attention eigenvector;
[0067] Step 5: Concatenate and linearly transform multiple masked single-head attention feature vectors to obtain the fifth feature code.
[0068] In the embodiment of the present disclosure, the attention mask can be set as needed. Also, in the embodiment of the present disclosure, the relevant introduction of steps 1 to 5 can refer to the relevant introduction in the above embodiment, and the embodiment of the present disclosure will not be repeated here.
[0069] Step 1042: Input the fifth feature code and the text code into the second residual connection layer for residual connection, and normalize the residual result to obtain the sixth feature code.
[0070] In the disclosed embodiment, the fifth feature code A2 and the text sequence X are input into the second residual connection layer for residual connection, the elements at corresponding positions are added to obtain X+A2, and the residual result is normalized to obtain the sixth feature code B2=LN(X+A2).
[0071] Step 1043: Input the text feature code into the second multi-head attention layer to obtain the seventh feature code.
[0072] In the embodiment of the present disclosure, the structure of the second multi-head attention layer is the same as that of the first multi-head attention layer. Based on this, the relevant introduction of step 1043 can refer to the detailed introduction in the above embodiment, and the embodiment of the present disclosure will not be repeated here.
[0073] Step 1044: input the sixth feature code and the seventh feature code into the second residual connection layer for residual connection, and normalize the residual result to obtain the eighth feature code.
[0074] In the disclosed embodiment, the sixth feature code B2 and the seventh feature code C2 are input into the second residual connection layer for residual connection, the elements at corresponding positions are added to obtain B2+C2, and the residual result is normalized to obtain the eighth feature code D2=LN(B2+C2).
[0075] Step 1045: input the eighth feature code into the second feedforward neural network to obtain a ninth feature code.
[0076] In the disclosed embodiment, the eighth feature code D2 is subjected to FFN (linear transformation to activation function) to obtain a ninth feature code E=relu(linear(D2)).
[0077] Step 1046: input the seventh feature code and the ninth feature code into the second residual connection layer for residual connection, and normalize the residual result to obtain a similar medical record corresponding to the electronic medical record to be analyzed.
[0078] In the embodiment of the present disclosure, the seventh feature code C2 and the ninth feature code E are input into the second residual connection layer for residual connection, and the result of the residual connection is normalized to obtain similar medical records corresponding to the electronic medical record to be analyzed. In the embodiment of the present disclosure, the numbers of multiple similar medical records can be obtained.
[0079] Step 105: Obtain treatment and nursing plans corresponding to the electronic medical records to be analyzed based on similar medical records.
[0080] In the disclosed embodiment, after similar medical records are obtained through the above steps, the treatment and nursing plan corresponding to the electronic medical record to be analyzed can be obtained based on the similar medical records.
[0081] Specifically, in the embodiment of the present disclosure, the method for obtaining the treatment and nursing plan corresponding to the electronic medical record to be analyzed based on similar medical records may include: extracting historical treatment and nursing plans in similar medical records, sorting the historical treatment and nursing plans, and obtaining the treatment and nursing plan corresponding to the electronic medical record to be analyzed. Among them, the method for sorting the historical treatment and nursing plans may specifically include: determining the same treatment and nursing plans in multiple historical similar medical records as the treatment and nursing plan corresponding to the electronic medical record to be analyzed.
[0082] In the disclosed embodiment, the encoder in the target Transformer network is used to obtain the text feature encoding of the text information of the electronic medical record, and the code obtained by concatenating the position code and the text code and the text feature code are input into the decoder of the target Transformer network to accurately predict similar medical records corresponding to the electronic medical record to be analyzed, thereby improving the accuracy.
[0083] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure.
[0084] like Figure 2 As shown, the electronic medical record analysis device 200 based on machine learning may include: an acquisition module 201, a first processing module 202, a first determination module 203, a second processing module 204, and a second determination module 205, wherein:
[0085] The acquisition module 201 is used to acquire the text information of the electronic medical record to be analyzed and determine the text encoding of the text information;
[0086] The first processing module 202 is used to input the text code into the target Transformer network, and obtain the text feature code of the text information of the electronic medical record to be analyzed through the encoder in the target Transformer network;
[0087] A first determination module 203 is used to determine the position code of the text information of the electronic medical record to be analyzed;
[0088] The second processing module 204 is used to concatenate the position code and the text code, and input the concatenated code and the text feature code into the decoder of the target Transformer network to obtain a similar medical record corresponding to the electronic medical record to be analyzed;
[0089] The second determination module 205 is used to obtain the treatment and nursing plan corresponding to the electronic medical record to be analyzed based on similar medical records.
[0090] It should be noted that the aforementioned explanation of the embodiment of the electronic medical record analysis method based on machine learning is also applicable to this embodiment, and this embodiment will not be repeated here.
[0091] The electronic medical record analysis device based on machine learning in the embodiment of the present disclosure uses the encoder in the target Transformer network to obtain the text feature encoding of the text information of the electronic medical record, and inputs the code obtained by splicing the position code and the text code and the text feature code into the decoder of the target Transformer network, accurately predicts similar medical records corresponding to the electronic medical record to be analyzed, thereby improving the accuracy.
[0092] In one embodiment of the present disclosure, the encoder includes a first multi-head attention layer, a first feedforward neural network layer and a first residual connection layer; the first processing module 202 is specifically used to:
[0093] Input the text codes into the first multi-head attention layer respectively to obtain multiple first feature codes;
[0094] The plurality of first feature codes are concatenated and linearly transformed to obtain a second feature code;
[0095] The second feature code and the text code are input into the first residual connection layer for residual connection, and the residual result is normalized to obtain the third feature code;
[0096] Inputting the third feature code into the first feedforward neural network to obtain a fourth feature code;
[0097] The fourth feature code and the third feature code are input into the first residual connection layer for residual connection, and the residual result is normalized to obtain the text feature code of the text information of the electronic medical record to be analyzed.
[0098] In one embodiment of the present disclosure, the first determining module 203 is specifically configured to:
[0099] The position code of the text information of the electronic medical record to be analyzed is determined based on the first formula and the second formula, wherein the first formula is:
[0100]
[0101] The second formula is:
[0102]
[0103] Among them, dmodel represents the dimension of the position vector, pos represents the position of the word in the text information, 2i and 2i+1 represent the even position and odd position of the position vector respectively, and i represents the index value in the word vector, that is, the i-th position of the word vector.
[0104] In one embodiment of the present disclosure, the decoder includes a masked multi-head attention layer, a second multi-head attention layer, a second feedforward neural network layer, and a second residual connection layer; the second processing module 204 is specifically used to:
[0105] The concatenated code is input into the masked multi-head attention layer to obtain the fifth feature code;
[0106] The fifth feature code and the text code are input into the second residual connection layer for residual connection, and the residual result is normalized to obtain the sixth feature code;
[0107] Input the text feature code into the second multi-head attention layer to obtain the seventh feature code;
[0108] Inputting the sixth feature code and the seventh feature code into the second residual connection layer for residual connection, and normalizing the residual result to obtain the eighth feature code;
[0109] Inputting the eighth feature code into the second feedforward neural network to obtain a ninth feature code;
[0110] The seventh feature code and the ninth feature code are input into the second residual connection layer for residual connection, and the residual result is normalized to obtain a similar medical record corresponding to the electronic medical record to be analyzed.
[0111] In one embodiment of the present disclosure, the second processing module 204 is further configured to:
[0112] The concatenated codes are passed through multiple sets of different weight matrices to obtain multiple sets of different query feature vectors, key feature vectors and value feature vectors;
[0113] Perform a dot product calculation on each query feature vector and each key feature vector to obtain the corresponding first feature vector;
[0114] Concatenate each first eigenvector with the attention mask to obtain the corresponding second eigenvector;
[0115] The third eigenvector after Softmax of each second eigenvector is dot-producted with the corresponding value eigenvector to calculate the masked single-head attention eigenvector;
[0116] Multiple masked single-head attention feature vectors are concatenated and linearly transformed to obtain the fifth feature encoding.
[0117] In one embodiment of the present disclosure, the second determining module 205 is specifically configured to:
[0118] extracting historical treatment and care plans from similar medical records;
[0119] The historical treatment and nursing plans are sorted out to obtain the treatment and nursing plans corresponding to the electronic medical records to be analyzed.
[0120] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0121] Figure 3 A schematic block diagram of an example electronic device 300 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0122] like Figure 3 As shown, the device 300 includes a computing unit 301, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 302 or a computer program loaded from a storage unit 308 into a random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the device 300 can also be stored. The computing unit 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0123] A number of components in the device 300 are connected to the I / O interface 305, including: an input unit 306, such as a keyboard, a mouse, etc.; an output unit 307, such as various types of displays, speakers, etc.; a storage unit 308, such as a disk, an optical disk, etc.; and a communication unit 309, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 309 allows the device 300 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0124] The computing unit 301 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 301 performs the various methods and processes described above, such as an electronic medical record analysis method based on machine learning. For example, in some embodiments, the electronic medical record analysis method based on machine learning may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 308. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 300 via the ROM 302 and / or the communication unit 309. When the computer program is loaded into the RAM 303 and executed by the computing unit 301, one or more steps of the electronic medical record analysis method based on machine learning described above may be performed. Alternatively, in other embodiments, the computing unit 301 may be configured to execute the electronic medical record analysis method based on machine learning in any other appropriate manner (eg, by means of firmware).
[0125] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0126] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0127] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0128] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0129] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0130] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0131] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0132] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for analyzing electronic medical records based on machine learning, the method comprising: Obtaining text information of the electronic medical record to be analyzed, and determining the text encoding of the text information; Inputting the text code into a target Transformer network, and obtaining a text feature code of the text information of the electronic medical record to be analyzed through an encoder in the target Transformer network; Determining the position code of the text information of the electronic medical record to be analyzed; The position code and the text code are concatenated, and the concatenated code and the text feature code are input into the decoder of the target Transformer network to obtain a similar medical record corresponding to the electronic medical record to be analyzed; Based on the similar medical records, the treatment and nursing plan corresponding to the electronic medical record to be analyzed is obtained.
2. The method of claim 1, wherein: The encoder includes a first multi-head attention layer, a first feedforward neural network layer and a first residual connection layer; the text encoding is input into the target Transformer network, and the text feature encoding of the text information of the electronic medical record to be analyzed is obtained through the encoder in the target Transformer network, including: Inputting the text codes into the first multi-head attention layer respectively to obtain multiple first feature codes; Obtain a second feature code by concatenating and linearly transforming the plurality of first feature codes; Inputting the second feature code and the text code into the first residual connection layer for residual connection, and normalizing the residual result to obtain a third feature code; Inputting the third feature code into the first feedforward neural network to obtain a fourth feature code; The fourth feature code and the third feature code are input into the first residual connection layer for residual connection, and the residual result is normalized to obtain the text feature code of the text information of the electronic medical record to be analyzed.
3. The method of claim 1, wherein: The step of determining the position code of the text information of the electronic medical record to be analyzed includes: The position code of the text information of the electronic medical record to be analyzed is determined based on the first formula and the second formula, wherein the first formula is: The second formula is: Among them, dmodel represents the dimension of the position vector, pos represents the position of the word in the text information, 2i and 2i+1 represent the even position and odd position of the position vector respectively, and i represents the index value in the word vector.
4. The method of claim 1, wherein: The decoder includes a masked multi-head attention layer, a second multi-head attention layer, a second feedforward neural network layer, and a second residual connection layer; the concatenated code and the text feature code are input into the decoder of the target Transformer network to obtain a similar medical record corresponding to the electronic medical record to be analyzed, including: Input the concatenated code into the masked multi-head attention layer to obtain the fifth feature code; Inputting the fifth feature code and the text code into the second residual connection layer for residual connection, and normalizing the residual result to obtain a sixth feature code; Inputting the text feature code into the second multi-head attention layer to obtain a seventh feature code; Inputting the sixth feature code and the seventh feature code into the second residual connection layer for residual connection, and normalizing the residual result to obtain an eighth feature code; Inputting the eighth feature code into the second feedforward neural network to obtain a ninth feature code; The seventh feature code and the ninth feature code are input into the second residual connection layer for residual connection, and the residual result is normalized to obtain a similar medical record corresponding to the electronic medical record to be analyzed.
5. The method of claim 4, wherein: The concatenated code is input into the masked multi-head attention layer to obtain the fifth feature code, including: The concatenated codes are passed through multiple sets of different weight matrices to obtain multiple sets of different query feature vectors, key feature vectors and value feature vectors; Perform a dot product calculation on each query feature vector and each key feature vector to obtain the corresponding first feature vector; Concatenate each first eigenvector with the attention mask to obtain the corresponding second eigenvector; The third eigenvector after Softmax of each second eigenvector is dot-producted with the corresponding value eigenvector to calculate the masked single-head attention eigenvector; Multiple masked single-head attention feature vectors are concatenated and linearly transformed to obtain the fifth feature encoding.
6. The method of claim 1, wherein: The step of obtaining the treatment and nursing plan corresponding to the electronic medical record to be analyzed based on the similar medical record includes: extracting historical treatment and care plans from similar medical records; The historical treatment and nursing plans are sorted out to obtain the treatment and nursing plans corresponding to the electronic medical records to be analyzed.
7. An electronic medical record analysis device based on machine learning, the device comprising: An acquisition module, used to acquire text information of the electronic medical record to be analyzed and determine the text encoding of the text information; A first processing module, used for inputting the text encoding into a target Transformer network, and obtaining a text feature encoding of the text information of the electronic medical record to be analyzed through an encoder in the target Transformer network; A first determination module is used to determine the position code of the text information of the electronic medical record to be analyzed; A second processing module is used to concatenate the position code and the text code, and input the concatenated code and the text feature code into the decoder of the target Transformer network to obtain a similar medical record corresponding to the electronic medical record to be analyzed; The second determination module is used to obtain the treatment and nursing plan corresponding to the electronic medical record to be analyzed based on the similar medical records.
8. The device according to claim 7, wherein: The first processing module is specifically used for: Inputting the text codes into the first multi-head attention layer respectively to obtain multiple first feature codes; Obtain a second feature code by concatenating and linearly transforming the plurality of first feature codes; Inputting the second feature code and the text code into the first residual connection layer for residual connection, and normalizing the residual result to obtain a third feature code; Inputting the third feature code into the first feedforward neural network to obtain a fourth feature code; The fourth feature code and the third feature code are input into the first residual connection layer for residual connection, and the residual result is normalized to obtain the text feature code of the text information of the electronic medical record to be analyzed.
9. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 6.
