A method for controlling the proportion of pharmaceutical ingredients based on big data analysis
Through big data analysis and multi-terminal medicine ratio small deviation prediction model, the problem of deviation of drug ingredient ratio in the manufacturing process is solved, precise and real-time control of drug ingredient ratio is achieved, and the efficacy and safety of drugs are improved.
Patent Information
- Application Number
- CN202410837342.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-06-26
AI Technical Summary
There are deviations in the ratio of drug ingredients during the manufacturing process, which can lead to reduced efficacy or side effects, or even life-threatening effects. It is difficult to achieve accurate and real-time control of drug ingredient ratios with existing technology.
Using a method based on big data analysis, by collecting drug ingredient ratio data, conducting vectorization representation and density clustering, constructing pharmaceutical ratio clusters, establishing a multi-terminal pharmaceutical ratio small deviation prediction model, and using shared networks and target branches for coding and Prediction, combined with nonlinear convergence factors and random walk optimization algorithms, achieves precise control of drug ingredient ratios.
It improves the accuracy and real-time performance of drug ingredient ratios, enhances the efficacy and safety of drugs, reduces the risk of side effects, and ensures precise control in the drug production process.
Smart Images

Figure CN118398113B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pharmaceutical ingredient ratio control, and in particular to a pharmaceutical ingredient ratio control method based on big data analysis. Background Art
[0002] In recent years, the development of the pharmaceutical industry has made significant progress, but at the same time, the problem of proportion control of drug ingredients has become increasingly prominent. In the drug manufacturing process, the accurate proportion of drug ingredients is crucial because it is directly related to the efficacy and safety of the drug. However, in actual production, due to quality fluctuations of raw materials, precision problems of production equipment, and differences in the technical level of operators, the actual proportion of drug ingredients often deviates from the target proportion. This deviation may not only lead to a decrease in drug efficacy, but also cause serious side effects and even endanger the patient's life. In response to this problem, the present invention proposes a method for controlling the proportion of drug ingredients based on big data analysis, which provides more accurate and real-time drug ingredient proportion control by analyzing and processing massive medical data, thereby ensuring accurate control of drug ingredients. Summary of the invention
[0003] In view of this, the present invention provides a method for controlling the proportion of pharmaceutical ingredients based on big data analysis, the purpose of which is to: 1) collect pharmaceutical ingredient proportion data and vectorize the pharmaceutical ingredient proportion, combine the inverse K nearest neighbor vector set and the K nearest neighbor vector set to perform density calculation on the pharmaceutical ingredient proportion vector, select the pharmaceutical ingredient proportion vector with high density as the clustering skeleton, construct an initial pharmaceutical proportion cluster, and calculate the probability of other pharmaceutical ingredient proportion vectors belonging to any pharmaceutical proportion cluster, implement a density clustering method based on the inverse K nearest neighbor vector, and classify the pharmaceutical ingredient proportion vectors with similar pharmaceutical ingredient proportions into the same pharmaceutical proportion cluster; 2) construct a multi-terminal pharmaceutical proportion small deviation prediction model, the model includes a sharing part and a deviation prediction part, the sharing part takes the pharmaceutical ingredient proportion vector as input, uses the shared network parameters to encode the pharmaceutical ingredient proportion vector to obtain the pharmaceutical ingredient semantic encoding vector, and the deviation prediction part respectively divides the pharmaceutical ingredient semantic encoding vector into target clusters. The target branch maps the semantic coding vector of the medicinal ingredient to the target medicinal vector. The measured branch selects the medicinal ingredient ratio vector with similar semantics to the medicinal ingredient semantic coding vector from the medicinal ratio cluster, and obtains the pharmacodynamic information vector of the corresponding drug. The traditional heuristic algorithm is optimized by combining the nonlinear convergence factor and the random walk method. The convergence factor decreases rapidly in the early stage of iteration, which enhances the global search capability. It converges slowly in the later stage, which is conducive to local search and improves the convergence accuracy of the algorithm. The random walk method is used to avoid missing local better solutions. In the process of model application, the reverse encoding and decoding method is adopted to map the target medicinal vector to the target medicinal ratio vector, realize the reverse application of forward training, and use the target medicinal vector with higher accuracy as the reverse input to solve the problem of high ambiguity of the final output result in the forward training process, improve the accuracy of the overall input and output vectors of the model, and thus reversely calculate the medicinal ratio with higher accuracy.
[0004] To achieve the above object, the present invention provides a method for controlling the proportion of pharmaceutical ingredients based on big data analysis, comprising the following steps:
[0005] S1: collecting drug ingredient ratio data and converting them into drug ingredient ratio vectors, performing cluster analysis on the drug ingredient ratio vectors to obtain a number of drug ratio clusters, wherein improved density estimation clustering is the main implementation method of the cluster analysis;
[0006] S2: Construct a multi-terminal medicine ratio small deviation prediction model and determine the multi-terminal medicine ratio small deviation prediction objective function based on the model, wherein the model includes a sharing part and a deviation prediction part, wherein the sharing part takes the medicine component ratio vector as input, and uses the shared network parameters to encode the medicine component ratio vector to obtain the medicine component semantic coding vector, and the deviation prediction part passes the medicine component semantic coding vector through the target branch and the measured branch respectively, and the target branch maps the medicine component semantic coding vector to the target medicine vector, and the measured branch selects the medicine component ratio vector with similar semantics to the medicine component semantic coding vector from the medicine ratio cluster, and obtains the corresponding medicine efficacy information vector;
[0007] S3: Optimize the model parameters based on the multi-terminal medicine ratio small deviation prediction objective function to obtain the optimal model parameters, and determine the model instance based on the optimal model parameters, wherein the improved shark optimization algorithm is the main implementation method of the model parameter optimization. During the model parameter optimization process, the target branches of the shared part and the deviation prediction part are jointly optimized to determine the target branch parameters, and the target branch parameters are fixed, and the measured branches are optimized to establish the deviation mapping relationship between the target branch and the measured branch.
[0008] S4: Use the target drug vector as the input of the measured branch of the deviation prediction part, reversely infer the target semantic coding vector, use the shared part to map the target semantic coding vector to obtain the adjusted target drug ratio vector, and control the drug ingredient ratio according to the adjusted target drug ratio vector.
[0009] As a further improvement method of the present invention:
[0010] Optionally, the step S1 of collecting drug ingredient ratio data and converting it into a drug ingredient ratio vector includes:
[0011] Collect drug composition ratio data:
[0012] {x n |n∈[1,N]}
[0013] in:
[0014] x n represents the drug composition ratio data of the nth drug collected, and N represents the total number of drug composition ratio data collected, wherein the drug composition ratio data is text data describing the different components of the drug and the content of the components;
[0015] The drug composition ratio data is converted into a pharmaceutical composition ratio vector, where the drug composition ratio data x n The vector conversion process is:
[0016] Drug ingredient ratio data x nPerform word segmentation and matching to separate the drug composition ratio data x n The ingredients and their content;
[0017] Initialize and generate the pharmaceutical ingredient matrix, where the pharmaceutical ingredient matrix is a matrix of 1 row and M columns, where M represents the total number of ingredients that can be contained in the drug. The element in the mth column of the pharmaceutical ingredient matrix corresponds to the mth ingredient, and the pharmaceutical ingredient ratio data x n The content of the mth component in is x n (m), m∈[1,M];
[0018] The drug composition ratio data x n The composition ratios of different ingredients are filled in the pharmaceutical composition matrix to form the pharmaceutical composition ratio vector X n :
[0019]
[0020]
[0021] in:
[0022] X n Represents drug composition ratio data x n The corresponding pharmaceutical ingredient ratio vector;
[0023] Represents drug composition ratio data x n The composition ratio of the mth component in ;
[0024] Cluster analysis is performed on N pharmaceutical ingredient ratio vectors to obtain D pharmaceutical ratio clusters, each of which contains multiple pharmaceutical ingredient ratio vectors, and D represents the number of pharmaceutical ratio clusters obtained by the final clustering.
[0025] Optionally, the cluster analysis is performed on the N pharmaceutical ingredient ratio vectors to obtain D pharmaceutical ratio clusters, including:
[0026] Perform cluster analysis on N drug ingredient ratio vectors to obtain D drug ratio clusters, where the cluster analysis process is as follows:
[0027] S11: Calculate the distance between different drug component ratio vectors, where the drug component ratio vector X n With X q The distance between them is:
[0028]
[0029] in:
[0030] dis(X n ,X q) represents the drug composition ratio vector X n With X q The distance between them, q∈[1,N];
[0031] w m represents the weight of the mth ingredient, where the higher the weight, the smaller the proportion of drugs containing this ingredient;
[0032] S12: Obtain a set of K nearest neighbor vectors and a set of inverse K nearest neighbor vectors of the drug component ratio vector, wherein the drug component ratio vector X n The set of K nearest neighbor vectors is The set of inverse K nearest neighbor vectors is K nearest neighbor vector set Contains the distance medicine component ratio vector X n The K most recent drug component ratio vectors are used as the drug component ratio vector X n The K nearest neighbor vectors of the anti-K nearest neighbor vector set include the drug component ratio vector X n If the drug composition ratio vector X n For X q The neighbor vector of X q For X n The inverse neighbor vector of ;
[0033] S13: Calculate the density of the drug component ratio vector, where the drug component ratio vector X n The density of is:
[0034]
[0035] in:
[0036] ρ n Represents the drug composition ratio vector X n density;
[0037] Represents the set of K nearest neighbor vectors The nearest neighbor vector and the drug component ratio vector X n The average distance of
[0038] Represents the set of inverse K nearest neighbor vectors The anti-nearest neighbor vector and the drug component ratio vector X n The average distance of
[0039] The drug component ratio vectors with a density greater than 1 are regarded as strong points, and the drug component ratio vectors with a density between 0 and 1 are regarded as weak points, and the strong point set and the weak point set are constructed respectively;
[0040] S14: taking the medicine component ratio vectors that are neighboring vectors in the strong point set as a group of associated points, wherein the medicine component ratio vectors corresponding to the associated points are in the same medicine ratio cluster, and obtaining D initial medicine ratio clusters, each of which contains multiple strong points;
[0041] S15: Calculate the probability that the drug component ratio vector corresponding to the weakness belongs to different initial drug ratio clusters, where the probability that the drug component ratio vector X belongs to the d1th initial drug ratio cluster is:
[0042]
[0043] in:
[0044] P(X,d) represents the probability that the drug ingredient ratio vector X belongs to the dth initial drug ratio cluster;
[0045] C d represents the set of drug ingredient ratio vectors in the dth initial drug ratio cluster, c∈C d , c represents the drug composition ratio vector set C d Any drug ingredient ratio vector in , d∈[1,D];
[0046] Ω K (X) represents the K nearest neighbor vector set of the drug ingredient ratio vector X, μ(Ω K (X)) represents the set of K nearest neighbor vectors Ω K (X) The average distance between the nearest neighbor vector and the drug component ratio vector X;
[0047] exp(·) represents an exponential function with a natural constant as the base;
[0048] Count(C d ) represents the number of drug ingredient ratio vectors in the dth initial drug ratio cluster;
[0049] S16: Divide the drug ingredient ratio vector corresponding to the weakness into the initial drug ratio cluster with the highest probability, and obtain D drug ratio clusters.
[0050] Optionally, in step S2, constructing a multi-terminal medicine ratio small deviation prediction model includes:
[0051] Construct a multi-terminal medicine ratio small deviation prediction model and determine the multi-terminal medicine ratio small deviation prediction target function based on the model, wherein the multi-terminal medicine ratio small deviation prediction model includes a sharing part and a deviation prediction part, wherein the sharing part takes the medicine component ratio vector as input, and uses the shared network parameters to encode the medicine component ratio vector to obtain the medicine component semantic coding vector, and the deviation prediction part passes the medicine component semantic coding vector through the target branch and the measured branch respectively, and the target branch maps the medicine component semantic coding vector to the target medicine vector, and the measured branch selects the medicine component ratio vector with similar semantics to the medicine component semantic coding vector from the medicine ratio cluster, and obtains the drug efficacy information vector of the corresponding medicine;
[0052] The shared part consists of multiple convolutional layers, each of which has convolutional weight matrix parameters and bias parameters of different sizes. The medical ingredient ratio vector is subjected to multiple continuous convolution encoding processes to obtain a medical ingredient semantic vector; the target branch consists of a residual unit and a fully connected layer. The residual unit performs residual calculation on the medical ingredient semantic vector to obtain the medical ingredient semantic features. The fully connected layer performs feature mapping on the medical ingredient semantic features to obtain a target medical vector; the measured branch consists of a self-attention calculation layer and a similarity matching layer. The self-attention calculation layer is used to calculate the dynamic attention weight of the medical ingredient ratio vector in the medical ratio cluster. The similarity matching layer is used to calculate the semantic similarity between the medical ingredient ratio vector and the medical ingredient semantic encoding vector based on the dynamic attention weight, and the medical ingredient ratio vector with the highest semantic similarity is selected as the output.
[0053] Optionally, the multi-terminal medicine ratio small deviation prediction objective function is:
[0054]
[0055] θ=[θ1,θ2,θ3]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061] in:
[0062] F(θ) represents the multi-terminal drug ratio small deviation prediction objective function, θ represents the model parameters, θ1, θ2, θ3 represent the shared network parameters, target branch parameters and measured branch parameters respectively;
[0063] Represents the use of shared network parameters θ1 to divide the drug component ratio vector X n Encoding is performed to obtain a semantic encoding vector of the medicinal component;
[0064] Indicates that the target branch parameter θ2 is used to encode the semantic encoding vector of the medicinal ingredients Mapping the resulting target medicine vector;
[0065] It means that the measured branch parameter θ3 is used to select the semantic encoding vector of the medicine component from the medicine ratio cluster Semantically similar medicinal ingredient ratio vector, D * {·} represents obtaining the drug efficacy information vector corresponding to the drug ingredient ratio vector; in the embodiment of the present invention, the drug efficacy information vector is a word vector encoding of the drug efficacy information;
[0066] Indicates that convolution processing is performed using multiple convolutional layers constructed based on shared network parameters θ1;
[0067] θ2(1) represents the residual calculation parameter in the target branch parameter θ2, and θ2(2) represents the fully connected mapping parameter in the target branch parameter θ2;
[0068] Represents the drug component ratio vector X and the drug component semantic encoding vector The semantic similarity between
[0069] weight(X) represents the dynamic attention weight of the drug composition ratio vector X;
[0070] θ3(1),θ3(2),θ3(3) represent the attention calculation matrix in the measured branch parameter θ3;
[0071] T stands for transpose;
[0072] D(x) represents the set of drug ingredient ratio vectors of the drug ratio cluster in which the drug ingredient ratio vector X is located, and Z is any drug ingredient ratio vector in the set D(x);
[0073] θ3(4) represents the semantic mapping matrix in the measured branch parameter θ3;
[0074] ||·||2 denotes the L2 norm.
[0075] Optionally, in step S3, optimizing model parameters based on the multi-terminal medicine ratio small deviation prediction objective function to obtain optimal model parameters includes:
[0076] The model parameters are optimized based on the multi-terminal medicine ratio small deviation prediction objective function to obtain the optimal model parameters, wherein the improved shark optimization algorithm is the main implementation method of the model parameter optimization. During the model parameter optimization process, the target branches of the shared part and the deviation prediction part are jointly optimized to determine the target branch parameters, and the target branch parameters are fixed. The measured branches are optimized, and the deviation mapping relationship between the target branch and the measured branch is established. The model parameter optimization process is as follows:
[0077] S31: Establish a joint optimization function for the shared part and the target branch:
[0078]
[0079] in:
[0080] F1(θ1,θ2) represents the joint optimization function of the shared part and the target branch;
[0081] D * (X n ) represents the drug composition ratio vector X n The drug efficacy information vector of the corresponding drug;
[0082] S32: Initialize U shark position coordinates, where each shark position coordinate corresponds to a set of joint parameters θ1, θ2 of the shared part and the target branch, where the u-th shark position coordinate generated by initialization is
[0083] S33: Set the current iteration number of the shark position coordinates to t, and the maximum iteration number to Max, then the t-th iteration result of the u-th shark position coordinates is
[0084] S34: Calculate the position iteration coefficients A(t+1), B(t+1) of the t+1th iteration:
[0085] A(t+1)=2rand(0,1)a(t+1)-a(t+1)
[0086] B(t+1)=2rand(0,1)
[0087]
[0088] in:
[0089] rand(0,1) represents a random number between 0 and 1;
[0090] a(t+1) represents the convergence factor;
[0091] S35: Generate a random number between 0 and 1. If the random number is greater than 0.55, iterate using the following position coordinate iteration method:
[0092]
[0093] in:
[0094] z is a random number between (-1,1);
[0095] represents the optimal shark position coordinates after the t-th iteration, that is, the U shark position coordinates after the t-th iteration are used as the input of the joint optimization function, and the shark position coordinate that makes the joint optimization function value reach the minimum is selected as the optimal shark position coordinate after the t-th iteration;
[0096] Otherwise, the following position coordinate iteration method is used for iteration:
[0097]
[0098] in:
[0099] represents any random position coordinate among the U shark position coordinates after the tth iteration;
[0100] S36: Perform a random walk on the iterative results of the position coordinates, where the shark position coordinates The random walk formula is:
[0101]
[0102] S37: Let t = t + 1, return to step S34, until the maximum number of iterations is reached, the U shark position coordinates that have reached the maximum number of iterations are used as the input of the joint optimization function, and the shark position coordinates that make the joint optimization function value reach the minimum are selected
[0103] As the joint optimization result of the shared part and the target branch parameters in To optimize the optimal model parameters of the shared part, The optimal model parameters of the target branch obtained by optimization;
[0104] S37: Fixing the optimal model parameters The measured branch parameters are solved with the goal of minimizing the multi-terminal drug ratio small deviation prediction objective function to obtain the measured branch optimal model parameters
[0105] Based on the optimal model parameters Identify the model instance.
[0106] Optionally, in step S4, the target medicine vector is used as the input of the measured branch of the deviation prediction part, and the target semantic coding vector is obtained by reverse deduction, and the target semantic coding vector is mapped by using the shared part to obtain the adjusted target medicine ratio vector, including:
[0107] The target drug vector f is determined according to the drug efficacy, and the target drug vector f is used as the input of the measured branch of the deviation prediction part in the multi-terminal drug ratio small deviation prediction model. The target semantic encoding vector f1 corresponding to the target drug vector f is reversed, and the target semantic encoding vector f1 is mapped using the shared part to obtain the adjusted target drug ratio vector f2, where the mapping process of the adjusted target drug ratio vector is:
[0108] S41: Obtaining the optimal model parameters of the measured branch Optimal model parameters for the measured branches Perform Cholesky decomposition and convert the measured branch optimal model parameters Decomposed into a lower triangular matrix in:
[0109]
[0110] in:
[0111] Represents the attention calculation matrix The Cholesky decomposition result of ;
[0112] Represents the semantic mapping matrix The Cholesky decomposition result of ;
[0113] The optimal model parameters of the measured branch for:
[0114]
[0115] in:
[0116] represents the optimal model parameters of the measured branch The attention calculation matrix in , where the attention calculation matrix is in the form of a matrix with 3 rows and 3 columns;
[0117] represents the optimal model parameters of the measured branch The semantic mapping matrix in the form of a matrix with 3 rows and 3 columns;
[0118] S42: According to the target medicine vector, the target semantic coding vector f1 corresponding to the target medicine vector f is obtained by reverse deduction:
[0119]
[0120] in:
[0121] * indicates convolution processing;
[0122] S43: Use the shared part to map the target semantic coding vector f1 to obtain the adjusted target drug ratio vector f2:
[0123]
[0124] in:
[0125] c1 represents the shared optimal model parameters The Cholesky decomposition results of the shared optimal model parameters is a matrix of 3 rows and 3 columns; in the embodiment of the present invention, The Cholesky decomposition process is consistent with step S41;
[0126] f2 represents the adjusted target drug ratio vector obtained by mapping, wherein the target drug ratio vector is the component ratio of different drug components. The target drug ratio vector is used to complete the drug component ratio of the drug, and the drug with the desired efficacy is obtained by ratioing.
[0127] Optionally, in step S41, the measured branch optimal model parameters Decomposed into a lower triangular matrix include:
[0128] S411: Obtaining the optimal model parameters of the measured branch Any matrix in
[0129]
[0130] in:
[0131] For the matrix The element value of the element in the p-th row and q-th column, p∈[1,3], q∈[1,3], i∈[1,4];
[0132] S412: Matrix Perform Cholesky decomposition and get the matrix The corresponding lower triangular matrix
[0133]
[0134]
[0135]
[0136]
[0137] in:
[0138] T stands for transpose;
[0139] S413: Constructing the optimal model parameters of the measured branch The Cholesky decomposition result is:
[0140]
[0141] in:
[0142] Represents the attention calculation matrix The Cholesky decomposition result of ;
[0143] Represents the semantic mapping matrix The Cholesky decomposition result of .
[0144] In order to solve the above problem, the present invention provides an electronic device, the electronic device comprising:
[0145] A memory storing at least one instruction;
[0146] Communication interface, enabling electronic equipment to communicate; and
[0147] The processor executes the instructions stored in the memory to implement the above-mentioned method for controlling the proportion of pharmaceutical ingredients based on big data analysis.
[0148] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one instruction is stored, and the at least one instruction is executed by a processor in an electronic device to implement the above-mentioned method for controlling the proportion of pharmaceutical ingredients based on big data analysis.
[0149] Compared with the prior art, the present invention proposes a method for controlling the proportion of pharmaceutical ingredients based on big data analysis, which has the following advantages:
[0150] First, this scheme proposes a density clustering method to perform cluster analysis on N drug component ratio vectors to obtain D drug ratio clusters. The cluster analysis process is as follows: calculate the distance between different drug component ratio vectors, where the drug component ratio vector X n With X q The distance between them is:
[0151]
[0152]
[0153] Where: dis(X n ,X q ) represents the drug composition ratio vector X n With X q The distance between them, q∈[1,N]; w m represents the weight of the mth component, where the higher the weight, the less the proportion of the drug with this component; obtain the K nearest neighbor vector set and the reverse K nearest neighbor vector set of the drug component ratio vector, where the drug component ratio vector X n The set of K nearest neighbor vectors is The set of inverse K nearest neighbor vectors is K nearest neighbor vector set Contains the distance medicine component ratio vector X n The K most recent drug component ratio vectors are used as the drug component ratio vector X n The K nearest neighbor vectors of the anti-K nearest neighbor vector set include the drug component ratio vector X n If the drug composition ratio vector X n For X q The neighbor vector of X q For X n The inverse nearest neighbor vector of ; the density of the drug component ratio vector is calculated, where the drug component ratio vector X n The density of is:
[0154]
[0155] Where: n Represents the drug composition ratio vector X n density; Represents the set of K nearest neighbor vectors The nearest neighbor vector and the drug component ratio vector X n The average distance of Represents the set of inverse K nearest neighbor vectors The anti-nearest neighbor vector and the drug component ratio vector X n; the drug component ratio vectors with density greater than 1 are regarded as strong points, and the drug component ratio vectors with density between 0 and 1 are regarded as weak points, and a strong point set and a weak point set are constructed respectively; the drug component ratio vectors that are neighboring vectors in the strong point set are regarded as a group of associated points, wherein the drug component ratio vectors corresponding to the associated points are in the same drug ratio cluster, and D initial drug ratio clusters are obtained, each of which contains multiple strong points; the probability of the drug component ratio vectors corresponding to the weak points belonging to different initial drug ratio clusters is calculated, wherein the probability of the drug component ratio vector X belonging to the d1th initial drug ratio cluster is:
[0156]
[0157] Where: P(X,d) represents the probability that the drug composition ratio vector X belongs to the dth initial drug composition ratio cluster; C d represents the set of drug ingredient ratio vectors in the dth initial drug ratio cluster, c∈C d , c represents the drug composition ratio vector set C d Any drug ingredient ratio vector in , d∈[1,D]; Ω K (X) represents the K nearest neighbor vector set of the drug ingredient ratio vector X, μ(Ω K (X)) represents the set of K nearest neighbor vectors Ω K The average distance between the nearest neighbor vector in (X) and the drug component ratio vector X; exp(·) represents an exponential function with a natural constant as the base; Count(C d ) represents the number of drug ingredient ratio vectors in the dth initial drug ratio cluster; the drug ingredient ratio vectors corresponding to the weaknesses are divided into the initial drug ratio clusters with the highest probability, and D drug ratio clusters are obtained. This scheme collects drug ingredient ratio data and vectorizes the drug ingredient ratio, combines the inverse K nearest neighbor vector set and the K nearest neighbor vector set to calculate the density of the drug ingredient ratio vector, selects the drug ingredient ratio vector with high density as the clustering skeleton, constructs the initial drug ratio cluster, and calculates the probability of other drug ingredient ratio vectors belonging to any drug ratio cluster, realizing the density clustering method based on the inverse K nearest neighbor vector, and classifies the drug ingredient ratio vectors with similar drug ingredient ratios into the same drug ratio cluster.
[0158] At the same time, this scheme proposes a method for controlling the proportion of pharmaceutical ingredients, and constructs a multi-terminal pharmaceutical proportion small deviation prediction model. The model includes a sharing part and a deviation prediction part. The sharing part takes the pharmaceutical ingredient ratio vector as input, and uses the shared network parameters to encode the pharmaceutical ingredient ratio vector to obtain the pharmaceutical ingredient semantic coding vector. The deviation prediction part passes the pharmaceutical ingredient semantic coding vector through the target branch and the measured branch respectively. The target branch maps the pharmaceutical ingredient semantic coding vector to the target pharmaceutical vector. The measured branch selects the pharmaceutical ingredient ratio vector with similar semantics to the pharmaceutical ingredient semantic coding vector from the pharmaceutical proportion cluster, and obtains the corresponding drug efficacy information vector, and combines nonlinear convergence The traditional heuristic algorithm is optimized by factors and random walks. In the early stage of iteration, the convergence factor decreases faster, enhancing the global search capability, and converges slowly in the later stage, which is conducive to local search and improves the convergence accuracy of the algorithm. The random walk method is used to avoid missing local better solutions. In the process of model application, the reverse encoding and decoding method is adopted to map the target drug vector to the target drug ratio vector, realize the reverse application of forward training, and use the target drug vector with higher accuracy as the reverse input, so as to solve the problem of high ambiguity of the final output result in the forward training process, improve the accuracy of the overall input and output vectors of the model, and thus reversely calculate the drug ratio with higher accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0159] Figure 1 A schematic flow chart of a method for controlling the proportion of pharmaceutical ingredients based on big data analysis provided by one embodiment of the present invention;
[0160] Figure 2 A schematic diagram of the structure of an electronic device for implementing a method for controlling the proportion of pharmaceutical ingredients based on big data analysis provided in one embodiment of the present invention.
[0161] In the figure: 1 electronic device, 10 processor, 11 memory, 12 program, 13 communication interface.
[0162] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0163] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0164] The embodiment of the present application provides a method for controlling the proportion of pharmaceutical ingredients based on big data analysis. The execution subject of the method for controlling the proportion of pharmaceutical ingredients based on big data analysis includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the present application. In other words, the method for controlling the proportion of pharmaceutical ingredients based on big data analysis can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
[0165] Embodiment 1:
[0166] S1: Collect drug ingredient ratio data and convert them into drug ingredient ratio vectors, perform cluster analysis on the drug ingredient ratio vectors, and obtain several drug ratio clusters.
[0167] The step S1 collects the drug composition ratio data and converts it into a drug composition ratio vector, including:
[0168] Collect drug composition ratio data:
[0169] {x n |n∈[1,N]}
[0170] in:
[0171] x n represents the drug composition ratio data of the nth drug collected, and N represents the total number of drug composition ratio data collected, wherein the drug composition ratio data is text data describing the different components of the drug and the content of the components;
[0172] The drug composition ratio data is converted into a pharmaceutical composition ratio vector, where the drug composition ratio data x n The vector conversion process is:
[0173] Drug ingredient ratio data x n Perform word segmentation and matching to separate the drug composition ratio data x n The ingredients and their content;
[0174] Initialize and generate the pharmaceutical ingredient matrix, where the pharmaceutical ingredient matrix is a matrix of 1 row and M columns, where M represents the total number of ingredients that can be contained in the drug. The element in the mth column of the pharmaceutical ingredient matrix corresponds to the mth ingredient, and the pharmaceutical ingredient ratio data x n The content of the mth component in is x n (m), m∈[1,M];
[0175] The drug composition ratio data x nThe composition ratios of different ingredients are filled in the pharmaceutical composition matrix to form the pharmaceutical composition ratio vector X n :
[0176]
[0177]
[0178] in:
[0179] X n Represents drug composition ratio data x n The corresponding pharmaceutical ingredient ratio vector;
[0180] Represents drug composition ratio data x n The composition ratio of the mth component in ;
[0181] Cluster analysis is performed on N pharmaceutical ingredient ratio vectors to obtain D pharmaceutical ratio clusters, each of which contains multiple pharmaceutical ingredient ratio vectors, and D represents the number of pharmaceutical ratio clusters obtained by the final clustering.
[0182] The cluster analysis is performed on the N pharmaceutical ingredient ratio vectors to obtain D pharmaceutical ratio clusters, including:
[0183] Perform cluster analysis on N drug ingredient ratio vectors to obtain D drug ratio clusters, where the cluster analysis process is as follows:
[0184] S11: Calculate the distance between different drug component ratio vectors, where the drug component ratio vector X n With X q The distance between them is:
[0185]
[0186]
[0187] in:
[0188] dis(X n ,X q ) represents the drug composition ratio vector X n With X q The distance between them, q∈[1,N];
[0189] w m represents the weight of the mth ingredient, where the higher the weight, the smaller the proportion of drugs containing this ingredient;
[0190] S12: Obtain a set of K nearest neighbor vectors and a set of inverse K nearest neighbor vectors of the drug component ratio vector, wherein the drug component ratio vector X nThe set of K nearest neighbor vectors is The set of inverse K nearest neighbor vectors is K nearest neighbor vector set Contains the distance medicine component ratio vector X n The K most recent drug component ratio vectors are used as the drug component ratio vector X n The K nearest neighbor vectors of the anti-K nearest neighbor vector set include the drug component ratio vector X n If the drug composition ratio vector X n For X q The neighbor vector of X q For X n The inverse neighbor vector of ;
[0191] S13: Calculate the density of the drug component ratio vector, where the drug component ratio vector X n The density of is:
[0192]
[0193] in:
[0194] ρ n Represents the drug composition ratio vector X n density;
[0195] Represents the set of K nearest neighbor vectors The nearest neighbor vector and the drug component ratio vector X n The average distance of
[0196] Represents the set of inverse K nearest neighbor vectors The anti-nearest neighbor vector and the drug component ratio vector X n The average distance of
[0197] The drug component ratio vectors with a density greater than 1 are regarded as strong points, and the drug component ratio vectors with a density between 0 and 1 are regarded as weak points, and the strong point set and the weak point set are constructed respectively;
[0198] S14: taking the medicine component ratio vectors that are neighboring vectors in the strong point set as a group of associated points, wherein the medicine component ratio vectors corresponding to the associated points are in the same medicine ratio cluster, and obtaining D initial medicine ratio clusters, each of which contains multiple strong points;
[0199] S15: Calculate the probability that the drug component ratio vector corresponding to the weakness belongs to different initial drug ratio clusters, where the probability that the drug component ratio vector X belongs to the d1th initial drug ratio cluster is:
[0200]
[0201] in:
[0202] P(X,d) represents the probability that the drug ingredient ratio vector X belongs to the dth initial drug ratio cluster;
[0203] C d represents the set of drug ingredient ratio vectors in the dth initial drug ratio cluster, c∈C d , c represents the drug composition ratio vector set C d Any drug ingredient ratio vector in , d∈[1,D];
[0204] Ω K (X) represents the K nearest neighbor vector set of the drug ingredient ratio vector X, μ(Ω K (X)) represents the set of K nearest neighbor vectors Ω K (X) The average distance between the nearest neighbor vector and the drug component ratio vector X;
[0205] exp(·) represents an exponential function with a natural constant as the base;
[0206] Count(C d ) represents the number of drug ingredient ratio vectors in the dth initial drug ratio cluster;
[0207] S16: Divide the drug ingredient ratio vector corresponding to the weakness into the initial drug ratio cluster with the highest probability, and obtain D drug ratio clusters.
[0208] S2: Construct a multi-terminal medicine ratio small deviation prediction model and determine the multi-terminal medicine ratio small deviation prediction objective function based on the model. The model includes a shared part and a deviation prediction part. The shared part takes the medicine ingredient ratio vector as input and uses the shared network parameters to encode the medicine ingredient ratio vector to obtain the medicine ingredient semantic coding vector. The deviation prediction part passes the medicine ingredient semantic coding vector through the target branch and the measured branch respectively. The target branch maps the medicine ingredient semantic coding vector to the target medicine vector. The measured branch selects the medicine ingredient ratio vector with similar semantics to the medicine ingredient semantic coding vector from the medicine ratio cluster, and obtains the corresponding drug efficacy information vector.
[0209] In the step S2, a multi-terminal medicine ratio small deviation prediction model is constructed, including:
[0210] Construct a multi-terminal medicine ratio small deviation prediction model and determine the multi-terminal medicine ratio small deviation prediction target function based on the model, wherein the multi-terminal medicine ratio small deviation prediction model includes a sharing part and a deviation prediction part, wherein the sharing part takes the medicine component ratio vector as input, and uses the shared network parameters to encode the medicine component ratio vector to obtain the medicine component semantic coding vector, and the deviation prediction part passes the medicine component semantic coding vector through the target branch and the measured branch respectively, and the target branch maps the medicine component semantic coding vector to the target medicine vector, and the measured branch selects the medicine component ratio vector with similar semantics to the medicine component semantic coding vector from the medicine ratio cluster, and obtains the drug efficacy information vector of the corresponding medicine;
[0211] The shared part consists of multiple convolutional layers, each of which has convolutional weight matrix parameters and bias parameters of different sizes. The medical ingredient ratio vector is subjected to multiple continuous convolution encoding processes to obtain a medical ingredient semantic vector; the target branch consists of a residual unit and a fully connected layer. The residual unit performs residual calculation on the medical ingredient semantic vector to obtain the medical ingredient semantic features. The fully connected layer performs feature mapping on the medical ingredient semantic features to obtain a target medical vector; the measured branch consists of a self-attention calculation layer and a similarity matching layer. The self-attention calculation layer is used to calculate the dynamic attention weight of the medical ingredient ratio vector in the medical ratio cluster. The similarity matching layer is used to calculate the semantic similarity between the medical ingredient ratio vector and the medical ingredient semantic encoding vector based on the dynamic attention weight, and the medical ingredient ratio vector with the highest semantic similarity is selected as the output.
[0212] The multi-terminal medicine ratio small deviation prediction objective function is:
[0213]
[0214] θ=[θ1,θ2,θ3]
[0215]
[0216]
[0217]
[0218]
[0219]
[0220] in:
[0221] F(θ) represents the multi-terminal drug ratio small deviation prediction objective function, θ represents the model parameters, θ1, θ2, θ3 represent the shared network parameters, target branch parameters and measured branch parameters respectively;
[0222] Represents the use of shared network parameters θ1 to divide the drug component ratio vector X n Encoding is performed to obtain a semantic encoding vector of the medicinal component;
[0223] Indicates that the target branch parameter θ2 is used to encode the semantic encoding vector of the medicinal ingredients Mapping the resulting target medicine vector;
[0224] It means that the measured branch parameter θ3 is used to select the semantic encoding vector of the medicine component from the medicine ratio cluster Semantically similar medicinal ingredient ratio vector, D * {·} represents obtaining the drug efficacy information vector corresponding to the drug ingredient ratio vector; in the embodiment of the present invention, the drug efficacy information vector is a word vector encoding of the drug efficacy information;
[0225] Indicates that convolution processing is performed using multiple convolutional layers constructed based on shared network parameters θ1;
[0226] θ2(1) represents the residual calculation parameter in the target branch parameter θ2, and θ2(2) represents the fully connected mapping parameter in the target branch parameter θ2;
[0227] Represents the drug component ratio vector X and the drug component semantic encoding vector The semantic similarity between
[0228] weight(X) represents the dynamic attention weight of the drug composition ratio vector X;
[0229] θ3(1),θ3(2),θ3(3) represent the attention calculation matrix in the measured branch parameter θ3;
[0230] T stands for transpose;
[0231] D(x) represents the set of drug ingredient ratio vectors of the drug ratio cluster in which the drug ingredient ratio vector X is located, and Z is any drug ingredient ratio vector in the set D(x);
[0232] θ3(4) represents the semantic mapping matrix in the measured branch parameter θ3;
[0233] ||·||2 denotes the L2 norm.
[0234] S3: Optimize the model parameters based on the multi-terminal drug ratio small deviation prediction objective function to obtain the optimal model parameters, and determine the model instance based on the optimal model parameters.
[0235] In the step S3, the model parameters are optimized based on the multi-terminal medicine ratio small deviation prediction objective function to obtain the optimal model parameters, including:
[0236] The model parameters are optimized based on the multi-terminal medicine ratio small deviation prediction objective function to obtain the optimal model parameters, wherein the improved shark optimization algorithm is the main implementation method of the model parameter optimization. During the model parameter optimization process, the target branches of the shared part and the deviation prediction part are jointly optimized to determine the target branch parameters, and the target branch parameters are fixed. The measured branches are optimized, and the deviation mapping relationship between the target branch and the measured branch is established. The model parameter optimization process is as follows:
[0237] S31: Establish a joint optimization function for the shared part and the target branch:
[0238]
[0239] in:
[0240] F1(θ1,θ2) represents the joint optimization function of the shared part and the target branch;
[0241] D * (X n ) represents the drug composition ratio vector X n The drug efficacy information vector of the corresponding drug;
[0242] S32: Initialize U shark position coordinates, where each shark position coordinate corresponds to a set of joint parameters θ1, θ2 of the shared part and the target branch, where the u-th shark position coordinate generated by initialization is
[0243] S33: Set the current iteration number of the shark position coordinates to t, and the maximum iteration number to Max, then the t-th iteration result of the u-th shark position coordinates is
[0244] S34: Calculate the position iteration coefficients A(t+1), B(t+1) of the t+1th iteration:
[0245] A(t+1)=2rand(0,1)a(t+1)-a(t+1)
[0246] B(t+1)=2rand(0,1)
[0247]
[0248] in:
[0249] rand(0,1) represents a random number between 0 and 1;
[0250] a(t+1) represents the convergence factor;
[0251] S35: Generate a random number between 0 and 1. If the random number is greater than 0.55, iterate using the following position coordinate iteration method:
[0252]
[0253] in:
[0254] z is a random number between (-1,1);
[0255] represents the optimal shark position coordinates after the t-th iteration, that is, the U shark position coordinates after the t-th iteration are used as the input of the joint optimization function, and the shark position coordinate that makes the joint optimization function value reach the minimum is selected as the optimal shark position coordinate after the t-th iteration;
[0256] Otherwise, the following position coordinate iteration method is used for iteration:
[0257]
[0258] in:
[0259] represents any random position coordinate among the U shark position coordinates after the tth iteration;
[0260] S36: Perform a random walk on the iterative results of the position coordinates, where the shark position coordinates The random walk formula is:
[0261]
[0262] S37: Let t = t + 1, return to step S34, until the maximum number of iterations is reached, the U shark position coordinates that have reached the maximum number of iterations are used as the input of the joint optimization function, and the shark position coordinates that make the joint optimization function value reach the minimum are selected
[0263] As the joint optimization result of the shared part and the target branch parameters in To optimize the optimal model parameters of the shared part, The optimal model parameters of the target branch obtained by optimization;
[0264] S37: Fixing optimal model parameters The measured branch parameters are solved with the goal of minimizing the multi-terminal drug ratio small deviation prediction objective function to obtain the measured branch optimal model parameters
[0265] Based on the optimal model parameters Identify the model instance.
[0266] S4: Use the target drug vector as the input of the measured branch of the deviation prediction part, reversely infer the target semantic coding vector, use the shared part to map the target semantic coding vector to obtain the adjusted target drug ratio vector, and control the drug ingredient ratio according to the adjusted target drug ratio vector.
[0267] In the step S4, the target medicine vector is used as the input of the measured branch of the deviation prediction part, and the target semantic coding vector is obtained by reverse deduction. The target semantic coding vector is mapped by using the shared part to obtain the adjusted target medicine ratio vector, including:
[0268] The target drug vector f is determined according to the drug efficacy, and the target drug vector f is used as the input of the measured branch of the deviation prediction part in the multi-terminal drug ratio small deviation prediction model. The target semantic encoding vector f1 corresponding to the target drug vector f is reversed, and the target semantic encoding vector f1 is mapped using the shared part to obtain the adjusted target drug ratio vector f2, where the mapping process of the adjusted target drug ratio vector is:
[0269] S41: Obtaining the optimal model parameters of the measured branch According to the target medicine vector, the target semantic encoding vector f1 corresponding to the target medicine vector f is obtained by reverse deduction:
[0270]
[0271] in:
[0272] * indicates convolution processing;
[0273] S43: Use the shared part to map the target semantic coding vector f1 to obtain the adjusted target drug ratio vector f2:
[0274]
[0275] in:
[0276] c1 represents the shared optimal model parameters The Cholesky decomposition results of the shared optimal model parameters is a matrix of 3 rows and 3 columns; in the embodiment of the present invention, The Cholesky decomposition process is consistent with step S41;
[0277] f2 represents the adjusted target drug ratio vector obtained by mapping, wherein the target drug ratio vector is the component ratio of different drug components. The target drug ratio vector is used to complete the drug component ratio of the drug, and the drug with the desired efficacy is obtained by ratioing.
[0278] In the step S41, the optimal model parameters of the measured branches are Decomposed into a lower triangular matrix include:
[0279] S411: Obtaining the optimal model parameters of the measured branch Any matrix in
[0280]
[0281] in:
[0282] For the matrix The element value of the element in the p-th row and q-th column, p∈[1,3], q∈[1,3], i∈[1,4];
[0283] S412: Matrix Perform Cholesky decomposition and get the matrix The corresponding lower triangular matrix
[0284]
[0285]
[0286]
[0287]
[0288] in:
[0289] T stands for transpose;
[0290] S413: Constructing the optimal model parameters of the measured branch The Cholesky decomposition result is:
[0291]
[0292] in:
[0293] Represents the attention calculation matrix The Cholesky decomposition result of ;
[0294] Represents the semantic mapping matrix The Cholesky decomposition result of .
[0295] Embodiment 2:
[0296] like Figure 2 , is a schematic diagram of the structure of an electronic device for implementing a method for controlling the proportion of pharmaceutical ingredients based on big data analysis provided by an embodiment of the present invention.
[0297] The electronic device 1 may include a processor 10 , a memory 11 , a communication interface 13 , and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10 , such as a program 12 .
[0298] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. The memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as a mobile hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1. Further, the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 11 may be used not only to store application software and various types of data installed in the electronic device 1, such as the code of the program 12, etc., but also to temporarily store data that has been output or is to be output.
[0299] The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (such as a program 12 for implementing the control of the proportion of pharmaceutical ingredients based on big data analysis), and calls the data stored in the memory 11 to execute various functions of the electronic device 1 and process data.
[0300] The communication interface 13 may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device 1 and other electronic devices, and to achieve connection and communication between internal components of the electronic device.
[0301] The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.
[0302] Figure 2 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 2 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0303] For example, although not shown, the electronic device 1 may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, etc. The electronic device 1 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0304] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.
[0305] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0306] The program 12 stored in the memory 11 in the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:
[0307] Collect drug ingredient ratio data and convert them into drug ingredient ratio vectors, perform cluster analysis on the drug ingredient ratio vectors, and obtain several drug ratio clusters;
[0308] Construct a multi-terminal medicine ratio small deviation prediction model and determine the multi-terminal medicine ratio small deviation prediction objective function based on the model;
[0309] Based on the multi-terminal drug ratio small deviation prediction objective function, the model parameters are optimized to obtain the optimal model parameters, and the model instance is determined based on the optimal model parameters;
[0310] The target drug vector is used as the input of the measured branch of the deviation prediction part, and the target semantic coding vector is obtained by reverse deduction. The target semantic coding vector is mapped using the shared part to obtain the adjusted target drug ratio vector, and the drug ingredient ratio is controlled according to the adjusted target drug ratio vector.
[0311] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to Figure 1 to Figure 2 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0312] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0313] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0314] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for controlling the proportion of pharmaceutical ingredients based on big data analysis, characterized in that: The method comprises: S1: Collect drug ingredient ratio data and convert them into drug ingredient ratio vectors, perform cluster analysis on the drug ingredient ratio vectors, and obtain several drug ratio clusters; Collect drug composition ratio data: {x n |n∈[1,N]} in: x n represents the drug composition ratio data of the nth drug collected, and N represents the total number of drug composition ratio data collected, wherein the drug composition ratio data is text data describing the different components of the drug and the content of the components; The drug composition ratio data is converted into a pharmaceutical composition ratio vector, where the drug composition ratio data x n The vector conversion process is: For drug composition ratio data x n Perform word segmentation and matching to separate the drug composition ratio data x n The ingredients and their content; Initialize and generate the pharmaceutical ingredient matrix, where the pharmaceutical ingredient matrix is a matrix of 1 row and M columns, where M represents the total number of ingredients that can be contained in the drug. The element in the mth column of the pharmaceutical ingredient matrix corresponds to the mth ingredient, and the pharmaceutical ingredient ratio data x n The content of the mth component in is x n (m), m∈[1,M]; The drug composition ratio data x n The composition ratios of different ingredients are filled in the pharmaceutical composition matrix to form the pharmaceutical composition ratio vector X n : in: X n Represents drug composition ratio data x n The corresponding pharmaceutical ingredient ratio vector; Represents drug composition ratio data x n The composition ratio of the mth component in ; Performing cluster analysis on N drug component ratio vectors to obtain D drug ratio clusters, wherein each drug ratio cluster contains multiple drug component ratio vectors, and D represents the number of drug ratio clusters finally obtained by clustering; The cluster analysis process is: S11: Calculate the distance between different drug component ratio vectors, where the drug component ratio vector X n With X q The distance between them is: in: dis(X n ,X q ) represents the drug composition ratio vector X n With X q The distance between them, q∈[1,N]; w m represents the weight of the mth ingredient, where the higher the weight, the smaller the proportion of drugs containing this ingredient; S12: Obtain a set of K nearest neighbor vectors and a set of inverse K nearest neighbor vectors of the drug component ratio vector, wherein the drug component ratio vector X n The set of K nearest neighbor vectors is The set of inverse K nearest neighbor vectors is K nearest neighbor vector set Contains the distance medicine component ratio vector X n The K most recent drug component ratio vectors are used as the drug component ratio vector X n The K nearest neighbor vectors of the anti-K nearest neighbor vector set include the drug component ratio vector X n If the drug composition ratio vector X n For X q The neighbor vector of X q For X n The inverse neighbor vector of ; S13: Calculate the density of the drug component ratio vector, where the drug component ratio vector X n The density of is: in: ρ n Represents the drug composition ratio vector X n density; Represents the set of K nearest neighbor vectors The nearest neighbor vector and the drug component ratio vector X n The average distance of Represents the set of inverse K nearest neighbor vectors The anti-nearest neighbor vector and the drug component ratio vector X n The average distance of The drug component ratio vectors with a density greater than 1 are regarded as strong points, and the drug component ratio vectors with a density between 0 and 1 are regarded as weak points, and the strong point set and the weak point set are constructed respectively; S14: taking the medicine component ratio vectors that are neighboring vectors in the strong point set as a group of associated points, wherein the medicine component ratio vectors corresponding to the associated points are in the same medicine ratio cluster, and obtaining D initial medicine ratio clusters, each of which contains multiple strong points; S15: Calculate the probability that the medicine ingredient ratio vector corresponding to the weakness belongs to different initial medicine ratio clusters; S16: dividing the drug ingredient ratio vector corresponding to the weakness into the initial drug ratio cluster with the highest probability, and obtaining D drug ratio clusters; S2: Construct a multi-terminal medicine ratio small deviation prediction model and determine the multi-terminal medicine ratio small deviation prediction objective function based on the model; The construction of a multi-terminal medicine ratio small deviation prediction model includes: The multi-terminal medicine ratio small deviation prediction model includes a sharing part and a deviation prediction part. The sharing part takes the medicine component ratio vector as input, and uses the shared network parameters to encode the medicine component ratio vector to obtain the medicine component semantic coding vector. The deviation prediction part passes the medicine component semantic coding vector through the target branch and the measured branch respectively. The target branch maps the medicine component semantic coding vector to the target medicine vector. The measured branch selects the medicine component ratio vector with similar semantics to the medicine component semantic coding vector from the medicine ratio cluster, and obtains the drug efficacy information vector of the corresponding drug, wherein the drug efficacy information vector is a coding vector composed of the efficacy of the medicine component. The shared part is composed of multiple convolutional layers, each of which has convolutional weight matrix parameters and bias parameters of different sizes. The medical component ratio vector is subjected to multiple continuous convolutional coding processes to obtain the medical component semantic vector; the target branch is composed of residual units and fully connected layers. The residual units perform residual calculations on the medical component semantic vector to obtain the medical component semantic features. The fully connected layer performs feature mapping on the medical component semantic features to obtain the target medical vector; the measured branch is composed of a self-attention calculation layer and a similarity matching layer. The self-attention calculation layer is used to calculate the dynamic attention weight of the medical component ratio vector in the medical ratio cluster. The similarity matching layer is used to calculate the semantic similarity between the medical component ratio vector and the medical component semantic encoding vector based on the dynamic attention weight, and the medical component ratio vector with the highest semantic similarity is selected as the output; The multi-terminal medicine ratio small deviation prediction objective function is: in: F(θ) represents the multi-terminal drug ratio small deviation prediction objective function, θ represents the model parameters, θ1, θ2, θ3 represent the shared network parameters, target branch parameters and measured branch parameters respectively; Represents the use of shared network parameters θ1 to divide the drug component ratio vector X n Encoding is performed to obtain a semantic encoding vector of the medicinal component; Indicates that the target branch parameter θ2 is used to encode the semantic encoding vector of the medicinal ingredients Mapping the resulting target medicine vector; It means that the measured branch parameter θ3 is used to select the semantic encoding vector of the drug component from the drug ratio cluster Semantically similar medicinal ingredient ratio vector, D * {·} indicates obtaining the drug efficacy information vector corresponding to the drug component ratio vector; Indicates that convolution processing is performed using multiple convolutional layers constructed based on shared network parameters θ1; θ2(1) represents the residual calculation parameter in the target branch parameter θ2, and θ2(2) represents the fully connected mapping parameter in the target branch parameter θ2; Represents the drug component ratio vector X and the drug component semantic encoding vector The semantic similarity between weight(X) represents the dynamic attention weight of the drug composition ratio vector X; θ3(1),θ3(2),θ3(3) represent the attention calculation matrix in the measured branch parameter θ3; T stands for transpose; D(x) represents the set of drug ingredient ratio vectors of the drug ratio cluster in which the drug ingredient ratio vector X is located, and Z is any drug ingredient ratio vector in the set D(x); θ3(4) represents the semantic mapping matrix in the measured branch parameter θ3; ||·||2 represents the L2 norm; S3: Optimize the model parameters based on the multi-terminal drug ratio small deviation prediction objective function to obtain the optimal model parameters, and determine the model instance based on the optimal model parameters; S4: Use the target drug vector as the input of the measured branch of the model instance deviation prediction part, and reversely obtain the target semantic encoding vector. Use the shared part to map the target semantic encoding vector to obtain the adjusted target drug ratio vector, and control the drug ingredient ratio according to the adjusted target drug ratio vector.
2. A method for controlling the proportion of pharmaceutical ingredients based on big data analysis as claimed in claim 1, characterized in that: In the step S3, the model parameters are optimized based on the multi-terminal medicine ratio small deviation prediction objective function to obtain the optimal model parameters, including: Based on the multi-terminal medicine ratio small deviation prediction objective function, the model parameters are optimized to obtain the optimal model parameters. In the model parameter optimization process, the target branches of the shared part and the deviation prediction part are jointly optimized to determine the target branch parameters, and the target branch parameters are fixed. The measured branches are optimized, and the deviation mapping relationship between the target branch and the measured branch is established. The model parameter optimization process is as follows: S31: Establish a joint optimization function for the shared part and the target branch: in: F1(θ1,θ2) represents the joint optimization function of the shared part and the target branch; D * (X n ) represents the drug composition ratio vector X n The drug efficacy information vector of the corresponding drug; S32: Initialize U shark position coordinates, where each shark position coordinate corresponds to a set of joint parameters θ1, θ2 of the shared part and the target branch, where the u-th shark position coordinate generated by initialization is S33: Set the current iteration number of the shark position coordinates to t, and the maximum iteration number to Max, then the t-th iteration result of the u-th shark position coordinates is S34: Calculate the position iteration coefficients A(t+1), B(t+1) of the t+1th iteration: A(t+1)=2rand(0,1)a(t+1)-a(t+1) B(t+1)=2rand(0,1) in: rand(0,1) represents a random number between 0 and 1; a(t+1) represents the convergence factor; S35: Generate a random number between 0 and 1. If the random number is greater than 0.55, iterate using the following position coordinate iteration method: in: z is a random number between (-1,1); represents the optimal shark position coordinates after the t-th iteration, that is, the U shark position coordinates after the t-th iteration are used as the input of the joint optimization function, and the shark position coordinate that makes the joint optimization function value reach the minimum is selected as the optimal shark position coordinate after the t-th iteration; Otherwise, the following position coordinate iteration method is used for iteration: in: represents any random position coordinate among the U shark position coordinates after the tth iteration; S36: Perform a random walk on the position coordinate iteration result; S37: Let t = t + 1, return to step S34, until the maximum number of iterations is reached, the U shark position coordinates that have reached the maximum number of iterations are used as the input of the joint optimization function, and the shark position coordinates that make the joint optimization function value reach the minimum are selected As the joint optimization result of the shared part and the target branch parameters in To optimize the optimal model parameters of the shared part, The optimal model parameters of the target branch obtained by optimization; S37: Fixing optimal model parameters The measured branch parameters are solved with the goal of minimizing the multi-terminal drug ratio small deviation prediction objective function to obtain the measured branch optimal model parameters Based on the optimal model parameters Identify the model instance.
3. A method for controlling the proportion of pharmaceutical ingredients based on big data analysis as claimed in claim 1, characterized in that: In the step S4, the target drug vector is used as the input of the measured branch of the model instance deviation prediction part, and the target semantic coding vector is obtained by reverse deduction. The target semantic coding vector is mapped using the shared part to obtain the adjusted target drug ratio vector, including: The target drug vector f is determined according to the drug efficacy, and the target drug vector f is used as the input of the measured branch of the deviation prediction part in the multi-terminal drug ratio small deviation prediction model. The target semantic encoding vector f1 corresponding to the target drug vector f is reversed, and the target semantic encoding vector f1 is mapped using the shared part to obtain the adjusted target drug ratio vector f2, where the mapping process of the adjusted target drug ratio vector is: S41: Obtaining the optimal model parameters of the measured branch Optimal model parameters for the measured branches Perform Cholesky decomposition and convert the measured branch optimal model parameters Decomposed into a lower triangular matrix in: in: Represents the attention calculation matrix The Cholesky decomposition result of ; Represents the semantic mapping matrix The Cholesky decomposition result of ; The optimal model parameters of the measured branch for: in: represents the optimal model parameters of the measured branch The attention calculation matrix in , where the attention calculation matrix is in the form of a matrix with 3 rows and 3 columns; represents the optimal model parameters of the measured branch The semantic mapping matrix in the form of a matrix with 3 rows and 3 columns; S42: According to the target medicine vector, the target semantic coding vector f1 corresponding to the target medicine vector f is obtained by reverse deduction: in: * indicates convolution processing; S43: Use the shared part to map the target semantic coding vector f1 to obtain the adjusted target drug ratio vector f2: in: c1 represents the shared optimal model parameters The Cholesky decomposition results of the shared optimal model parameters It is in the form of a matrix with 3 rows and 3 columns; f2 represents the adjusted target drug ratio vector obtained by mapping, wherein the target drug ratio vector is the component ratio of different drug components. The target drug ratio vector is used to complete the drug component ratio of the drug, and the drug with the desired efficacy is obtained by ratioing.
4. A method for controlling the proportion of pharmaceutical ingredients based on big data analysis as claimed in claim 3, characterized in that: In the step S41, the optimal model parameters of the measured branches are Decomposed into a lower triangular matrix include: S411: Obtaining the optimal model parameters of the measured branch Any matrix in in: For the matrix The element value of the element in the p-th row and q-th column, p∈[1,3], q∈[1,3], i∈[1,4]; S412: Matrix Perform Cholesky decomposition and get the matrix The corresponding lower triangular matrix in: T stands for transpose; S413: Constructing the optimal model parameters of the measured branch The Cholesky decomposition result is: in: Represents the attention calculation matrix The Cholesky decomposition result of ; Represents the semantic mapping matrix The Cholesky decomposition result of .
