A clustering-based federated learning video recommendation method, system and device
By employing a clustering-based federated learning approach, the client generates and encrypts label vectors, the server calculates the Hellinger distance matrix for clustering, the client trains and updates the model, and the server performs weighted aggregation. This approach solves the privacy leakage problem in video recommendation and achieves accurate recommendation and privacy protection.
Patent Information
- Application Number
- CN202310981821.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-04
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2043-08-04
AI Technical Summary
Existing video recommendation technologies suffer from privacy leaks because the data from a single client is insufficient to train a high-performance recommendation model. Data or user privacy information needs to be uploaded to a server, leading to privacy leaks.
A cluster-based federated learning approach is adopted. The client generates and encrypts label vectors, the server calculates the Hellinger distance matrix for hierarchical clustering, the client trains the cluster model and updates the model through mini-batch stochastic gradient descent, and finally the server performs weighted aggregation to form a new cluster model.
It achieves accurate video recommendations while protecting user privacy, reducing computational and communication overhead, and maintaining the Hellinger distance to improve recommendation accuracy.
Smart Images

Figure CN117033698B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of machine learning, and in particular to a clustering-based federated learning video recommendation method, system and device. BACKGROUND
[0002] As a distributed machine learning technology, federated learning can be used to solve data silos and train machine learning models through multiple clients. Federated learning cooperatively trains machine learning models by exchanging models without sending data to others, thereby protecting data privacy and being widely used in medical learning, natural language processing, fraud credit card detection, and video work recommendation.
[0003] However, the current video recommendation technology has the problem of privacy leakage. Because the data of a single client is not enough to train a good recommendation model, in order to better recommend items, the data or user privacy information needs to be uploaded to the server, and the server makes recommendations based on these data, which leads to the problem of privacy leakage. SUMMARY
[0004] Therefore, in order to reduce the risk of user privacy leakage in the video recommendation method, the present application proposes a clustering-based federated learning video recommendation method, which comprises:
[0005] The client generates a label vector according to the local video label and encrypts it to obtain an encrypted label vector;
[0006] Upload the encrypted label vector to the server;
[0007] The server calculates the Hellinger distance matrix between the clients according to the encrypted label vector;
[0008] Hierarchical clustering is performed according to the Hellinger distance matrix between the clients to obtain a clustered cluster;
[0009] Initialize the cluster model for the clustered cluster and send it to the corresponding client;
[0010] The client trains the local data according to the cluster model and uploads the trained local model to the server;
[0011] The server performs weighted aggregation on the trained local model according to the cluster to obtain a new cluster model;
[0012] Distribute the new cluster model to the corresponding client;
[0013] Repeat the training steps until the new cluster model converges to obtain video recommendation.
[0014] Wherein, after the convergence of the cluster model, the latest video information is obtained, the prediction results of each cluster model are obtained through the cluster model, and the video consultation is recommended to the client corresponding to the cluster according to the prediction results.
[0015] In some embodiments, the client generates a label vector according to the local video label and encrypts to obtain an encrypted label vector, and the step specifically includes:
[0016] The client generates a label vector according to the local video label and adjusts and processes the label vector to obtain a data-processed label vector.
[0017] The formula of the adjustment and processing is as follows:
[0018]
[0019] Wherein, n k,C represents the cth label vector of the kth client, n k represents the sum of all label category sample numbers.
[0020] The client generates the same orthogonal matrix using the same random seed, and the order of the orthogonal matrix is the same as the total number of label categories.
[0021] The orthogonal matrix is multiplied by the data-processed label vector to obtain an encrypted label vector.
[0022] Through the preferred step, on the one hand, the label privacy information is safe in the transmission process, and on the other hand, the Hellinger distance obtained by the server is unchanged before and after the label information transformation, which is helpful for the calculation of the Hellinger distance.
[0023] In some embodiments, the formula of the Hellinger distance is as follows:
[0024]
[0025] Wherein, n″ p,i represents the ith value of the label vector Z″ p represents the ith value of the label vector Z″ q,i represents the ith value of the label vector Z″ q represents the ith value of the label vector Z″.
[0026] Through the preferred step, the Hellinger distance between the two clients is calculated to construct a distance matrix. Compared with the Euclidean distance, the Hellinger distance can better measure the distance between two label distributions, and the clustering effect obtained by using the Hellinger distance is better because it considers the overlapping part of the probability distribution.
[0027] In some embodiments, the client trains the cluster model using local data and uploads the trained local model to the server, and the step specifically comprises:
[0028] The client trains the cluster model according to the local data.
[0029] The cross-entropy loss function and the preset learning rate are calculated to update the cluster model to obtain a trained local model.
[0030] The trained local model is uploaded to the server.
[0031] The updating method is a small batch random gradient descent method, and the local data includes features of a video work and a score of the video work given by the client.
[0032] In some embodiments, the weighted aggregation specifically comprises weighted averaging of each cluster model according to the category of the cluster and based on a FedAvg method, and the formula is as follows:
[0033]
[0034] wherein, represents the (t+1)th round cluster model of the Lth cluster, represents the tth round model of the kth client, and D represents the total amount of local video work data of the current cluster containing clients, D k represents the local data amount of the kth client in the current cluster, and the kth client belongs to the current cluster.
[0035] The application further provides a clustering-based federated learning video recommendation system, comprising a client and a server, wherein:
[0036] The client is configured to:
[0037] generate a label vector according to a local video label and encrypt the label vector, and upload the encrypted label vector to the server.
[0038] receive a cluster model sent by the server, train the cluster model using local data, and upload a trained local model to the server.
[0039] The server is configured to:
[0040] calculate a Hellinger distance matrix between the clients according to the encrypted label vector, perform hierarchical clustering according to the Hellinger distance matrix between the clients, and obtain a clustered cluster.
[0041] Initialize a cluster model for the clustered cluster and send the cluster model to a corresponding client.
[0042] receiving the local model trained by the client, performing weighted aggregation on the local model according to the clusters respectively to obtain a new cluster model;
[0043] distributing the new cluster model to the corresponding client.
[0044] The application further provides a clustering-based federated learning video recommendation device, comprising:
[0045] at least one processor;
[0046] at least one memory for storing at least one program;
[0047] When the at least one program is executed by the at least one processor, the at least one processor implements the clustering-based federated learning video recommendation method as described above.
[0048] Based on the above scheme, the application provides a clustering-based federated learning video recommendation method, system and device, which encrypts by using small overhead, fast and orthogonal transformation with unchanged Hellinger distance before and after, and clusters by using Hellinger distance, so as to provide more accurate video recommendation for the client and protect the label information privacy. BRIEF DESCRIPTION OF DRAWINGS
[0049] Figure 1 is a flow diagram of the clustering-based federated learning video recommendation method of the application;
[0050] Figure 2 is a data processing framework diagram of the client and the server of the application;
[0051] Figure 3 is a federated learning framework diagram after clustering of the application. DETAILED DESCRIPTION
[0052] The technical solutions in the embodiments of the application will be clearly and completely described below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only part of the embodiments of the application, rather than all the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the application.
[0053] It should be noted that, for the convenience of description, only the parts related to the application are shown in the drawings. The embodiments in the application and the features in the embodiments can be combined with each other without conflict.
[0054] It should be understood that "system", "apparatus", "unit" and / or "module" used in the present application are a method for distinguishing different components, elements, parts, sections or assemblies at different levels. However, if other words can achieve the same purpose, the words can be replaced by other expressions.
[0055] As shown in the present application and claims, unless the context clearly indicates otherwise, the words "one", "an", "a", and / or "the" do not specify a singular number, but can also include a plural number. Generally, the terms "comprise" and "include" only indicate the inclusion of the steps and elements explicitly identified, and these steps and elements do not constitute an exclusive list, and the method or device can also include other steps or elements. The element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, product or device comprising the element.
[0056] In the description of embodiments of the present application, "a plurality of" means two or more than two. The following terms "first", "second" are only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include one or more features.
[0057] In addition, flowcharts are used in the present application to illustrate the operations performed by the system according to the embodiments of the present application. It should be understood that the preceding or subsequent operations are not necessarily performed in sequence. On the contrary, each step can be processed in reverse order or simultaneously. At the same time, other operations can be added to these processes, or one or more steps of operation can be removed from these processes.
[0058] Referring to Figure 1 , Figure 2 and Figure 3 , the flowchart of an optional example of the clustering-based federated learning video recommendation method proposed by the present application, which can be applied to a computer device. The imaging method proposed in the present embodiment can include but is not limited to the following steps:
[0059] Step S1, the client generates a label vector according to the local video label and encrypts to obtain an encrypted label vector;
[0060] Step S2, the client uploads the encrypted label vector to the server;
[0061] Step S3, the server calculates the Hellinger distance matrix between the clients according to the encrypted label vector;
[0062] Step S4, the server performs hierarchical clustering according to the Hellinger distance matrix between the clients to obtain clustered clusters;
[0063] Step S5, the server initializes a cluster model for the clustered clusters and sends the cluster model to the corresponding client;
[0064] Step S6, the client trains the local data according to the cluster model and uploads the trained local model to the server;
[0065] Step S7, the server performs weighted aggregation on the trained local model according to the cluster to obtain a new cluster model;
[0066] Step S8, the new cluster model is distributed to the corresponding client;
[0067] Step S9, steps S6-S8 are repeated until the new cluster model converges to obtain video recommendation.
[0068] The process of video recommendation is that the client obtains the current video work features, inputs the video work features into each trained cluster model, and obtains a prediction result; and whether the video work is recommended to the client corresponding to the cluster is determined according to the result output by the cluster model.
[0069] It should be noted that the application can also achieve different recommendation results according to different application scenarios, such as path recommendation.
[0070] In this embodiment, before federated learning, the users are clustered according to the video label information watched by the users, but direct sending to the server will cause privacy leakage, so encryption processing is required. The distance used for clustering is Hellinger distance, and the Hellinger distance is more robust than Euclidean distance because it considers the overlapping part of the probability distribution. If there is no overlapping part between two distributions, the Hellinger distance is equal to 1; if the two distributions are completely consistent, the Hellinger distance is equal to 0.
[0071] In some optional embodiments, the client generates a label vector according to the local video label and encrypts the label vector to obtain an encrypted label vector. The step specifically includes:
[0072] S1.1, the client k generates a label vector Z according to the local video label k =[n k,1 ,n k,2 ,...n k,C ] and adjusts and processes the label vector to obtain a data-processed label vector Z k ’=[n′ k,1 ,n′ k,2..., n' k,C ];
[0073] C represents the total number of label categories, assuming that each client's video label has C categories, and the client has not seen the category 0.
[0074] The formula for adjusting the data processing is as follows:
[0075]
[0076] Wherein, n k,C represents the kth client cth label vector, n k =n k,1 +n k,2 +...+n k,C represents the sum of all label category sample numbers.
[0077] S1.2, the client generates the same C-order orthogonal matrix N with the same random seed;
[0078] S1.3, multiply the orthogonal matrix N with the data processed label vector Z k ', to obtain the encrypted label vector Z″ k =[n″ k,1 ,n″ k,2 ,...,n″ k,C ].
[0079] In this embodiment, the encryption method adopts orthogonal transformation, in order to make the Hellinger distance obtained before and after the orthogonal transformation unchanged, the label vector needs to be processed before the orthogonal transformation, and then the orthogonal transformation is performed, so that the Hellinger distance obtained after the orthogonal transformation of the label vector is unchanged, and the availability of the label information is guaranteed; through orthogonal transformation and clustering, the label information privacy of the client is protected, and similar clients are clustered together, so that the recommendation accuracy is greatly improved, and the calculation and communication overhead can be ignored.
[0080] In some feasible embodiments, the server calculates the Hellinger distance matrix between the clients according to the encrypted label vector, and the step specifically includes:
[0081] S3.1, the server calculates the Hellinger distance according to the encrypted label vector;
[0082] The formula for calculating the Hellinger distance is as follows:
[0083]
[0084] Wherein, n″p,i encrypted label vector Z" p the i-th value, n" q,i encrypted label vector Z" q the i-th value. Because the label information has been data processed before the orthogonal transformation, n" is directly used here k,C ;
[0085] S3.2, obtaining a Hellinger distance matrix M according to the Hellinger distance between each two clients.
[0086] wherein, M i,j represents the Hellinger distance between the encrypted label vector Z" of the i-th client and the encrypted label vector Z" of the j-th client.
[0087] In some feasible embodiments, the step of performing hierarchical clustering according to the Hellinger distance matrix between the clients to obtain the clustered clusters is specifically: the server performs hierarchical clustering using the predefined Hellinger distance matrix M, and according to the given threshold, obtains the number L of clustered clusters and the client information contained in each cluster.
[0088] In some feasible embodiments, the step of initializing a cluster model for the clustered cluster and sending it to the corresponding client is specifically: the server initializes a cluster model W L for each cluster, and sends the cluster model W L to the corresponding client, wherein L is the cluster label obtained by clustering.
[0089] In some feasible embodiments, the step of training the cluster model using local data by the client and uploading the trained local model to the server is specifically: the step includes:
[0090] S6.1, the client k trains the cluster model according to local data;
[0091] wherein, the local data includes the features of watching the video works and the scores of the client on the video works.
[0092] S6.2, calculating the cross-entropy loss function and updating the cluster model by a preset learning rate η to obtain a trained local model;
[0093] wherein, the updating method is a small batch stochastic gradient descent method, which is represented as b represents the small batch of local data.
[0094] S6.3, uploading the trained local model to the server.
[0095] In some possible embodiments, the server respectively weights and aggregates the local models trained by the clients in each cluster to obtain a new cluster model, and the step specifically includes:
[0096] S7.1, the server receives the model uploaded by the client in each cluster;
[0097] S7.2, according to the category of the cluster and based on the FedAvg method, the client model of each cluster is weighted and averaged.
[0098] The formula is as follows:
[0099]
[0100] Wherein, represents the cluster model of the Lth cluster in the t+1th round, represents the model of the kth client in the tth round, D represents the total amount of local video work data of the clients in the current cluster, D k represents the local data amount of the kth client in the current cluster, and the kth client belongs to the current cluster.
[0101] Referring to Figure 2 and Figure 3 , a clustering-based federated learning video recommendation system comprises:
[0102] The client is configured to:
[0103] generate a label vector according to a local video label and encrypt the label vector, and upload the encrypted label vector to the server;
[0104] receive the cluster model sent by the server, train the local model according to the cluster model and local data, and upload the trained local model to the server;
[0105] The server is configured to:
[0106] calculate the Hellinger distance matrix between the clients according to the encrypted label vector, perform hierarchical clustering according to the Hellinger distance matrix between the clients, and obtain the clustered clusters;
[0107] initialize the cluster model of the clustered clusters and send the cluster model to the corresponding client;
[0108] receive the trained local model sent by the client, respectively weight and aggregate the local models in each cluster to obtain a new cluster model;
[0109] Distribute the new cluster model to the corresponding client.
[0110] The contents in the method embodiments are applicable to the system embodiments, the system embodiments specifically implement the same functions as the method embodiments, and achieve the same beneficial effects as the method embodiments.
[0111] A clustering-based federated learning video recommendation device:
[0112] At least one processor;
[0113] At least one memory for storing at least one program;
[0114] When the at least one program is executed by the at least one processor, the at least one processor implements the clustering-based federated learning video recommendation method as described above.
[0115] The contents in the method embodiments are applicable to the device embodiments, the device embodiments specifically implement the same functions as the method embodiments, and achieve the same beneficial effects as the method embodiments.
[0116] A storage medium having processor-executable instructions stored therein, the processor-executable instructions, when executed by a processor, are used to implement the clustering-based federated learning video recommendation method as described above.
[0117] The contents in the method embodiments are applicable to the storage medium embodiments, the storage medium embodiments specifically implement the same functions as the method embodiments, and achieve the same beneficial effects as the method embodiments.
[0118] The above is a specific description of the preferred embodiments of the present application, but the present application is not limited to the embodiments described above. Those skilled in the art can make various equivalent modifications or replacements without departing from the spirit of the present application. These equivalent modifications or replacements are all included in the scope defined by the claims of the present application.
Claims
1. A cluster-based federated learning video recommendation method, characterized in that, The method comprises the following steps: The client generates a label vector according to a local video label and encrypts the label vector to obtain an encrypted label vector; The encrypted label vector is uploaded to a server; The server calculates a Hellinger distance matrix between the clients according to the encrypted label vector; Hierarchical clustering is performed according to the Hellinger distance matrix between the clients to obtain clustered clusters; The clustered clusters are initialized into cluster models and then sent to corresponding clients; The client trains the cluster models according to local data and uploads the trained local models to the server; The server performs weighted aggregation on the trained local models according to clusters to obtain new cluster models; The new cluster models are distributed to corresponding clients; The training steps are repeated until the new cluster models converge to obtain video recommendations; The step of generating a label vector according to a local video label and encrypting the label vector to obtain an encrypted label vector comprises the following steps: The client generates a label vector according to a local video label and adjusts and processes the label vector to obtain a data-processed label vector; The client generates a same orthogonal matrix using a same random seed, and the order of the orthogonal matrix is the same as the total number of label types; The encrypted label vector is obtained by multiplying the orthogonal matrix and the data-processed label vector.
2. The cluster-based federated learning video recommendation method according to claim 1, wherein, The formula of the adjustment and processing is as follows: wherein n k,C represents the cth label vector of the kth client, n k represents the sum of the number of samples of all label categories.
3. The cluster-based federated learning video recommendation method according to claim 1, wherein, The formula of the Hellinger distance is as follows: where n p,i denotes the label vector Z p the i-th value, n q,i denotes the label vector Z q the i-th value.
4. The cluster-based federated learning video recommendation method according to claim 1, wherein, The step of training the cluster models according to local data and uploading the trained local models to the server comprises the following steps: The client trains the cluster models according to local data; The cluster models are updated by calculating a cross-entropy loss function and a preset learning rate, and the trained local models are obtained, and the updating method is a small-batch stochastic gradient descent method; The trained local models are uploaded to the server.
5. The cluster-based federated learning video recommendation method according to claim 4, characterized in that, The local data comprises features of a video work and a score of the video work given by the client.
6. The cluster-based federated learning video recommendation method according to claim 1, wherein, The weighted aggregation is specifically weighted averaging of each cluster model according to the categories of the clusters and based on a FedAvg method, and the formula is as follows: wherein, represents the (t+1)-th round cluster model of the L-th cluster, represents the t-th round model of the k-th client, D represents the total amount of local video works data of the clients contained in the current cluster, D k represents the local data amount of the k-th client in the current cluster, the k-th client belongs to the current cluster.
7. A cluster-based federated learning video recommendation system, characterized in that, A clustering-based federated learning video recommendation method comprises a client and a server. The client is configured to: generate a label vector according to a local video label and encrypt the label vector, and upload the encrypted label vector to the server; receive a cluster model sent by the server, train the cluster model according to local data, and upload the trained local model to the server. The server is configured to: calculate a Hellinger distance matrix between the clients according to the encrypted label vector, and perform hierarchical clustering according to the Hellinger distance matrix between the clients to obtain clustered clusters; initialize the clustered clusters into cluster models and then send the cluster models to corresponding clients; receive the trained local models sent by the clients, and perform weighted aggregation on the trained local models according to clusters to obtain new cluster models. distributing the new cluster model to the corresponding client. 8.A clustering-based federated learning video recommendation apparatus, characterized in that, comprising: at least one processor; at least one memory for storing at least one program; when the at least one program is executed by the at least one processor, causing the at least one processor to implement the cluster-based federated learning video recommendation method according to any one of claims 1-6.
Citation Information
Patent Citations
Personalized item recommendation method based on federal learning and similarity ciphertext calculation
CN115659000A
End-to-end federal personalized recommendation method and system based on user interest domain
CN116226540A