New cardiovascular disease prediction method based on client contribution degree federated learning
Through the federated learning method based on client contribution, the data privacy and security issues of traditional centralized machine learning and the data skew and convergence speed issues of federated learning are solved, achieving high accuracy and stability of cardiovascular disease prediction. The risk of single point of failure is reduced, and medical resource sharing is achieved without data leaving the local area.
Patent Information
- Application Number
- CN202410762234.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-09-10
AI Technical Summary
Traditional centralized machine learning has data privacy and security issues, high communication and computing costs, and high single-point failure risks in the medical field. Federated learning has data skew, forgetting problems, and unstable convergence speed.
Adopting a federated learning method based on client contribution, through data preprocessing, Min-Max standardization, client subset selection, local model training, and global model aggregation, the weighted average algorithm FedAvg and exponential moving average are introduced, combined with the Adam optimization algorithm. Dynamically adjust aggregation weights to quantify client contribution.
It improves the accuracy of cardiovascular disease prediction and model stability, reduces the impact of data skew and forgetting, increases the convergence speed, realizes data privacy protection and resource sharing, and reduces the risk of single point failure.
Smart Images

Figure CN118629663A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of disease prediction, and in particular relates to a new method for predicting cardiovascular diseases based on client contribution federated learning. Background Art
[0002] At present, traditional machine learning has achieved relatively good results in prediction in the medical field. Generally speaking, obtaining an accurate machine learning model requires a large amount of centralized training data. However, due to the restrictions of laws related to data privacy protection, different hospitals cannot share data, resulting in the existence of data islands.
[0003] Existing centralized machine learning has the following disadvantages.
[0004] 1. Data privacy and security: In traditional centralized machine learning models, all data usually needs to be concentrated in one place for training. This may lead to potential data privacy and security issues, especially when sensitive personal information or medical data is involved.
[0005] 2. Communication and computational costs: In centralized machine learning, all data needs to be transferred to a central server for model training, which may result in a large amount of communication and computational costs.
[0006] 3. Single point of failure: Centralized machine learning models often rely on a single central server to store and process all data. If that server fails or is attacked, the entire system may be affected.
[0007] Existing federated learning has the following shortcomings.
[0008] 1. Data skew: In federated learning, different institutions may have different data features, which may result in different performances of the models trained by different institutions. This leads to poor generalization of the models and failure to achieve federated fairness.
[0009] 2. Forgetting problem: The complete update of the global model in each round of federated learning will ignore past model information, resulting in model past problems.
[0010] 3. Convergence speed: In federated learning, it is necessary to select appropriate rounds and learning rates to control the speed and stability of the training process. If the selection is inappropriate, the model may converge too slowly or become unstable. Summary of the invention
[0011] The present invention aims to solve the above problems and provides a new method for predicting cardiovascular diseases based on client contribution federated learning.
[0012] To achieve the above object, the present invention adopts the following technical solution, which includes the following steps:
[0013] Step 1) Delete missing values, process outliers, and detect and remove duplicate samples from the collected data;
[0014] Step 2) Use Min-Max normalization to map the data values to ([0,1]) and retain the structure of the original data;
[0015] Step 3) The server selects a subset from all available clients;
[0016] Step 4) Determine the participating clients, and the server will send the current global model parameters to the clients
[0017] Step 5) After receiving the global parameters, each client performs the model training process locally;
[0018] Step 6) After completing local training, the client sends the updated model parameters back to the server;
[0019] Step 7) After receiving updates from all clients, the server uses an aggregation algorithm to integrate these updates; producing a new global model that contains contributions from all clients.
[0020] As a preferred solution, in step 7) of the present invention, the global model aggregation method adopts a weighted average algorithm FedAvg to aggregate the global model W t+1 is defined as follows:
[0021]
[0022] Where W t+1 represents the updated global model, represents the local model updated by the i-th client, m represents the total number of clients, n represents the total number of samples, and ni represents the number of samples of the i-th client; in FedAvg, the local optimization algorithm is stochastic gradient descent; the parameter update is as follows:
[0023]
[0024] Where η represents the learning rate, Represents the loss function relative to the parameter gradient.
[0025] As another preferred solution, in step 7) of the present invention, a method of aggregating sample weights is introduced to quantify the customer's contribution from two key perspectives: similarity and evaluation index;
[0026] In terms of similarity, by calculating the updated model for each client With the global model W tThe cosine similarity between them is used to quantify the client's contribution; the similarity value is mapped to the range [0,2] to reflect the client's contribution to the global model; the corresponding similarity contribution is as follows:
[0027]
[0028] Among them, cos i represents the cosine similarity between client i in round t+1 and the global model weight in round t, and then normalized;
[0029] The accuracy is selected as a parameter to quantify the customer's contribution. The similarity contribution of the model is:
[0030]
[0031] Among them, acc i represents the accuracy of the training set of client i, and then normalized;
[0032] The metric for measuring customer heterogeneity is written as:
[0033]
[0034] Secondly, in step 7) of the present invention, an exponential moving average method is adopted, and the exponential moving average is expressed as follows:
[0035] EMA(t)=α·P(t)+(1-α)·EMA(t-1)(7)
[0036] Where EMA(t) represents the exponential moving average at time t, P(t) represents the price or data at time t, EMA(t-1) represents the exponential moving average at time t-1, and α is the smoothing factor used to smooth EMA(t-1);
[0037] Formula (7) is incorporated into the global aggregation equation in federated learning as follows:
[0038]
[0039] Where W t+1 represents the updated global model, α is a hyperparameter representing the smoothing factor, and γ i The heterogeneous weights of each client defined in Eq. (6) represent the weights of the heterogeneous weights of each client.
[0040] In addition, in step 7) of the present invention, in local training, the Adam optimization algorithm is used, and the corresponding model update is expressed as follows:
[0041]
[0042] Using the dynamic correction amount of the tth round To control the impact of historical data on the current update of the i-th client; represents the sum of squares of all historical gradient data in the i-th client; when η is in the denominator, ∈ is the minimum value to prevent division by zero; β1 and β2 are hyperparameters used to control the weight of historical data.
[0043] The invention has beneficial effects.
[0044] The present invention designs a federated learning algorithm to predict cardiovascular disease by quantifying client contributions while improving the stability of the global model. The present invention has shown robust performance in various diseases, with a particular focus on detailed experiments related to cardiovascular disease. Preliminary experimental comparisons show that FedHC has good prediction results for non-independent and identically distributed data, with ACC and AUC values reaching 0.8526 and 0.8300, respectively. This is attributed to the dynamic adjustment of aggregation weights, which can better adapt to different data types. The addition of historical parameters also plays a vital role in reducing the volatility of individual models. Even if problems occur during a specific update, the influence of historical data can maintain the overall stability of the model. The impact of data skew, model forgetting, and the convergence speed are perfectly reduced. The present invention significantly improves the accuracy of cardiovascular disease prediction and shows strong generalization ability.
[0045] The present invention uses a federated learning framework to achieve medical resource sharing without leaving the local data, thereby protecting data privacy and breaking down data island barriers between institutions.
[0046] The present invention proposes a new method for calculating weights. By dynamically adjusting the aggregation weights, the influence of each client model on the global model can be more flexibly adjusted, solving the problems of data skew and client heterogeneity, thereby achieving a fairer model aggregation process.
[0047] The present invention uses federated learning technology to allow the model to be trained on the local device without uploading data information, reducing the demand for data transmission and central server computing resources, and better protecting data privacy. At the same time, data and computing are decentralized, reducing the risk of single point failure. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The present invention is further described below in conjunction with the accompanying drawings and specific implementation methods. The protection scope of the present invention is not limited to the following description.
[0049] Figure 1 It is a schematic diagram of the federated learning framework of the present invention (taking three clients as an example).
[0050] Figure 2 The heterogeneity of the client of the present invention is a schematic diagram consisting of two components.
[0051] Figure 3 It is a schematic diagram of the algorithm comparison experiment of the present invention on hospital and public data sets. DETAILED DESCRIPTION
[0052] The present invention generally includes three major steps.
[0053] Step 1: Data preprocessing.
[0054] The present invention collects public data sets related to cardiovascular symptoms. In addition, in order to better reflect the real-world scenario, data of patients with acute coronary syndrome from a tertiary hospital in China are also collected and preprocessed accordingly.
[0055] For real clinical data, the present invention performs the following processing.
[0056] 1. Data cleaning: processing missing values, outliers and duplicate values. Delete missing values, process outliers, and detect and remove duplicate samples from the collected data.
[0057] 2. Data conversion: Use Min-Max normalization to map the data values to ([0,1]), preserving the structure of the original data.
[0058] Step 2: Build the model.
[0059] Federated learning is a decentralized machine learning approach that aims to facilitate the collaborative training of cohesive machine learning models among multiple participants without the need to centralize all data in a single location. It has significant advantages in data privacy protection and data decentralization. In federated learning, each round of communication requires five different steps (such as Figure 1 shown), which is summarized as follows.
[0060] Step 1. The server selects a subset from all available clients. This subset can be selected randomly or based on some strategy (for example: selection based on client performance - select clients with higher computing power (such as better CPU or GPU) to ensure faster training process; selection based on client data - select clients with more diverse data distribution to improve the generalization ability of the model; selection based on client historical performance - select clients that performed well in previous training rounds, which may provide more valuable gradient updates).
[0061] Step 2. Once the participating clients are identified, the server sends them the current global model parameters
[0062] Step 3. After receiving the global parameters, each client performs the model training process locally. This involves updating the model using local data, usually using an optimization algorithm such as stochastic gradient descent to minimize the loss function.
[0063] Step 4. After completing local training, the client updates the model parameters ( Figure 1 In These parameters can be encrypted in other ways (differential privacy: adding Laplace noise or Gaussian noise to the parameters before transmitting them; homomorphic encryption: allowing specific mathematical operations to be performed on encrypted data, and the decrypted results are equal to the results of the same operations performed on the original data; multi-party secure computing: multiple parties jointly calculate the results of a function while ensuring the privacy of the inputs of each party) to protect the privacy of client data.
[0064] Step 5. After receiving updates from all clients, the server will use an aggregation algorithm to combine these updates. This produces a new global model that incorporates contributions from all clients.
[0065] Among all existing federated learning algorithms, the most commonly used global model aggregation method is the weighted average algorithm FedAvg, which aggregates the global model W t+1 is defined as follows:
[0066]
[0067] Where W t+1 represents the updated global model, represents the local model updated by the i-th client, m represents the total number of clients, n represents the total number of samples, and ni represents the number of samples of the i-th client. A commonly used local optimization algorithm in FedAvg is stochastic gradient descent (SGD). The parameter update is as follows:
[0068]
[0069] Where η represents the learning rate, Represents the loss function relative to the parameter gradient.
[0070] This paper introduces a new method of aggregating sample weights, called FedHC, which quantifies the contribution of customers from two key perspectives: similarity and evaluation indicators. For details, see Figure 2 .
[0071] Client heterogeneity consists of two components: client similarity and accuracy, which are aggregated to form a new weight.
[0072] In terms of similarity, by calculating the updated model for each client With the global model W t The cosine similarity between the two is used to quantify the client's contribution. A higher cosine similarity indicates that the client brings more new directional information and has a greater impact on the aggregation of the global model, so it should be given a higher weight. The similarity value is mapped to the range [0,2] to reflect the client's contribution to the global model. The corresponding similarity contribution is as follows:
[0073]
[0074]
[0075] Among them, cos i represents the cosine similarity between client i in round t+1 and the global model weights in round t, and then normalized.
[0076] At the same time, accuracy is selected as a parameter to quantify the client's contribution. A lower accuracy indicates that the global model is not well suited to the data of this client, so such data is classified as more heterogeneous data. In this case, the current client parameters should be given a higher weight when aggregated into the global model. The similarity contribution of this model can be written as:
[0077]
[0078] Among them, acc i represents the accuracy of the training set of client i and is then normalized.
[0079] The present invention integrates these two factors into the calculation of customer heterogeneity and aggregates them by summing and normalizing the results. i Replace the term ni / n in formula (1). Finally, the present invention proposes a new measurement method for measuring customer heterogeneity, which can be written as:
[0080]
[0081] In order to solve the forgetting problem in the global model and maintain the stability of the model update to a certain extent, the present invention adopts the exponential moving average (EMA) method. The exponential moving average method calculates the weighted average of historical data based on a smoothing factor (usually a value between 0 and 1). By adjusting the smoothing factor, it can be adjusted according to different needs and data characteristics to adapt to various trends. This method has high flexibility and can effectively update and optimize the global model. The exponential moving average can be expressed as follows:
[0082] EMA(t)=α·P(t)+(1-α)·EMA(t-1)(7)
[0083] Where EMA(t) represents the exponential moving average at time t, P(t) represents the price or data at time t, EMA(t-1) represents the exponential moving average at time t-1, and α is the smoothing factor used to smooth EMA(t-1).
[0084] Formula (7) can be incorporated into the global aggregation equation in federated learning as follows:
[0085]
[0086] Where W t+1 represents the updated global model, α is a hyperparameter representing the smoothing factor, and γ i The heterogeneous weights of each client defined in Eq. (6) represent the weights of the heterogeneous weights of each client.
[0087] In local training, in order to speed up the convergence of the algorithm, the Adam optimization algorithm is used, which combines momentum and adaptive learning rate adjustment features. Adam is widely used in deep learning models in training, which can effectively adjust the learning rate and show adaptability to different parameters. The corresponding model update can be expressed as follows:
[0088]
[0089] Among them, the dynamic correction amount of the tth round is used To control the impact of historical data on the current update of the i-th client. represents the sum of squares of all historical gradient data in the i-th client, and when η is in the denominator, ∈ is the minimum value to prevent division by zero. β1 and β2 are hyperparameters used to control the weight of historical data.
[0090] Step 3: Experimental results.
[0091] Finally, FedHC was tested on multiple datasets with non-independent and identically distributed (data skew) data (including real hospital data), and compared with four common federated learning algorithms. Finally, the FedHC algorithm demonstrated strong prediction capabilities for non-independent and identically distributed data. ACC, AUC, and F1-score were better than other algorithms, solving the problems of data skew and model forgetting, and achieving a faster convergence speed. The specific results are as follows: Figure 3 shown.
[0092] It can be understood that the above specific description of the present invention is only used to illustrate the present invention and is not limited to the technical solutions described in the embodiments of the present invention. Those skilled in the art should understand that the present invention can still be modified or replaced by equivalents to achieve the same technical effects; as long as the use requirements are met, they are within the protection scope of the present invention.
Claims
1. A new method for predicting cardiovascular disease based on client contribution federated learning, characterized by The following steps are involved: Step 1) Delete missing values, process outliers, and detect and remove duplicate samples from the collected data; Step 2) Use Min-Max normalization to map the data values to ([0,1]) and retain the structure of the original data; Step 3) The server selects a subset from all available clients; Step 4) Determine the participating clients, and the server will send the current global model parameters to the clients Step 5) After receiving the global parameters, each client performs the model training process locally; Step 6) After completing local training, the client sends the updated model parameters back to the server; Step 7) After receiving updates from all clients, the server uses an aggregation algorithm to integrate these updates; producing a new global model that contains contributions from all clients.
2. According to claim 1, the new method for predicting cardiovascular disease based on client contribution federated learning is characterized in that In step 7), the global model aggregation method adopts the weighted average algorithm FedAvg to aggregate the global model W t+1 is defined as follows: Where W t+1 represents the updated global model, represents the local model updated by the i-th client, m represents the total number of clients, n represents the total number of samples, and ni represents the number of samples of the i-th client; in FedAvg, the local optimization algorithm is stochastic gradient descent; the parameter update is as follows: Where η represents the learning rate, Represents the loss function relative to the parameter gradient.
3. According to claim 1, the new method for predicting cardiovascular diseases based on client contribution federated learning is characterized in that In step 7), a method of aggregating sample weights is introduced to quantify the customer's contribution from two key perspectives: similarity and evaluation index; In terms of similarity, by calculating the updated model for each client With the global model W t The cosine similarity between them is used to quantify the client's contribution; the similarity value is mapped to the range [0,2] to reflect the client's contribution to the global model; the corresponding similarity contribution is as follows: Among them, cos i represents the cosine similarity between client i in round t+1 and the global model weight in round t, and then normalized; The accuracy is selected as a parameter to quantify the customer's contribution. The similarity contribution of the model is: Among them, acc i represents the accuracy of the training set of client i, and then normalized; The metric for measuring customer heterogeneity is written as:
4. According to claim 1, the new method for predicting cardiovascular disease based on client contribution federated learning is characterized in that In step 7), the exponential moving average method is adopted, and the exponential moving average is expressed as follows: EMA(t)=α·P(t)+(1-α)·EMA(t-1)(7) Where EMA(t) represents the exponential moving average at time t, P(t) represents the price or data at time t, EMA(t-1) represents the exponential moving average at time t-1, and α is the smoothing factor used to smooth EMA(t-1); Formula (7) is incorporated into the global aggregation equation in federated learning as follows: Where W t+1 represents the updated global model, α is a hyperparameter representing the smoothing factor, and γ i The heterogeneous weights of each client defined in Eq. (6) represent the weights of the heterogeneous weights of each client.
5. According to claim 1, the new method for predicting cardiovascular diseases based on client contribution federated learning is characterized in that In step 7), in local training, the Adam optimization algorithm is used, and the corresponding model update is expressed as follows: Using the dynamic correction amount of the tth round To control the impact of historical data on the current update of the i-th client; represents the sum of squares of all historical gradient data in the i-th client; when η is in the denominator, ∈ is the minimum value to prevent division by zero; β1 and β2 are hyperparameters used to control the weight of historical data.
