Personalized federal learning-based drug purchase quantity prediction method
By adopting personalized federal learning methods in the drug supply chain, the DCNN-LSTM hybrid model is constructed to predict the quantity of drug procurement, which solves the problem of difficulty in achieving accurate predictions while protecting doctor-patient privacy in the existing technology, and achieves more efficient and accurate drug demand forecasts.
Patent Information
- Application Number
- CN202411530963.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-28
AI Technical Summary
Existing methods for forecasting drug procurement quantity are difficult to achieve accurate predictions while protecting doctor-patient privacy, especially when dealing with complex doctor-patient relationships and large-scale data.
Using a personalized federated learning method, a DCNN-LSTM hybrid model is constructed to predict the number of drug procurement by performing model training on local devices and sharing model updates only without sharing original data. The method includes data collection and preprocessing, model selection and construction, model training and parameter cutting, model aggregation and optimization, and prediction and supply chain regulation.
On the premise of protecting the privacy of doctors and patients, improve the accuracy and stability of drug procurement quantity prediction, reduce information and communication expenses, and promote the development of medical smart systems.
Smart Images

Figure BDA0005110460500000021 
Figure BDA0005110460500000032 
Figure BDA0005110460500000041
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of drug supply, and in particular relates to a drug purchase quantity prediction method based on personalized federated learning. Background Art
[0002] Currently, the prediction of drug procurement quantity is of great significance in the pharmaceutical industry. Correct prediction can help hospitals and pharmaceutical companies to arrange drug procurement plans reasonably and improve the efficiency and accuracy of the supply chain. However, since drug procurement data often contains doctor-patient relationships and sensitive patient information, protecting doctor-patient privacy has become a key issue.
[0003] At present, traditional drug procurement quantity forecasting methods usually rely on simple statistical models or algorithms based on physical models. However, with the increasing amount and refinement of medical data, traditional methods are difficult to meet the needs of accurate forecasting while protecting the privacy of doctors and patients.
[0004] The federated learning model has strong nonlinear modeling capabilities and the ability to learn large-scale data. It can learn from historical drug procurement data and capture the complex relationship between drug procurement quantity and doctor-patient relationship. Compared with traditional methods, the federated learning model can better handle nonlinear features and complex relationships, thereby improving prediction accuracy and stability.
[0005] Federated learning is an emerging distributed machine learning method that solves the contradiction between privacy protection and data sharing by training models on local devices and sharing only model updates without sharing original data. In the prediction of drug purchase quantity, federated learning allows hospitals and pharmaceutical companies to jointly build prediction models while protecting doctor-patient information, and learn from data from multiple parties and capture the complexity of drug purchase quantity and doctor-patient relationship.
[0006] In order to break through the limitations of traditional methods in processing privacy data and improving prediction accuracy, based on the federated learning model, the present invention provides a drug procurement quantity prediction method based on federated learning to protect medical and patient information, which can improve the accuracy and stability of drug procurement quantity prediction under the premise of protecting medical and patient privacy. Summary of the invention
[0007] In view of the deficiencies in the prior art, in order to protect the privacy of medical and patient information while accurately predicting the purchase quantity of medical drugs, the present invention provides a drug purchase quantity prediction method based on personalized federated learning. This method protects medical and patient information, reduces information communication overhead, and promotes the development of medical intelligence systems. By utilizing federated learning technology, it accurately predicts drug demand, promotes the sustainable development of smart medical systems, and provides key support for the further development of the artificial intelligence industry.
[0008] In order to achieve the above object, a method for predicting drug purchase quantity based on personalized federated learning of the present invention comprises the following steps:
[0009] S1: Identify participating hospitals and pharmacies in the region, collect data and pre-process;
[0010] S2: Selection and construction of federated learning models;
[0011] S3, training the model constructed in step S2 on the local client, then the local client transmits the model parameters to the server, and finally the server aggregates and optimizes the model parameters of each client;
[0012] S4, step S3 The client obtains the optimization model transmitted by the server to predict and apply the drug purchase quantity;
[0013] S5. Adjust the supply chain based on the drug purchase quantity forecast results.
[0014] Preferably, in S1, the collection is: each hospital and pharmacy collects historical data respectively: including drug sales time, drug type, drug price, drug sales quantity, drug sales location, patient age, patient disease type, patient gender, regional population flow data, drug evaluation data, sales data and hospital quantity data, and the collected data is stored in a local server.
[0015] The preprocessing is to clean the data, process missing values and outliers, and perform necessary data normalization, using the Min-Max method to obtain a data set. The specific formula used for normalization is:
[0016]
[0017] in is the value obtained after transformation, X i is the original value, Max is the maximum value of feature X, and Min is the minimum value.
[0018] Preferably, in S2, the selection of federated learning models: DCNN model is mainly used to process and extract spatial structural features, such as in images, signals or sequence data, while LSTM model is used to capture long-term dependencies in time series data; in order to adapt to the complex relationship between drug demand and various factors (such as seasonality, promotional activities, market changes, etc.), DCNN model is selected to process features related to time and space, such as population flow data, drug evaluation data, etc., and LSTM model is selected to process features that change over time, such as drug sales time series data. Thus, a DCNN-LSTM hybrid model is constructed as a federated learning model for drug purchase quantity prediction.
[0019] The DCNN-LSTM hybrid model is constructed as follows:
[0020] DCNN model: DCNN consists of 4 convolutional layers for feature extraction, followed by a pooling layer for dimensionality reduction and feature enhancement, and finally a fully connected layer for classification or regression tasks; among them, the convolutional layer and pooling layer can be repeated multiple times to form a deep neural network.
[0021] LSTM model: Usually, multiple LSTM units are stacked together to form a multi-layer LSTM network for processing time series data; each LSTM unit contains an input gate, a forget gate, an output gate, and a cell state to control the information flow.
[0022] Connection method between DCNN model and LSTM model: DCNN model and LSTM model can process data sets with different features in parallel, and finally fuse them in a higher-level fully connected layer. In the prediction of drug purchase quantity, DCNN model and LSTM model can process different types of input data respectively, for example, DCNN processes data with static features, and LSTM processes time series data, and then fuse them in the later stage of DCNN-LSTM hybrid model to facilitate the prediction of drug purchase quantity; among them, the activation function uses swish function:
[0023] f(x) = x·sigmoid(βx)
[0024] In the above, the expression of the sigmoid function is: β is 1.
[0025] Preferably, in S2, the hyperparameters of the DCNN-LSTM hybrid model are: setting the number of aggregation rounds of the DCNN-LSTM hybrid model to 10, the number of local training times to 20, the learning rate to 0.08, the local batch sample size to 50, and the optimizer to adam.
[0026] Preferably, in S3, the training and optimization of the model are as follows:
[0027] 3.1) Split the data set: All participants collect their own data and divide them into training set, validation set and test set in the proportion of 70%, 15% and 15% respectively.
[0028] 3.2) Model training: The central server transmits the global model and its parameters to all participants, and all participants update the model parameters through the back-propagation algorithm, where the model parameters are weights and biases.
[0029] 3.3) Parameter trimming and transmission of model parameters: All participants trim the model parameter updates obtained from their own training, and encrypt and transmit the trimmed model parameter updates to the central server; the specific process of trimming the model parameter updates obtained from their own training is as follows: the model parameter updates are trimmed using a comprehensive trimming method, which is a combination of horizontal trimming and layered trimming. The use of both horizontal trimming and layered trimming is to comprehensively utilize the diversity and integrity of the data.
[0030] Horizontal pruning helps to maintain data diversity while ensuring that the model can learn data distributions from different environments, thereby improving the generalization ability of purchase quantity prediction. For example, pharmacies in different regions may be affected by factors such as local population structure and disease prevalence, resulting in differences in drug sales. Through horizontal pruning, the model can comprehensively consider these factors and more accurately predict the purchase quantity.
[0031] The specific method of horizontal clipping is: let the model parameter update vector be Δ, set the upper bound of its 2-norm to S∈R, where S is a positive real number representing the maximum allowable size of the vector update (gradient update in machine learning), and R represents the set of all real numbers, that is:
[0032]
[0033] Hierarchical tailoring helps solve the problem of features being scattered across different participants, allowing the model to make full use of all available feature information for prediction. In the prediction of drug purchase quantity, certain features (such as drug prices, inventory, etc.) may only exist in the records of some medical institutions or pharmacies. Through hierarchical tailoring, these scattered features can be integrated to improve the accuracy of the prediction. For example, the purchase quantity of certain special drugs may be affected by their special attributes (such as efficacy, side effects, etc.), which may only be reflected in the records of some pharmacies. Through hierarchical tailoring, the model can make full use of these special attributes and more accurately predict the purchase quantity of such drugs.
[0034] The specific method of the layered clipping is as follows: facing the neural network model, there are 7 layers in total, including four hidden layers, one activation function layer and one output layer in the neural network, and the model parameter update vector of each layer is Δ(1), ..., Δ(6), and the corresponding 2-norm clipping upper bounds are S1, ..., S6, respectively. The model parameter update vector of each layer is clipped by the horizontal clipping method:
[0035] Δ'(j)=π(Δ(j),S j )
[0036] Among them, j is 1 to 6.
[0037] The overall model parameter update clipping upper bound is defined as:
[0038]
[0039] In this embodiment, c=6
[0040] The overall parameter update amount is cut to:
[0041]
[0042] Among them, S level is the upper bound of layered pruning, limiting the sum of parameter updates at each layer, S horizontal It is the upper bound of horizontal clipping, which limits the size of a single parameter update.
[0043] 3.4) Model aggregation: The central server aggregates the model parameter updates transmitted by the selected participants through step 3.3) into global model parameter updates to obtain updated global model parameters. In addition, super-weighted aggregation is used to solve the problem of client data heterogeneity, adaptively evaluate the importance of client data distribution and aggregation parameters, and give higher aggregation weights to clients with similar data distribution and tasks; the method of selecting participants is: randomly selecting 70% of the total number of participants from all participants to participate in model training; the specific method of aggregation is super-weighted aggregation:
[0044]
[0045] Among them, C is the total number of participants selected in a round, is the local model of the ith client after the t+1 round of aggregation, is the jth local model participating in the aggregation of the i-th client local model, α ij The j-th client participates in the aggregation as the super-weighted value of the i-th client's local model:
[0046]
[0047] Super weighted value α ij For learnable parameters, they are dynamically updated throughout the training aggregation phase, and ensure that the weights and target tasks are optimized together:
[0048]
[0049] in and Represent the real data distribution and marginal distribution of the i-th client respectively, is the local learning model of the client, Represents the distance between the P and Q distributions on X×Y:
[0050]
[0051] The estimator of bounded sensitivity f(C) is divided into the following two types:
[0052] (1) When the drug procurement data is evenly distributed, the prediction model is relatively simple, and the privacy protection requirements are high, the bounded sensitivity estimator is:
[0053]
[0054] Among them, Δ k is the model parameter update amount of participant k, is the weight of each participant whose model parameter update amount is selected for aggregation; q is the probability of being selected as the source of the model parameter update amount participating in the aggregation in each round of iteration, and the probability is randomly selected in (0,1); is the sample proportion, m k is the number of samples owned by the participants who are the source of the k-th model parameter update involved in the aggregation, It is the mean of the total number of samples owned by all participants (i.e. the sample number mean).
[0055] (2) When drug procurement data is unevenly distributed, computing resources are limited, or the prediction model is complex, the bounded sensitivity estimator is:
[0056]
[0057] Among them, D min are pre-set hyperparameters for weights and biases.
[0058] Let S be the upper bound of the clipping in the full clipping approach, and set the variance of the Gaussian noise according to the selected bounded sensitivity estimator and the noise scale z:
[0059]
[0060] At the same time, the server provides a generalized global model for each client, and the global model parameters are aggregated as follows:
[0061]
[0062] Among them, N(0,Iσ 2 ) has a mean of 0 and a variance of σ 2 Gaussian distribution, I is the unit matrix, ω t ,ω t+1denote the global model parameters of the tth round and the t+1th round, Δ t+1 Indicates the parameter update amount in the t+1th round.
[0063] The privacy loss value ε is calculated and output based on the noise scale Z and the total number of samples M owned by all participants in the training. The calculation formula of the privacy loss value ε is:
[0064]
[0065] Among them, δ represents the failure probability (that is, the probability that privacy protection is not satisfied); Z represents the noise scale, and its appropriate range is determined through experiments and parameter adjustment according to the specific privacy protection requirements, model performance requirements, and computing resources in actual applications.
[0066] This formula provides the relationship between the privacy loss value ε and the noise scale Z, but it should be noted that it is only an approximation and depends on the settings of other parameters. As for the range of noise scale, it does not have a fixed limit. The choice of noise scale Z is weighed according to factors such as specific privacy protection requirements, model performance requirements, and computing resources. A smaller noise scale may lead to insufficient privacy protection, while a larger noise scale may impair the performance of the model.
[0067] 3.5) Model evaluation and tuning: The central server uses the aggregated local model and global model parameters to update the DCNN-LSTM hybrid model respectively, and transmits the updated local model and global model parameters to all participants. All participants obtain the updated local model and global model, use the same distribution validation set data to evaluate the updated global model and use the heterogeneous distribution validation set data to evaluate the updated local model, calculate the root mean square error (RMSE), and judge whether to further optimize the global model based on the calculation results; if the requirements are not met, that is, the root mean square error does not reach 10%-15%, repeat steps 3.2)-3.5) to further optimize the local model and the global model until the root mean square error reaches 10%-15% after model evaluation; if the requirements are met, proceed to the next step;
[0068] The calculation formula of the root mean square error is:
[0069]
[0070] Among them, y i is the true value of the i-th sample, is the predicted value of the global model for the i-th sample, and M is the number of samples involved in the training;
[0071] 3.6) Use the local model and global model optimized to meet the requirements in step 3.5) to predict the test set data; use the mean absolute error (MAE) to evaluate whether the difference between the predicted result and the actual value meets the requirements. If the difference does not meet the requirements, that is, the MAE does not reach 5%-10%, continue steps 3.1-3.6) until the difference meets the requirements, that is, the MAE reaches 5%-10%. The calculation formula of the mean absolute error is:
[0072]
[0073] Preferably, in S4, the prediction and application are:
[0074] The optimization model obtained by S3 is transmitted to each participant via the central server, and each participant predicts the drug purchase quantity based on its own historical drug data.
[0075] Preferably, S5 specifically includes: each participant adjusts the drug supply chain according to the prediction result of S4, and the adjustment adopts one of the following adjustment methods or a combination of the following adjustment methods:
[0076] 1) Adjust procurement plans in advance: The drug procurement quantity forecast results based on federated learning can provide accurate forecast values, thereby helping supply chain managers understand future demand trends in advance. Based on the forecast results, supply chain managers can adjust drug procurement plans in a timely manner to avoid inventory backlogs or insufficient supply;
[0077] 2) Optimize supply chain operations: The pharmaceutical supply chain involves multiple links, including production, transportation, and distribution. The drug purchase quantity prediction results based on federated learning can provide accurate demand information for each link, thereby optimizing the operation of the supply chain. For example, in the production link, the production plan can be adjusted in time according to the prediction results to meet future demand; in the transportation link, the transportation route and timing can be reasonably arranged according to the prediction results to ensure that the drugs arrive at the destination in time; in the distribution link, the inventory can be reasonably allocated according to the prediction results to meet the needs of different regions;
[0078] 3) Agile response to market changes: The pharmaceutical market changes rapidly, and demand is affected by various factors, such as seasonal changes and epidemics. The forecast results of drug purchase quantity based on the federated learning model can reflect market changes in a timely manner, and supply chain managers can make timely adjustments based on the forecast results to agilely respond to changes in market demand;
[0079] 4) Reduce losses and costs: The accuracy of drug purchase quantity forecasts will help supply chain managers avoid excess or shortages. Reasonable procurement planning can reduce losses caused by inventory backlogs and reduce cost increases caused by insufficient procurement.
[0080] Compared with the prior art, the advantages and beneficial effects of the present invention are as follows:
[0081] 1. Improve data confidentiality: Through federated learning, data is distributed across different devices for training, and only authorized devices can access the data, thereby improving data confidentiality and avoiding the risk of sensitive data leakage.
[0082] 2. Solve the problem of data isolation: In traditional federated learning prediction technology, all data is concentrated in one area for training. In the drug purchase quantity prediction method based on federated learning, the data is scattered on different devices, thus avoiding the problem of data isolation.
[0083] 3. Improve data processing efficiency: Traditional federated learning prediction technology may need to process a large amount of data on a centralized server, making the computing task very time-consuming. The drug purchase quantity prediction method based on federated learning adopts the idea of distributed computing, which distributes the computing tasks of the training model to different devices for processing, thereby improving data processing efficiency.
[0084] 4. Achieve more personalized services: Since the drug purchase quantity prediction method based on federated learning uses local data on the user's device for training, it can provide more personalized prediction results and services to each user.
[0085] 5. Improve prediction accuracy and stability: Data is dispersed across different devices for training, which can avoid overfitting problems and thus improve prediction accuracy and stability.
[0086] 6. Solve the problem of data heterogeneity: The performance of traditional federated learning drops significantly when encountering data heterogeneity. Personalized federated learning generates a personalized local model for each client that is suitable for its local data distribution, thereby improving the client's personalization capabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0087] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0088] Figure 1 This is the model architecture diagram;
[0089] Figure 2 For business process diagram;
[0090] Figure 3 This is the model structure diagram. DETAILED DESCRIPTION
[0091] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention is described in detail below in conjunction with the accompanying drawings. The description in this part is only exemplary and explanatory and should not have any limiting effect on the scope of protection of the present invention.
[0092] A method for predicting the quantity of drug purchases based on federated learning to protect medical and patient information includes the following steps:
[0093] 1. Identify participating hospitals and pharmacies in the region, collect data and pre-process:
[0094] Each hospital and pharmacy collects historical data: including drug sales time, drug type, drug price, drug sales quantity, drug sales location, patient age, patient disease type, patient gender, regional population flow data, drug evaluation data, sales data and hospital quantity data. The collected data is stored in the local server.
[0095] Data preprocessing: Clean the data, process missing values and outliers, and perform necessary data normalization. Use the Min-Max method to normalize the data to obtain the data set. The specific formula used for normalization is:
[0096]
[0097] in is the value obtained after transformation, X i is the original value, Max is the maximum value of feature X, and Min is the minimum value.
[0098] 2. Model selection and construction:
[0099] Selection of federated learning model: The DCNN part is mainly used to process and extract spatial structural features, such as in images, signals or sequence data, while the LSTM part is used to capture long-term dependencies in time series data; in order to adapt to the complex relationship between drug demand and various factors (such as seasonality, promotional activities, market changes, etc.), the DCNN model is selected to process features related to time and space, such as population mobility data, drug evaluation data, etc., and the LSTM model is selected to process features that change over time, such as drug sales time series data. Therefore, a DCNN-LSTM hybrid model is constructed as a federated learning model for predicting drug purchase quantity. As shown in the attached manual Figure 3 As shown, the DCNN-LSTM hybrid model is constructed as follows:
[0100] Structure of the DCNN model: DCNN consists of 4 convolutional layers for feature extraction, followed by a pooling layer for dimensionality reduction and feature enhancement, and finally a fully connected layer for classification or regression tasks.
[0101] The structure of the LSTM model: 3 LSTM units are stacked together to form a multi-layer LSTM network for processing time series data; each LSTM unit contains an input gate, a forget gate, an output gate, and a cell state to control the information flow.
[0102] Connection method between DCNN model and LSTM model: DCNN model and LSTM model can process data sets with different features in parallel, and finally fuse them in a higher-level fully connected layer. In the prediction of drug purchase quantity, DCNN model and LSTM model can process different types of input data respectively, for example, DCNN processes data with static features, and LSTM processes time series data, and then fuse them in the later stage of DCNN-LSTM hybrid model to facilitate the prediction of drug purchase quantity; among them, the activation function uses swish function:
[0103] f(x)=x·sigmoid(βx)……(2)
[0104] In the above, the expression of the sigmoid function is: β is 1.
[0105] Determine the hyperparameters of the DCNN-LSTM hybrid model: Set the number of aggregation rounds of the DCNN-LSTM hybrid model to 10, the number of local training times to 20, the learning rate to 0.08, the local batch sample size to 50, and the optimizer to adam to improve the performance and training effect of the model.
[0106] 3. Model training, parameter pruning and transmission, aggregation and optimization:
[0107] 3.1) Split the data set: All participants collect their own data and divide them into training set, validation set and test set in the proportion of 70%, 15% and 15% respectively.
[0108] 3.2) Model training: The central server transmits the global model and its parameters to all participants, and all participants update the model parameters through the back-propagation algorithm, where the model parameters are weights and biases.
[0109] 3.3) Parameter trimming and transmission of model parameters: All participants trim the model parameter updates obtained from their own training, and encrypt and transmit the trimmed model parameter updates to the central server; the specific process of trimming the model parameter updates obtained from their own training is as follows: the model parameter updates are trimmed using a comprehensive trimming method, which is a combination of horizontal trimming and layered trimming. The use of both horizontal trimming and layered trimming is to comprehensively utilize the diversity and integrity of the data.
[0110] Horizontal pruning helps to maintain data diversity while ensuring that the model can learn data distributions from different environments, thereby improving the generalization ability of purchase quantity prediction. For example, pharmacies in different regions may be affected by factors such as local population structure and disease prevalence, resulting in differences in drug sales. Through horizontal pruning, the model can comprehensively consider these factors and more accurately predict the purchase quantity.
[0111] The specific method of horizontal clipping is: let the model parameter update vector be Δ, set the upper bound of its 2-norm to S∈R, where S is a positive real number representing the maximum allowable size of the vector update (gradient update in machine learning), and R represents the set of all real numbers, that is:
[0112]
[0113] Hierarchical tailoring helps solve the problem of features being scattered across different participants, allowing the model to make full use of all available feature information for prediction. In the prediction of drug purchase quantity, certain features (such as drug prices, inventory, etc.) may only exist in the records of some medical institutions or pharmacies. Through hierarchical tailoring, these scattered features can be integrated to improve the accuracy of the prediction. For example, the purchase quantity of certain special drugs may be affected by their special attributes (such as efficacy, side effects, etc.), which may only be reflected in the records of some pharmacies. Through hierarchical tailoring, the model can make full use of these special attributes and more accurately predict the purchase quantity of such drugs.
[0114] The specific method of the layered clipping is as follows: facing the neural network model, there are 7 layers in total, including four hidden layers, one activation function layer and one output layer in the neural network, and the model parameter update vector of each layer is Δ(1), ..., Δ(6), and the corresponding 2-norm clipping upper bounds are S1, ..., S6, respectively. The model parameter update vector of each layer is clipped by the horizontal clipping method:
[0115] Δ'(j)=π(Δ(j),S j )……(4)
[0116] Among them, j is 1 to 6.
[0117] The overall model parameter update clipping upper bound is defined as:
[0118]
[0119] In this embodiment, c=6;
[0120] The overall parameter update amount is cut to:
[0121]
[0122] Among them, S level is the upper bound of layered pruning, limiting the sum of parameter updates at each layer, S horizontal It is the upper bound of horizontal clipping, which limits the size of a single parameter update.
[0123] 3.4) Model aggregation: The central server aggregates the model parameter updates transmitted by the selected participants through step 3.3) into global model parameter updates to obtain updated global model parameters. In addition, super-weighted aggregation is used to solve the problem of client data heterogeneity, adaptively evaluate the importance of client data distribution and aggregation parameters, and give higher aggregation weights to clients with similar data distribution and tasks; the method of selecting participants is: randomly selecting 70% of the total number of participants from all participants to participate in model training; the specific method of aggregation is super-weighted aggregation:
[0124]
[0125] Among them, C is the total number of participants selected in a round, is the local model of the ith client after the t+1 round of aggregation, is the jth local model participating in the aggregation of the i-th client local model, α ij The j-th client participates in the aggregation as the super-weighted value of the i-th client's local model:
[0126]
[0127] Super weighted value α ij For learnable parameters, they are dynamically updated throughout the training aggregation phase, and ensure that the weights and target tasks are optimized together:
[0128]
[0129] in and Represent the real data distribution and marginal distribution of the i-th client respectively, is the local learning model of the client, Represents the distance between the P and Q distributions on X×Y:
[0130]
[0131] The estimator of bounded sensitivity f(C) is divided into the following two types:
[0132] (1) When the drug procurement data is evenly distributed, the prediction model is relatively simple, and the privacy protection requirements are high, the bounded sensitivity estimator is:
[0133]
[0134] Among them, Δ k is the model parameter update amount of participant k, is the weight of each participant whose model parameter update amount is selected for aggregation; q is the probability of being selected as the source of the model parameter update amount participating in the aggregation in each round of iteration, and the probability is randomly selected in (0,1); is the sample proportion, m k is the number of samples owned by the participants who are the source of the k-th model parameter update involved in the aggregation, It is the mean of the total number of samples owned by all participants (i.e. the sample number mean).
[0135] (2) When drug procurement data is unevenly distributed, computing resources are limited, or the prediction model is complex, the bounded sensitivity estimator is:
[0136]
[0137] Among them, D min are pre-set hyperparameters for weights and biases.
[0138] Let S be the upper bound of the clipping in the full clipping approach, and set the variance of the Gaussian noise according to the selected bounded sensitivity estimator and the noise scale z:
[0139]
[0140] in, is the sensitivity of the function (or model update), that is, the maximum possible value of the function output change. ε is the privacy budget, which determines the degree of privacy protection. The smaller ε is, the stronger the privacy protection is. δ is the failure probability, that is, the probability that the data may not meet differential privacy under ε privacy protection.
[0141] The global model parameters are aggregated as:
[0142]
[0143] Among them, N(0,Iσ 2 ) has a mean of 0 and a variance of σ 2 Gaussian distribution, I is the unit matrix, ω t ,ω t+1 They represent the global model parameters of the tth round and the t+1th round respectively, K is the number of clients participating in this round of aggregation, and n k is the amount of data from client k, N is the total amount of data from all clients, is the model parameter update amount generated by client k in this round of training, S is the set of selected participants, and Represents the result after trimming the model parameter update amount of client k.
[0144] The privacy loss value ε is calculated and output based on the noise scale Z and the total number of samples M owned by all participants in the training. The calculation formula of the privacy loss value ε is:
[0145]
[0146] Among them, δ represents the failure probability (that is, the probability that privacy protection is not satisfied); Z represents the noise scale, and its appropriate range is determined through experiments and parameter adjustment according to the specific privacy protection requirements, model performance requirements, and computing resources in actual applications.
[0147] This formula provides the relationship between the privacy loss value ε and the noise scale Z, but it should be noted that it is only an approximation and depends on the settings of other parameters. As for the range of noise scale, it does not have a fixed limit. The choice of noise scale Z is weighed according to factors such as specific privacy protection requirements, model performance requirements, and computing resources. A smaller noise scale may lead to insufficient privacy protection, while a larger noise scale may impair the performance of the model.
[0148] 3.5) Model evaluation and tuning: The central server uses the aggregated local model and global model parameters to update the DCNN-LSTM hybrid model respectively, and transmits the updated local model and global model parameters to all participants. All participants obtain the updated local model and global model, use the same distribution validation set data to evaluate the updated global model and use the heterogeneous distribution validation set data to evaluate the updated local model, calculate the root mean square error (RMSE), and judge whether to further optimize the global model based on the calculation results; if the requirements are not met, that is, the root mean square error does not reach 10%-15%, repeat steps 3.2)-3.5) to further optimize the local model and the global model until the root mean square error reaches 10%-15% after model evaluation; if the requirements are met, proceed to the next step;
[0149] The calculation formula of the root mean square error is:
[0150]
[0151] Among them, y i is the true value of the i-th sample, is the predicted value of the global model for the i-th sample, and M is the number of samples involved in the training;
[0152] 3.6) Use the local model and global model optimized to meet the requirements in step 3.5) to predict the test set data; use the mean absolute error (MAE) to evaluate whether the difference between the predicted result and the actual value meets the requirements. If the difference does not meet the requirements, that is, the MAE does not reach 5%-10%, continue steps 3.1-3.6) until the difference meets the requirements, that is, the MAE reaches 5%-10%. The calculation formula of the mean absolute error is:
[0153]
[0154] 4. Prediction and application:
[0155] The optimization model obtained in step 3 is transmitted to each participant via the central server, and each participant predicts the drug purchase quantity based on its own historical drug data.
[0156] 5. Supply chain adjustment
[0157] Each participant adjusts the drug supply chain based on the forecast results of step 4 in the following ways:
[0158] Adjust procurement plans in advance: The drug procurement quantity forecast results based on federated learning can provide accurate forecast values, thereby helping supply chain managers understand future demand trends in advance. Based on the forecast results, supply chain managers can adjust drug procurement plans in a timely manner to avoid inventory backlogs or insufficient supply.
[0159] Finally, it should be noted that the above description is only a preferred embodiment of the drug procurement quantity prediction method based on federated learning in drug supply chain regulation, and is not intended to limit the scope of application of the method. Although the method is described in detail in the above embodiment, for technicians in the relevant field, the technical solution can still be modified or some of the technical features can be replaced by equivalents. Any modification, equivalent replacement or improvement made within the spirit and principle of the present invention should be included in the scope of protection of the invention.
Claims
1. A method for predicting drug purchase quantity based on personalized federated learning, comprising the following steps: S1: Identify participating hospitals and pharmacies in the region, collect data and pre-process; S2: Selection and construction of federated learning model, where The federated learning model is selected as follows: the DCNN model is used to process and extract spatial structural features, and the LSTM model is used to capture long-term dependencies in time series data; in order to adapt to the complex relationship between drug demand and various factors, such as seasonality, promotional activities, and market changes, the DCNN model is selected to process features related to time and space, and the LSTM model is selected to process features that change over time; Therefore, a DCNN-LSTM hybrid model is constructed as a federated learning model. The construction method of the DCNN-LSTM hybrid model is as follows: DCNN model: DCNN consists of 4 convolutional layers for feature extraction, followed by a pooling layer for dimensionality reduction and feature enhancement, and finally a fully connected layer for classification or regression tasks; LSTM model: Multiple LSTM units are stacked together to form a multi-layer LSTM network for processing time series data; each LSTM unit contains an input gate, a forget gate, an output gate, and a cell state to control the information flow; The connection mode of the DCNN model and the LSTM model is as follows: the DCNN model and the LSTM model process data sets with different features in parallel, and finally fuse them in a higher-level fully connected layer; in the prediction process of the drug purchase quantity prediction method, the DCNN model and the LSTM model process different types of input data respectively, and then fuse them in the later stage of the DCNN-LSTM hybrid model; wherein the activation function uses the swish function: f(x) = x·sigmoid(βx) In the above, the expression of the sigmoid function is: β is 1; S3, training the model constructed in step S2 on the local client, then the local client transmits the model parameters to the server, and finally the server aggregates and optimizes the model parameters of each client; S4, step S3 The client obtains the optimization model transmitted by the server to predict and apply the drug purchase quantity; S5. Adjust the supply chain based on the drug purchase quantity forecast results.
2. The method for predicting drug purchase quantity according to claim 1, characterized in that: In S1, the collection is as follows: each hospital and pharmacy collects historical data respectively: including drug sales time, drug type, drug price, drug sales quantity, drug sales location, patient age, patient disease type, patient gender, regional population flow data, drug evaluation data, sales data and hospital quantity data, and the collected data is stored in a local server; The preprocessing is: cleaning the data, processing missing values and outliers, and performing necessary data normalization, using the Min-Max method to perform normalization to obtain a data set; the specific formula used for the normalization is: in is the value obtained after transformation, X i is the original value, Max is the maximum value of feature X, and Min is the minimum value.
3. The method for predicting drug purchase quantity according to claim 1, characterized in that: In S2, the hyper parameters of the DCNN-LSTM hybrid model are: setting the number of aggregation rounds of the DCNN-LSTM hybrid model to 10, the number of local training times to 20, the learning rate to 0.08, the local batch sample size to 50, and the optimizer to adam.
4. The method for predicting drug purchase quantity according to claim 1, characterized in that: In S3, the training, parameter pruning and transmission, aggregation and optimization of the model are as follows: 3.1) Split the data set: All participants collect their own data and divide them into training set, validation set and test set in the proportion of 70%, 15% and 15% respectively; 3.2) Model training: The central server transmits the initial global model and its parameters to all participants. All participants update the model parameters locally through the back-propagation algorithm. The model parameters are weights and biases. The data of the participants does not leave the local area, thus achieving user privacy protection. 3.3) Parameter trimming and transmission of model parameters: All participants trim the model parameter update amount obtained from their own training, and encrypt and transmit the trimmed model parameter update amount to the central server; the specific process of trimming the model parameter update amount obtained from their own training is: the model parameter update amount is trimmed by comprehensive trimming, which is formed by combining horizontal trimming and layered trimming. The use of horizontal trimming and layered trimming is to comprehensively utilize the diversity and integrity of data; The specific method of horizontal clipping is: let the model parameter update vector be Δ, set the upper bound of its 2-norm to S∈R, where S is a positive real number representing the maximum allowable size of the vector update (gradient update in machine learning), and R represents the set of all real numbers, that is: The specific method of the layered clipping is as follows: facing the neural network model, there are 7 layers in total, including four hidden layers, one activation function layer and one output layer in the neural network, and the model parameter update vector of each layer is Δ(1), ..., Δ(6), and the corresponding 2-norm clipping upper bounds are S1, ..., S6, respectively. The model parameter update vector of each layer is clipped by the horizontal clipping method: Δ'(j)=π(Δ(j),S j ) Wherein, j is 1 to 6; The overall model parameter update clipping upper bound is defined as: Where, c = 6; The overall parameter update amount is cut to: Among them, S level is the upper bound of layered pruning, limiting the sum of parameter updates at each layer, S horizontal It is the upper bound of horizontal clipping, which limits the size of a single parameter update; 3.4) Model aggregation: The central server aggregates the model parameter updates transmitted by the selected participants through step 3.3) into global model parameter updates to obtain updated global model parameters. In addition, super-weighted aggregation is used to solve the problem of client data heterogeneity, adaptively evaluate the importance of client data distribution and aggregation parameters, and give higher aggregation weights to clients with similar data distribution and tasks; the method of selecting participants is: randomly selecting 70% of the total number of participants from all participants to participate in model training; the specific method of aggregation is super-weighted aggregation: Among them, C is the total number of participants selected in a round, is the local model of the ith client after the t+1 round of aggregation, is the jth local model participating in the aggregation of the i-th client local model, α ij The j-th client participates in the aggregation as the super-weighted value of the i-th client's local model: Super weighted value α ij For learnable parameters, they are dynamically updated throughout the training aggregation phase, and ensure that the weights and target tasks are optimized together: in and Represent the real data distribution and marginal distribution of the i-th client respectively, is the local learning model of the client, Represents the distance between the P and Q distributions on X×Y: The estimator of bounded sensitivity f(C) is divided into the following two types: (1) When the drug procurement data is evenly distributed, the prediction model is relatively simple, and the privacy protection requirements are high, the bounded sensitivity estimator is: Among them, Δ k is the model parameter update amount of participant k, is the weight of each participant whose model parameter update amount is selected for aggregation; q is the probability of being selected as the source of the model parameter update amount participating in the aggregation in each round of iteration, and the probability is randomly selected in (0,1); is the sample proportion, m k is the number of samples owned by the participants who are the source of the k-th model parameter update involved in the aggregation, is the mean of the total number of samples owned by all participants; (2) When drug procurement data is unevenly distributed, computing resources are limited, or the prediction model is complex, the bounded sensitivity estimator is: Among them, D min are pre-set hyperparameters for weights and biases; Let S be the upper bound of the clipping in the full clipping approach, and set the variance of the Gaussian noise according to the selected bounded sensitivity estimator and the noise scale z: At the same time, the server provides a generalized global model for each client, and the global model parameters are aggregated as follows: Among them, N(0,Iσ 2 ) has a mean of 0 and a variance of σ 2 Gaussian distribution, I is the unit matrix, ω t ,ω t+1 denote the global model parameters of the tth round and the t+1th round, Δ t+1 Indicates the parameter update amount in the t+1th round; The privacy loss value ε is calculated and output based on the noise scale Z and the total number of samples M owned by all participants in the training. The calculation formula of the privacy loss value ε is: Among them, δ represents the failure probability, that is, the probability that privacy protection is not satisfied; Z represents the noise scale, and its appropriate range is determined through experiments and parameter adjustment according to the specific privacy protection requirements, model performance requirements, and computing resources in actual applications; 3.5) Model evaluation and tuning: The central server uses the aggregated local model and global model parameters to update the DCNN-LSTM hybrid model respectively, and transmits the updated local model and global model parameters to all participants. All participants obtain the updated local model and global model, use the same distribution validation set data to evaluate the updated global model and use the heterogeneous distribution validation set data to evaluate the updated local model, calculate the root mean square error (RMSE), and judge whether to further optimize the global model based on the calculation results; if the requirements are not met, that is, the root mean square error does not reach 10%-15%, repeat steps 3.2)-3.5) to further optimize the local model and the global model until the root mean square error reaches 10%-15% after model evaluation; if the requirements are met, proceed to the next step; The calculation formula of the root mean square error is: Among them, y i is the true value of the i-th sample, is the predicted value of the global model for the i-th sample, and M is the number of samples involved in the training; 3.6) Use the local model and global model optimized to meet the requirements in step 3.5) to predict the test set data; use the mean absolute error (MAE) to evaluate whether the difference between the predicted result and the actual value meets the requirements. If the difference does not meet the requirements, that is, the MAE does not reach 5%-10%, continue steps 3.1-3.6) until the difference meets the requirements, that is, the MAE reaches 5%-10%; the calculation formula of the mean absolute error is:
5. The method for predicting drug purchase quantity according to claim 1, characterized in that: In S4, the prediction and application are: The optimization model obtained by S3 is transmitted to each participant via the central server, and each participant predicts the drug purchase quantity based on its own historical drug data.
6. The method for predicting drug purchase quantity according to claim 1, characterized in that: S5 specifically includes: each participant adjusts the drug supply chain according to the prediction result of S4, and the adjustment adopts one of the following adjustment methods or a combination of the following adjustment methods: 1) Adjust procurement plans in advance: The drug procurement quantity forecast results based on federated learning can provide accurate forecast values, thereby helping supply chain managers understand future demand trends in advance; Based on the forecast results, supply chain managers can adjust drug purchasing plans in a timely manner to avoid inventory backlogs or insufficient supply. 2) Optimize supply chain operations: The pharmaceutical supply chain involves multiple links, including production, transportation and distribution; The drug purchase quantity prediction results based on federated learning can provide accurate demand information for each link, thereby optimizing the operation of the supply chain; in the production link, the production plan can be adjusted in time according to the prediction results to meet future demand; in the transportation link, the transportation route and timing can be reasonably arranged according to the prediction results to ensure that the drugs arrive at the destination in time; in the distribution link, the inventory can be reasonably allocated according to the prediction results to meet the needs of different regions; 3) Agile response to market changes: The pharmaceutical market changes rapidly, and demand is affected by various factors. The forecast results of drug purchase quantity based on the federated learning model can reflect market changes in a timely manner. Supply chain managers can make timely adjustments based on the forecast results to agilely respond to changes in market demand. 4) Reduce losses and costs: The accuracy of drug procurement quantity forecasts will help supply chain managers avoid excess or shortages; reasonable procurement planning can reduce losses caused by inventory backlogs and reduce cost increases caused by insufficient procurement.
Citation Information
Cited By
Medicament inventory monitoring management method and system
CN119851903A
A method and system for monitoring and managing pharmaceutical inventory
CN119851903B
Drug identification, detection and classification method and system based on privacy calculation, terminal and medium
CN120632831A
Anning service supply and demand resource prediction method, device and equipment
CN120671889A