CN111368196A - Method, apparatus, device and readable storage medium for updating model parameters - Google Patents
Method, apparatus, device and readable storage medium for updating model parameters Download PDFInfo
- Publication number
- CN111368196A CN111368196A CN202010142907.7A CN202010142907A CN111368196A CN 111368196 A CN111368196 A CN 111368196A CN 202010142907 A CN202010142907 A CN 202010142907A CN 111368196 A CN111368196 A CN 111368196A
- Authority
- CN
- China
- Prior art keywords
- terminal
- data
- updating
- model
- encrypted
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 67
- 238000012549 training Methods 0.000 claims abstract description 49
- 238000004364 calculation method Methods 0.000 claims description 17
- 238000012545 processing Methods 0.000 claims description 5
- 238000005516 engineering process Methods 0.000 abstract description 8
- 238000004422 calculation algorithm Methods 0.000 description 13
- 238000004891 communication Methods 0.000 description 6
- 230000006399 behavior Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 238000013478 data encryption standard Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 3
- GNFTZDOKVXKIBK-UHFFFAOYSA-N 3-(2-methoxyethoxy)benzohydrazide Chemical compound COCCOC1=CC=CC(C(=O)NN)=C1 GNFTZDOKVXKIBK-UHFFFAOYSA-N 0.000 description 2
- 230000010354 integration Effects 0.000 description 2
- FGUUSXIOTUKUDN-IBGZPJMESA-N C1(=CC=CC=C1)N1C2=C(NC([C@H](C1)NC=1OC(=NN=1)C1=CC=CC=C1)=O)C=CC=C2 Chemical compound C1(=CC=CC=C1)N1C2=C(NC([C@H](C1)NC=1OC(=NN=1)C1=CC=CC=C1)=O)C=CC=C2 FGUUSXIOTUKUDN-IBGZPJMESA-N 0.000 description 1
- 238000013136 deep learning model Methods 0.000 description 1
- 238000009795 derivation Methods 0.000 description 1
- 238000012417 linear regression Methods 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 230000001131 transforming effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9535—Search customisation based on user profiles and personalisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/06—Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
- G06Q10/067—Enterprise or organisation modelling
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/03—Credit; Loans; Processing thereof
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Theoretical Computer Science (AREA)
- Strategic Management (AREA)
- Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Human Resources & Organizations (AREA)
- Economics (AREA)
- General Physics & Mathematics (AREA)
- Marketing (AREA)
- Entrepreneurship & Innovation (AREA)
- Accounting & Taxation (AREA)
- Development Economics (AREA)
- Finance (AREA)
- General Business, Economics & Management (AREA)
- Game Theory and Decision Science (AREA)
- Educational Administration (AREA)
- Operations Research (AREA)
- Quality & Reliability (AREA)
- Tourism & Hospitality (AREA)
- Technology Law (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
本发明公开了一种模型参数的更新方法、装置、设备及可读存储介质,涉及金融科技领域,该方法包括步骤:第二终端接收第一终端发送的加密后的第一特征数据,以及获取第二特征数据和第二特征数据对应的标签数据,第一特征数据是由第一终端与至少一个相同类型终端通过横向联邦学习得到的;根据第一特征数据、第二特征数据和标签数据计算得到残差,并将残差发送给第一终端,以供第一终端根据残差计算第一梯度值,并根据第一梯度值更新第一特征数据对应的第一模型参数;根据残差计算第二梯度值,根据第二梯度值更新第二特征数据对应的第二模型参数。本发明实现了整合两个不同终端的数据进行模型训练,以提高训练所得模型的性能。
The invention discloses a method, device, device and readable storage medium for updating model parameters, and relates to the field of financial technology. The method includes the steps of: a second terminal receives encrypted first feature data sent by a first terminal, and obtains The second feature data and the label data corresponding to the second feature data, the first feature data is obtained by the first terminal and at least one terminal of the same type through horizontal federated learning; calculated according to the first feature data, the second feature data and the label data Obtain the residual, and send the residual to the first terminal for the first terminal to calculate the first gradient value according to the residual, and update the first model parameter corresponding to the first feature data according to the first gradient value; calculate according to the residual For the second gradient value, the second model parameter corresponding to the second feature data is updated according to the second gradient value. The invention realizes model training by integrating the data of two different terminals, so as to improve the performance of the model obtained by training.
Description
技术领域technical field
本发明涉及金融科技(Fintech)的数据处理技术领域,尤其涉及一种模型参数的更新方法、装置、设备及可读存储介质。The present invention relates to the technical field of data processing in financial technology (Fintech), and in particular, to a method, apparatus, device and readable storage medium for updating model parameters.
背景技术Background technique
随着计算机技术的发展,越来越多的技术应用在金融领域,传统金融业正在逐步向金融科技(Fintech)转变,数据处理技术也不例外,但由于金融行业的安全性、实时性要求,也对数据处理技术提出的更高的要求。With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually transforming into financial technology (Fintech), and data processing technology is no exception. However, due to the security and real-time requirements of the financial industry, It also puts forward higher requirements for data processing technology.
一个典型的应用是推荐系统,但是很多时候标签数据是很难直接获取的,比如在电商的推荐场景下,用户并不会直接指定是否喜欢某一个物品,我们只能依靠用户的行为,并按照一些人为规则来定义,比如用户购买了某一物品,那么我们认为用户喜欢(标签为1);相反如果用户只浏览没有购买,那么我们认为用户不喜欢(标签为0)。但是这种人为的规则定义毕竟不是真实的标签数据,有时候可能与实际情况相差甚远。A typical application is a recommendation system, but it is often difficult to obtain label data directly. For example, in the recommendation scenario of e-commerce, users do not directly specify whether they like an item or not. We can only rely on the user's behavior, and Defined according to some artificial rules, for example, if a user buys an item, then we think that the user likes it (the label is 1); on the contrary, if the user only browses and does not buy, then we think that the user does not like it (the label is 0). However, this artificial rule definition is not real label data after all, and sometimes it may be far from the actual situation.
目前手机端与企业端的联合应用是当前AI领域发展的一个趋势,随着移动互联网的发展,手机端已经成为当前人们获取信息的最主要工具,因此手机端具有非常丰富的用户行为数据,但正如上述所描述的,手机端的数据标签的真实性不高,因此要利用手机端的用户行为需要做大量的数据预处理工作;另一方面,在企业端,用户的信息数据相对较少,但是通常都是非常敏感和重要的隐私数据,比如银行的个人征信、贷款等信息,而且这些数据相对于手机端的用户行为数据,真实性要高很多。因此,如果能够利用这些重要且真实的数据,与手机端数据相结合,将会对推荐模型的性能有很大的提升。At present, the joint application of the mobile terminal and the enterprise terminal is a trend in the current development of AI. With the development of the mobile Internet, the mobile terminal has become the most important tool for people to obtain information. Therefore, the mobile terminal has very rich user behavior data, but as As described above, the authenticity of the data labels on the mobile phone is not high, so a lot of data preprocessing work needs to be done to use the user behavior on the mobile phone; on the other hand, on the enterprise side, the user information data is relatively small, but usually It is very sensitive and important private data, such as bank personal credit information, loans and other information, and these data are much more authentic than user behavior data on mobile phones. Therefore, if these important and real data can be used and combined with mobile phone data, the performance of the recommendation model will be greatly improved.
由此可知,目前如何结合两个不同终端的数据进行模型训练,以提高训练所得模型的性能是亟待解决的问题。It can be seen that how to combine the data of two different terminals for model training to improve the performance of the trained model is an urgent problem to be solved.
发明内容SUMMARY OF THE INVENTION
本发明的主要目的在于提供一种模型参数的更新方法、装置、设备及可读存储介质,旨在解决现有的如何结合两个不同终端的数据进行模型训练,以提高训练所得模型的性能的技术问题。The main purpose of the present invention is to provide a method, device, device and readable storage medium for updating model parameters, which aims to solve the problem of how to combine the data of two different terminals for model training in order to improve the performance of the model obtained by training. technical problem.
为实现上述目的,本发明提供一种模型参数的更新方法,所述模型参数的更新方法包括步骤:In order to achieve the above object, the present invention provides a method for updating model parameters, the method for updating model parameters includes the steps:
第二终端接收第一终端发送的加密后的第一特征数据,以及获取第二特征数据和所述第二特征数据对应的标签数据,其中,所述第一特征数据是由所述第一终端与至少一个相同类型终端通过横向联邦学习得到的,所述第一终端与所述第二终端是不同类型的终端;The second terminal receives the encrypted first characteristic data sent by the first terminal, and acquires the second characteristic data and the label data corresponding to the second characteristic data, wherein the first characteristic data is obtained by the first terminal obtained through horizontal federated learning with at least one terminal of the same type, the first terminal and the second terminal are terminals of different types;
根据所述第一特征数据、所述第二特征数据和所述标签数据计算得到残差,并将所述残差发送给所述第一终端,以供所述第一终端根据所述残差计算第一梯度值,并根据所述第一梯度值更新所述第一特征数据对应的第一模型参数;The residual is calculated according to the first characteristic data, the second characteristic data and the label data, and the residual is sent to the first terminal for the first terminal to use the residual according to the residual. calculating a first gradient value, and updating the first model parameter corresponding to the first feature data according to the first gradient value;
根据所述残差计算第二梯度值,根据所述第二梯度值更新所述第二特征数据对应的第二模型参数。A second gradient value is calculated according to the residual, and a second model parameter corresponding to the second feature data is updated according to the second gradient value.
优选地,所述第二终端接收第一终端发送的加密后的第一特征数据,以及获取第二特征数据和所述第二特征数据对应的标签数据的步骤之后,还包括:Preferably, after the second terminal receives the encrypted first feature data sent by the first terminal and acquires the second feature data and the label data corresponding to the second feature data, the method further includes:
获取所述第一特征数据对应的加密后的第一特征参数,以及获取所述第二特征数据对应的第二特征参数,其中,所述第一特征数据和所述第二特征数据对应的设备标识相同;Obtain the encrypted first feature parameter corresponding to the first feature data, and obtain the second feature parameter corresponding to the second feature data, wherein the device corresponding to the first feature data and the second feature data same identification;
根据所述第一特征数据、所述第二特征数据、所述标签数据、所述第一特征参数和所述第二特征参数计算得到损失值;Calculate the loss value according to the first feature data, the second feature data, the label data, the first feature parameter and the second feature parameter;
将所述损失值发送给第三终端,以供所述第三终端根据所述损失值判断所述第一模型参数和所述第二模型参数是否满足停止更新条件,并返回提示信息;sending the loss value to the third terminal, so that the third terminal can judge whether the first model parameter and the second model parameter meet the stop updating condition according to the loss value, and return prompt information;
若根据所述提示信息确定所述第一模型参数和所述第二模型参数未满足所述停止更新条件,则返回执行所述第二终端接收第一终端发送的加密后的第一特征数据,以及获取第二特征数据和所述标签数据的步骤。If it is determined according to the prompt information that the first model parameter and the second model parameter do not meet the stop updating condition, return to executing the second terminal to receive the encrypted first feature data sent by the first terminal, and the steps of acquiring the second feature data and the label data.
优选地,所述将所述损失值发送给第三终端,以供所述第三终端根据所述损失值判断所述第一模型参数和所述第二模型参数是否满足停止更新条件的步骤包括:Preferably, the step of sending the loss value to a third terminal, so that the third terminal can judge whether the first model parameter and the second model parameter satisfy the update stop condition according to the loss value includes: :
将所述损失值发送给第三终端,以供所述第三终端在接收到所述损失值后,获取上一次更新所述第一模型参数和所述第二模型参数时的损失历史值,并在检测到所述损失值和所述损失历史值之间差值的绝对值小于预设阈值时,确定所述第一模型参数和所述第二模型参数满足停止更新条件,在检测到所述绝对值大于或者等于所述预设阈值时,确定所述第一模型参数和所述第二模型参数未满足所述停止更新条件。sending the loss value to the third terminal, so that after the third terminal receives the loss value, the loss history value of the last update of the first model parameter and the second model parameter is obtained, And when it is detected that the absolute value of the difference between the loss value and the historical loss value is smaller than a preset threshold, it is determined that the first model parameter and the second model parameter meet the stop updating condition, and when it is detected that the When the absolute value is greater than or equal to the preset threshold, it is determined that the first model parameter and the second model parameter do not satisfy the update stop condition.
优选地,所述根据所述残差计算第二梯度值的步骤之前,还包括:Preferably, before the step of calculating the second gradient value according to the residual, the method further includes:
获取所述第二特征数据对应的训练数据,以及获取所述第二特征数据对应的第三特征参数;acquiring training data corresponding to the second characteristic data, and acquiring a third characteristic parameter corresponding to the second characteristic data;
所述根据所述残差计算第二梯度值的步骤包括:The step of calculating the second gradient value according to the residual includes:
根据所述训练数据、所述第三特征参数和所述残差计算第二梯度值。A second gradient value is calculated based on the training data, the third feature parameter and the residual.
优选地,所述根据所述第二梯度值更新所述第二特征数据对应的第二模型参数的步骤包括:Preferably, the step of updating the second model parameter corresponding to the second feature data according to the second gradient value includes:
获取所述第二终端对应的更新系数;obtaining an update coefficient corresponding to the second terminal;
根据所述第二梯度值和所述更新系数更新所述第二特征数据对应的第二模型参数。The second model parameter corresponding to the second feature data is updated according to the second gradient value and the update coefficient.
优选地,所述根据所述第一特征数据、所述第二特征数据和所述标签数据计算得到残差的步骤包括:Preferably, the step of calculating the residual according to the first feature data, the second feature data and the label data includes:
计算所述第二特征数据和所述第二特征数据标签数据之间的差值,并对所述差值进行加密,得到加密后的差值;Calculate the difference between the second characteristic data and the second characteristic data label data, and encrypt the difference to obtain the encrypted difference;
根据加密后的差值和加密后的第一特征数据计算得到加密后的残差;Calculate the encrypted residual according to the encrypted difference and the encrypted first characteristic data;
所述根据所述残差计算第二梯度值,根据所述第二梯度值更新所述第二特征数据对应的第二模型参数的步骤包括:The step of calculating the second gradient value according to the residual, and updating the second model parameter corresponding to the second feature data according to the second gradient value includes:
根据加密后的残差计算得到加密后的第二梯度值,将加密后的第二梯度值发送给第三终端,以供第三终端解密加密后的第二梯度值,并返回解密后的第二梯度值;Calculate the encrypted second gradient value according to the encrypted residual, send the encrypted second gradient value to the third terminal for the third terminal to decrypt the encrypted second gradient value, and return the decrypted second gradient value. two gradient values;
接收所述第三终端返回的,解密后的第二梯度值,根据解密后的第二梯度值更新所述第二特征数据对应的第二模型参数。Receive the decrypted second gradient value returned by the third terminal, and update the second model parameter corresponding to the second feature data according to the decrypted second gradient value.
优选地,所述根据所述残差计算第二梯度值,根据所述第二梯度值更新所述第二特征数据对应的第二模型参数的步骤之后,还包括:Preferably, after the step of calculating the second gradient value according to the residual, and updating the second model parameter corresponding to the second feature data according to the second gradient value, the method further includes:
将更新后的第二模型参数作为所述第二终端中的贷款预测模型的模型参数,得到贷款预测模型;Using the updated second model parameters as the model parameters of the loan prediction model in the second terminal to obtain the loan prediction model;
在接收到待预测数据后,将所述待预测数据输入所述贷款预测模型中,得到所述待预测数据对应的贷款概率,并根据所述贷款概率进行信息推送。After receiving the data to be predicted, the data to be predicted is input into the loan prediction model, the loan probability corresponding to the data to be predicted is obtained, and the information is pushed according to the loan probability.
此外,为实现上述目的,本发明还提供一种模型参数的更新装置,所述模型参数的更新装置包括:In addition, in order to achieve the above object, the present invention also provides a device for updating model parameters, the device for updating model parameters includes:
接收模块,用于接收第一终端发送的加密后的第一特征数据,其中,所述第一特征数据是由所述第一终端与至少一个相同类型终端通过横向联邦学习得到的,所述第一终端与所述第二终端是不同类型的终端;The receiving module is configured to receive the encrypted first feature data sent by the first terminal, wherein the first feature data is obtained by the first terminal and at least one terminal of the same type through horizontal federated learning, and the first A terminal and the second terminal are different types of terminals;
获取模块,用于获取第二特征数据和所述第二特征数据对应的标签数据;an acquisition module for acquiring the second characteristic data and the label data corresponding to the second characteristic data;
计算模块,用于根据所述第一特征数据、所述第二特征数据和所述标签数据计算得到残差;a calculation module, configured to calculate and obtain a residual according to the first characteristic data, the second characteristic data and the label data;
发送模块,用于将所述残差发送给所述第一终端,以供所述第一终端根据所述残差计算第一梯度值,并根据所述第一梯度值更新所述第一特征数据对应的第一模型参数;a sending module, configured to send the residual to the first terminal, so that the first terminal can calculate a first gradient value according to the residual, and update the first feature according to the first gradient value the first model parameter corresponding to the data;
所述计算模块还用于根据所述残差计算第二梯度值;The calculation module is further configured to calculate a second gradient value according to the residual;
更新模块,用于根据所述第二梯度值更新所述第二特征数据对应的第二模型参数。An update module, configured to update the second model parameter corresponding to the second feature data according to the second gradient value.
此外,为实现上述目的,本发明还提供一种模型参数的更新设备,所述模型参数的更新设备包括存储器、处理器和存储在所述存储器上并可在所述处理器上运行的模型参数的更新程序,所述模型参数的更新程序被所述处理器执行时实现如联邦学习服务器对应的模型参数的更新方法的步骤。In addition, in order to achieve the above object, the present invention also provides a device for updating model parameters, the device for updating model parameters includes a memory, a processor, and model parameters stored on the memory and running on the processor The updating program of the model parameter, when the updating program of the model parameter is executed by the processor, implements the steps of the updating method for the model parameter corresponding to the federated learning server.
此外,为实现上述目的,本发明还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有模型参数的更新程序,所述模型参数的更新程序被处理器执行时实现如上所述的模型参数的更新方法的步骤。In addition, in order to achieve the above object, the present invention also provides a computer-readable storage medium, on which an update program of model parameters is stored, and the update program of the model parameters is implemented as described above when executed by a processor. The steps of the update method for the model parameters described above.
在本发明中,第二终端通过联合第一终端加密后的数据进行联合训练,更新预测模型中的模型参数,在保证第一终端数据私密性,即在第一终端不泄露自己原始数据的基础上,让第二终端可以整合自己的数据和第一终端加密后的数据进行联合训练,更新模型参数,即更新对应的预测模型,从而实现了整合两个不同终端的数据进行模型训练,以提高训练所得模型的性能。In the present invention, the second terminal performs joint training by combining the encrypted data of the first terminal to update the model parameters in the prediction model, so as to ensure the privacy of the data of the first terminal, that is, on the basis that the first terminal does not reveal its own original data On the other hand, the second terminal can integrate its own data and the encrypted data of the first terminal for joint training, update the model parameters, that is, update the corresponding prediction model, so as to realize the integration of the data of two different terminals for model training, so as to improve the The performance of the trained model.
附图说明Description of drawings
图1是本发明模型参数的更新方法第一实施例的流程示意图;1 is a schematic flowchart of a first embodiment of a method for updating model parameters of the present invention;
图2是本发明模型参数的更新方法第二施例的流程示意图;2 is a schematic flowchart of the second embodiment of the method for updating model parameters of the present invention;
图3是本发明实施例中模型参数更新过程的一种流程示意图;3 is a schematic flowchart of a model parameter update process in an embodiment of the present invention;
图4是本发明模型参数的更新装置较佳实施例的功能示意图模块图;4 is a functional schematic block diagram of a preferred embodiment of the device for updating model parameters of the present invention;
图5是本发明实施例方案涉及的硬件运行环境的结构示意图。FIG. 5 is a schematic structural diagram of a hardware operating environment involved in the solution of an embodiment of the present invention.
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments.
具体实施方式Detailed ways
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.
本发明提供一种模型参数的更新方法,参照图1,图1为本发明模型参数的更新方法第一实施例的流程示意图。The present invention provides a method for updating model parameters. Referring to FIG. 1 , FIG. 1 is a schematic flowchart of the first embodiment of the method for updating model parameters according to the present invention.
本发明实施例提供了模型参数的更新方法的实施例,需要说明的是,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。This embodiment of the present invention provides an embodiment of a method for updating model parameters. It should be noted that although a logical sequence is shown in the flowchart, in some cases, the sequence shown here may be performed in a different sequence. or the described steps.
模型参数的更新方法应用于服务器或者终端中,终端可以包括诸如手机、平板电脑、笔记本电脑、掌上电脑、个人数字助理(Personal Digital Assistant,PDA)等移动终端,以及诸如数字TV、台式计算机等固定终端。在模型参数的更新方法的各个实施例中,为了便于描述,省略执行主体进行阐述各个实施例。模型参数的更新方法包括:The method for updating model parameters is applied to a server or a terminal, and the terminal may include mobile terminals such as mobile phones, tablet computers, notebook computers, handheld computers, and personal digital assistants (Personal Digital Assistant, PDA), as well as fixed terminals such as digital TVs and desktop computers. terminal. In each embodiment of the method for updating model parameters, for convenience of description, the execution body is omitted to describe each embodiment. Update methods for model parameters include:
步骤S10,第二终端接收第一终端发送的加密后的第一特征数据,以及获取第二特征数据和所述第二特征数据对应的标签数据,其中,所述第一特征数据是由所述第一终端与至少一个相同类型终端通过横向联邦学习得到的,所述第一终端与所述第二终端是不同类型的终端。Step S10, the second terminal receives the encrypted first characteristic data sent by the first terminal, and acquires the second characteristic data and the label data corresponding to the second characteristic data, wherein the first characteristic data is obtained by the The first terminal and at least one terminal of the same type are obtained through horizontal federated learning, and the first terminal and the second terminal are terminals of different types.
第二终端接收第一终端发送的加密后的第一特征数据。具体地,当第一终端在加密得到第一特征数据后,第一终端将加密后的第一特征数据发送给第二终端。或者当第二终端需要更新第二模型参数时,第二终端生成获取请求,将获取请求发送给第一终端。当第一终端接收到获取请求后,第一终端通过与至少一个相同类型的终端进行横向联邦学习,得到第一特征数据,并对第一特征数据进行加密,得到加密后的第一特征数据。第一终端将加密后的第一特征参数发送给第二终端。在本实施例中,第一终端和第二终端为不同类型的终端,如第一终端为手机端,与第一终端进行横向联邦学习的终端也为手机端,此时,手机端特征数据丰富,但标签数据少,且数据真实性不高;第二终端为企业端,而企业端数据少但数据真实性高。第一终端可为一个终端,也可为多个终端。在第一终端和第二终端中,都存在对应的预测模型,其中,预测模型可为线性回归模型,也可为机器学习模型、或者深度学习模型等。本实施例为了便于区分,将第一终端中的预测模型记为第一预测模型,将第二终端中的预测模型记为第二预测模型。The second terminal receives the encrypted first feature data sent by the first terminal. Specifically, after the first terminal obtains the first characteristic data by encryption, the first terminal sends the encrypted first characteristic data to the second terminal. Or when the second terminal needs to update the second model parameter, the second terminal generates an acquisition request, and sends the acquisition request to the first terminal. After the first terminal receives the acquisition request, the first terminal performs horizontal federated learning with at least one terminal of the same type to obtain first feature data, and encrypts the first feature data to obtain encrypted first feature data. The first terminal sends the encrypted first characteristic parameter to the second terminal. In this embodiment, the first terminal and the second terminal are different types of terminals. For example, the first terminal is a mobile terminal, and the terminal that performs horizontal federated learning with the first terminal is also a mobile terminal. At this time, the mobile terminal has rich feature data. , but the label data is small, and the data authenticity is not high; the second terminal is the enterprise end, and the enterprise end has less data but high data authenticity. The first terminal may be one terminal or multiple terminals. Corresponding prediction models exist in both the first terminal and the second terminal, where the prediction model may be a linear regression model, a machine learning model, or a deep learning model, or the like. In this embodiment, for the convenience of distinction, the prediction model in the first terminal is recorded as the first prediction model, and the prediction model in the second terminal is recorded as the second prediction model.
具体地,第一终端根据第一预测模型的第一模型参数和第一训练数据计算得到第一特征数据。若将第一模型参数记为第一训练数据记为第一特征数据记为则第一终端计算第一特征数据的公式可表示为:第一终端在计算得到一特征数据后,第一终端采用预先设置好的加密算法加密第一特征数据,得到加密后的第一特征数据发送给第二终端。在本发明实施例中,用[[a]]表示加密后的a,如加密后的第一特征数据表示为在本实施例中,不限制第一终端中的加密算法,如第一终端可采用DES(Data Encryption Standard,数据加密标准)、IDEA(International Data EncryptionAlgorithm国际数据加密算法)和AES(Advanced Encryption Standard,高级加密标准)等加密算法对第一特征数据进行加密。可以理解的是,第一终端将第一特征数据加密后发送给第二终端,保证了第一终端中数据的私密性,即保证了第一终端中数据的安全性。Specifically, the first terminal calculates and obtains the first feature data according to the first model parameters of the first prediction model and the first training data. If the first model parameter is denoted as The first training data is recorded as The first characteristic data is recorded as Then the formula for calculating the first characteristic data by the first terminal can be expressed as: After the first terminal calculates and obtains a characteristic data, the first terminal encrypts the first characteristic data by using a preset encryption algorithm, and obtains the encrypted first characteristic data and sends it to the second terminal. In the embodiment of the present invention, the encrypted a is represented by [[a]], for example, the encrypted first feature data is represented as In this embodiment, the encryption algorithm in the first terminal is not limited. For example, the first terminal may use DES (Data Encryption Standard, data encryption standard), IDEA (International Data Encryption Algorithm) and AES (Advanced An encryption algorithm such as Advanced Encryption Standard) encrypts the first characteristic data. It can be understood that the first terminal encrypts the first characteristic data and sends it to the second terminal, which ensures the privacy of the data in the first terminal, that is, the security of the data in the first terminal.
第二终端获取第二特征数据和第二特征数据对应的标签数据。需要说明的是,第二终端得到第二特征数据的过程和第一终端得到一特征数据的过程相似,即第二终端获取第二模型参数,以及获取第二训练数据,然后计算第二参数和第二训练数据之间的乘积,得到第二特征数据。若将第二模型参数记为第二训练数据记为第二特征数据记为则第二终端计算第二特征数据的公式可表示为:需要说明的是,本实施例是为了便于描述,采用两个模型参数来举例。在具体应用过程中,第一预测模型和第二预测模型中模型参数的个数可根据具体需要而设置。The second terminal acquires the second feature data and the label data corresponding to the second feature data. It should be noted that the process for the second terminal to obtain the second feature data is similar to the process for the first terminal to obtain a feature data, that is, the second terminal obtains the second model parameters, and obtains the second training data, and then calculates the second parameter and The second feature data is obtained by multiplying the second training data. If the second model parameter is denoted as The second training data is denoted as The second characteristic data is recorded as Then the formula for calculating the second characteristic data by the second terminal can be expressed as: It should be noted that, in this embodiment, for the convenience of description, two model parameters are used as an example. In a specific application process, the number of model parameters in the first prediction model and the second prediction model can be set according to specific needs.
标签数据是与第二训练数据对应的,每个第二训练数据都存在对应的标签数据。在本实施例中,只有第二终端中的第二训练数据才有标签数据,第一终端中的第一训练数据没有对应的标签数据。具体地,如当第二训练数据为表示用户喜欢A物品,若用户表示喜欢A物品,则标签数据为“1”;若用户表示不喜欢A物品,则标签数据为“0”。在本实施例中,不限制标签数据的表现形式。The label data corresponds to the second training data, and each second training data has corresponding label data. In this embodiment, only the second training data in the second terminal has label data, and the first training data in the first terminal has no corresponding label data. Specifically, if the second training data indicates that the user likes item A, if the user indicates that he likes item A, the label data is "1"; if the user indicates that he does not like item A, the label data is "0". In this embodiment, the representation form of the tag data is not limited.
步骤S20,根据所述第一特征数据、所述第二特征数据和所述标签数据计算得到残差,并将所述残差发送给所述第一终端,以供所述第一终端根据所述残差计算第一梯度值,并根据所述第一梯度值更新所述第一特征数据对应的第一模型参数。Step S20: Calculate and obtain a residual error according to the first feature data, the second feature data and the label data, and send the residual error to the first terminal for the first terminal to use according to the selected data. A first gradient value is calculated from the residual, and a first model parameter corresponding to the first feature data is updated according to the first gradient value.
当第二终端得到加密后的第一特征数据、第二特征数据和标签数据后,第二终端根据第一特征数据、第二特征数据和标签数据计算得到残差,并将残差发送给第一终端。需要说明的是,第二终端发送给第一终端的残差为加密后的残差。当第一终端接收到加密后的残差后,第一终端根据加密后的残差、第一训练数据和第一模型参数计算得到第一梯度值。After the second terminal obtains the encrypted first feature data, the second feature data and the label data, the second terminal calculates and obtains the residual according to the first feature data, the second feature data and the label data, and sends the residual to the first a terminal. It should be noted that the residual sent by the second terminal to the first terminal is the encrypted residual. After the first terminal receives the encrypted residual, the first terminal calculates and obtains the first gradient value according to the encrypted residual, the first training data and the first model parameter.
具体地,第一终端计算加密后的残差和第一训练数据之间的第一乘积,以及计算第一模型参数和梯度系数之间的第二乘积,并对第二乘积进行加密,得到加密后的第二乘积,根据第一乘积和加密后的第二乘积计算得到加密后的第一梯度值。若将加密后的残差记为[[di]],梯度系数记为λ,梯度系数的大小可根据具体需要而设置,本实施例对梯度系数的大小不做具体限制,加密后的第一梯度值记为则计算加密后的第一梯度值的公式可表示为:Specifically, the first terminal calculates the first product between the encrypted residual and the first training data, and calculates the second product between the first model parameter and the gradient coefficient, and encrypts the second product to obtain the encrypted After the second product, the encrypted first gradient value is obtained by calculating the first product and the encrypted second product. If the encrypted residual is denoted as [[d i ]], the gradient coefficient is denoted as λ, and the size of the gradient coefficient can be set according to specific needs. This embodiment does not impose specific restrictions on the size of the gradient coefficient. A gradient value is denoted as Then the formula for calculating the encrypted first gradient value can be expressed as:
当第一终端计算得到加密后的第一梯度值后,第一终端将加密后的第一梯度值发送给第三终端。需要说明的是,第三终端是第一终端和第二终端信任的终端,第三终端知道第一终端和第二终端加密数据的加密算法,第三终端可解密第一终端和第二终端发送的,加密后的数据。当第三终端接收到第一终端发送的,加密后的第一梯度值后,第三终端解密加密后的第一梯度值,得到解密后的第一梯度值,并将解密后的第一梯度值发送给第一终端。当第一终端接收到解密后的第一梯度值后,第一终端获取第一更新系数,计算第一更新系数与解密后的第一梯度值之间的乘积,然后将第一模型参数减去第一更新系数与解密后的第一梯度值之间的乘积,得到更新后的第一模型参数。在本实施例中,不限制第一更新系数的大小,用户可根据具体需要设置第一更新系数的大小。若将第一更新系数记为η1,更新后的第一模型参数记为则第一终端计算更新后的第一模型参数的公式可表示为:After the first terminal calculates and obtains the encrypted first gradient value, the first terminal sends the encrypted first gradient value to the third terminal. It should be noted that the third terminal is a terminal trusted by the first terminal and the second terminal, the third terminal knows the encryption algorithm of the encrypted data of the first terminal and the second terminal, and the third terminal can decrypt the data sent by the first terminal and the second terminal. , encrypted data. When the third terminal receives the encrypted first gradient value sent by the first terminal, the third terminal decrypts the encrypted first gradient value, obtains the decrypted first gradient value, and deciphers the decrypted first gradient value. The value is sent to the first terminal. After the first terminal receives the decrypted first gradient value, the first terminal obtains the first update coefficient, calculates the product of the first update coefficient and the decrypted first gradient value, and then subtracts the first model parameter The product of the first update coefficient and the decrypted first gradient value obtains the updated first model parameter. In this embodiment, the size of the first update coefficient is not limited, and the user can set the size of the first update coefficient according to specific needs. If the first update coefficient is denoted as η 1 , the updated first model parameter is denoted as Then the formula for calculating the updated first model parameters by the first terminal can be expressed as:
由上述公式可知,本实施例中是利用梯度下降算法进行模型参数的更新。It can be seen from the above formula that in this embodiment, the gradient descent algorithm is used to update the model parameters.
步骤S30,根据所述残差计算第二梯度值,根据所述第二梯度值更新所述第二特征数据对应的第二模型参数。Step S30: Calculate a second gradient value according to the residual, and update a second model parameter corresponding to the second feature data according to the second gradient value.
当第二终端计算得到残差后,第二终端根据残差计算得到第二梯度值,并根据第二梯度值更新第二特征数据对应的第二模型参数,即更新第二预测模型的第二模型参数,得到更新后的第二模型参数。当得到更新后的第二模型参数,第二终端将更新后的第二模型参数输入第二预测模型中,得到可用于数据预测的第二预测模型。After the second terminal calculates and obtains the residual, the second terminal calculates the second gradient value according to the residual error, and updates the second model parameter corresponding to the second feature data according to the second gradient value, that is, updates the second parameter of the second prediction model. model parameters to obtain the updated second model parameters. When the updated second model parameters are obtained, the second terminal inputs the updated second model parameters into the second prediction model to obtain a second prediction model that can be used for data prediction.
进一步地,所述根据所述第一特征数据、所述第二特征数据和所述标签数据计算得到残差的步骤包括:Further, the step of calculating the residual according to the first feature data, the second feature data and the label data includes:
步骤a,计算所述第二特征数据和所述第二特征数据对应标签数据之间的差值,并对所述差值进行加密,得到加密后的差值。Step a: Calculate the difference between the second characteristic data and the label data corresponding to the second characteristic data, and encrypt the difference to obtain an encrypted difference.
步骤b,根据加密后的差值和加密后的第一特征数据计算得到加密后的残差。In step b, the encrypted residual is calculated according to the encrypted difference and the encrypted first characteristic data.
具体地,第二终端计算第二特征数据和第二特征数据对应标签数据之间的差值,并对计算所得的差值进行加密,得到加密后的差值。可以理解的是,第二特征数据对应的标签数据即为第二训练数据对应的标签数据。在本实施例中,不限制第二终端加密该差值的加密算法。在本实施例中,为了提高模型参数的更新效率,第二终端和第一终端加密数据所用的加密算法相同。在其他实施例中,第一终端和第二终端加密数据所用的加密算法也可以不相同。Specifically, the second terminal calculates the difference between the second characteristic data and the label data corresponding to the second characteristic data, and encrypts the calculated difference to obtain the encrypted difference. It can be understood that the label data corresponding to the second feature data is the label data corresponding to the second training data. In this embodiment, the encryption algorithm for encrypting the difference by the second terminal is not limited. In this embodiment, in order to improve the update efficiency of the model parameters, the encryption algorithm used by the second terminal and the first terminal to encrypt data is the same. In other embodiments, the encryption algorithms used by the first terminal and the second terminal to encrypt data may also be different.
当第二终端得到加密后的差值后,第二终端根据加密后的差值和加密后的第一特征数据计算得到加密后的残差。若将标签数据记为yi,则第二终端计算加密后的残差的计算公式可表示为:After the second terminal obtains the encrypted difference, the second terminal calculates and obtains the encrypted residual according to the encrypted difference and the encrypted first characteristic data. If the label data is denoted as y i , the calculation formula of the encrypted residual by the second terminal can be expressed as:
所述步骤S30包括:The step S30 includes:
步骤c,根据加密后的残差计算得到加密后的第二梯度值,将加密后的第二梯度值发送给第三终端,以供第三终端解密加密后的第二梯度值,并返回解密后的第二梯度值。Step c, calculating the encrypted second gradient value according to the encrypted residual, sending the encrypted second gradient value to the third terminal for the third terminal to decrypt the encrypted second gradient value, and returning the decryption after the second gradient value.
步骤d,接收所述第三终端返回的,解密后的第二梯度值,根据解密后的第二梯度值更新所述第二特征数据对应的第二模型参数。Step d, receiving the decrypted second gradient value returned by the third terminal, and updating the second model parameter corresponding to the second feature data according to the decrypted second gradient value.
当第二终端计算得到加密后的残差后,第二终端根据加密后的残差计算得到加密后的第二梯度值,并将加密后的第二梯度值发送给第三终端。当第三终端接收到加密后的第二梯度值后,第三终端解密加密后的第二梯度值,并发送解密后的第二梯度值给第二终端。当第二终端接收到第三终端发送的,解密后的第二梯度值后,第二终端根据解密后的第二梯度值更新第二特征数据对应的第二模型参数。After the second terminal calculates and obtains the encrypted residual, the second terminal calculates and obtains the encrypted second gradient value according to the encrypted residual, and sends the encrypted second gradient value to the third terminal. After the third terminal receives the encrypted second gradient value, the third terminal decrypts the encrypted second gradient value, and sends the decrypted second gradient value to the second terminal. After the second terminal receives the decrypted second gradient value sent by the third terminal, the second terminal updates the second model parameter corresponding to the second feature data according to the decrypted second gradient value.
进一步地,所述模型参数的更新方法还包括:Further, the method for updating the model parameters also includes:
步骤e,获取所述第二特征数据对应的训练数据,以及获取所述第二特征数据对应的第三特征参数。Step e, acquiring training data corresponding to the second characteristic data, and acquiring third characteristic parameters corresponding to the second characteristic data.
所述根据所述残差计算第二梯度值的步骤包括:The step of calculating the second gradient value according to the residual includes:
步骤f,根据所述训练数据、所述第三特征参数和所述残差计算第二梯度值。Step f: Calculate a second gradient value according to the training data, the third feature parameter and the residual.
当第二终端得到第二特征数据后,第二终端获取第二特征数据对应的训练数据,即获取第二特征数据对应的第二训练数据,以及获取第二特征数据对应的第三特征参数。具体地,第二终端获取梯度系数,并计算梯度系数和第二模型参数之间的乘积,并将梯度系数和第二模型参数之间的乘积记为第三乘积,对第三乘积进行加密,得到加密后的第三乘积,以及计算第二训练数据和加密后的残差之间的乘积,并将第二训练数据和加密后的残差之间的乘积记为第四乘积,然后根据第四乘积和加密后的第三乘积计算得到加密后的第二梯度值。其中,若加密后的第二梯度值表示为梯度系数表示为λ,第三特征参数表示为则第二终端计算得到加密后的第二梯度值的计算公式可表示为:After the second terminal obtains the second feature data, the second terminal obtains the training data corresponding to the second feature data, that is, obtains the second training data corresponding to the second feature data, and obtains the third feature parameter corresponding to the second feature data. Specifically, the second terminal obtains the gradient coefficient, calculates the product between the gradient coefficient and the second model parameter, records the product between the gradient coefficient and the second model parameter as the third product, and encrypts the third product, Obtain the encrypted third product, and calculate the product between the second training data and the encrypted residual, and record the product between the second training data and the encrypted residual as the fourth product, and then according to the first The encrypted second gradient value is obtained by calculating the fourth product and the encrypted third product. Among them, if the encrypted second gradient value is expressed as The gradient coefficient is denoted as λ, and the third characteristic parameter is denoted as Then the calculation formula of the encrypted second gradient value obtained by the second terminal can be expressed as:
进一步地,所述根据所述第二梯度值更新所述第二特征数据对应的第二模型参数的步骤包括:Further, the step of updating the second model parameter corresponding to the second characteristic data according to the second gradient value includes:
步骤g,获取所述第二终端对应的更新系数。Step g, acquiring the update coefficient corresponding to the second terminal.
步骤h,根据所述第二梯度值和所述更新系数更新所述第二特征数据对应的第二模型参数。Step h, updating the second model parameter corresponding to the second feature data according to the second gradient value and the update coefficient.
具体地,需要说明的是,第二终端在更新第二模型参数过程中,第二终端所用的第二梯度值是解密后的第二梯度值。第二终端获取更新第二模型参数对应的更新系数,即获取第二更新系数,并根据解密后的第二梯度值和第二更新系数更新第二特征数据对应的第二模型参数。具体地,第二终端计算第二更新系数和解密后的第二梯度值之间的乘积,然后将第二模型参数减去第二更新系数和解密后的第二梯度值之间的乘积,得到更新后的第二模型参数,以更新第二模型参数。其中,第二更新系数可与第一更新系数相等,也可与第一更新系数不相等。若将第二更新系数记为η2,更新后的第二模型参数记为则第二终端计算更新后的第二模型参数的计算公式可为:Specifically, it should be noted that in the process of updating the second model parameter by the second terminal, the second gradient value used by the second terminal is the decrypted second gradient value. The second terminal obtains and updates the update coefficient corresponding to the second model parameter, that is, obtains the second update coefficient, and updates the second model parameter corresponding to the second feature data according to the decrypted second gradient value and the second update coefficient. Specifically, the second terminal calculates the product between the second update coefficient and the decrypted second gradient value, and then subtracts the product between the second update coefficient and the decrypted second gradient value from the second model parameter to obtain The updated second model parameters to update the second model parameters. The second update coefficient may be equal to the first update coefficient, or may not be equal to the first update coefficient. If the second update coefficient is denoted as η 2 , the updated second model parameter is denoted as Then the calculation formula for calculating the updated second model parameter by the second terminal may be:
本实施例中第二终端通过联合第一终端加密后的数据进行联合训练,更新预测模型中的模型参数,在保证第一终端数据私密性,即在第一终端不泄露自己原始数据的基础上,让第二终端可以整合自己的数据和第一终端加密后的数据进行联合训练,更新模型参数,即更新对应的预测模型,从而实现了整合两个不同终端的数据进行模型训练,以提高训练所得模型的性能。In this embodiment, the second terminal performs joint training by combining the encrypted data of the first terminal to update the model parameters in the prediction model, so as to ensure the privacy of the data of the first terminal, that is, on the basis that the first terminal does not disclose its own original data , so that the second terminal can integrate its own data and the encrypted data of the first terminal for joint training, update the model parameters, that is, update the corresponding prediction model, so as to realize the integration of the data of two different terminals for model training to improve training. The performance of the resulting model.
进一步地,提出本发明模型参数的更新方法第二实施例。所述模型参数的更新方法第二实施例与所述模型参数的更新方法第一实施例的区别在于,参照图2,所述模型参数的更新方法还包括:Further, a second embodiment of the method for updating model parameters of the present invention is proposed. The difference between the second embodiment of the method for updating the model parameters and the first embodiment of the method for updating the model parameters is that, referring to FIG. 2 , the method for updating the model parameters further includes:
步骤S40,获取所述第一特征数据对应的加密后的第一特征参数,以及获取所述第二特征数据对应的第二特征参数,其中,所述第一特征数据和所述第二特征数据对应的设备标识相同。Step S40, obtaining the encrypted first feature parameter corresponding to the first feature data, and obtaining the second feature parameter corresponding to the second feature data, wherein the first feature data and the second feature data The corresponding device IDs are the same.
第二终端获取第一特征数据对应的加密后的第一特征参数,以及获取第二特征数据对应的第二特征参数,其中,加密后的第一特征参数可以第一终端发送第二特征数据给第二终端时,一起发送给第二终端的。第一终端发送加密后的第一特征参数给第二终端的方式可与发送加密后的第一特征数据相同,也可以不相同。需要说明的是,第一特征数据和第二特征数据对应的设备标识相同,即本实施例中的第一训练数据和第二训练数据的设备标识相同。设备标识可唯一表示某一终端,通过设备标识可识别各个不同的终端。在本实施例中,设备标识可用终端的包名或者其他信息表示,也可用该终端对应用户的身份证号码或者电话号码等表示。The second terminal obtains the encrypted first feature parameter corresponding to the first feature data, and obtains the second feature parameter corresponding to the second feature data, wherein the encrypted first feature parameter can be sent by the first terminal to the second feature data to When the second terminal is used, it is sent to the second terminal together. The manner in which the first terminal sends the encrypted first characteristic parameter to the second terminal may be the same as or different from that of sending the encrypted first characteristic data. It should be noted that the device identifiers corresponding to the first feature data and the second feature data are the same, that is, the device identifiers of the first training data and the second training data in this embodiment are the same. The device identifier can uniquely represent a certain terminal, and different terminals can be identified through the device identifier. In this embodiment, the device identification can be represented by the package name or other information of the terminal, or by the ID card number or phone number of the user corresponding to the terminal.
具体地,第一终端在需要将加密后的第一特征参数发送给第二终端时,第一终端获取第一特征数据,然后计算第一特征数据的平方,以及获取第一模型参数和梯度系数,根据第一模型参数和梯度系数计算得到待计算特征参数,根据待计算特征参数和第一特征数据的平方得到第一特征参数。若将第一训练数据中设备标识和第二训练数据中设备标识的交集,将该交集记为D,则第一终端加密后的第一特征参数可表示为:Specifically, when the first terminal needs to send the encrypted first characteristic parameter to the second terminal, the first terminal obtains the first characteristic data, then calculates the square of the first characteristic data, and obtains the first model parameter and gradient coefficient , the characteristic parameter to be calculated is obtained by calculating according to the first model parameter and the gradient coefficient, and the first characteristic parameter is obtained according to the square of the characteristic parameter to be calculated and the first characteristic data. If the intersection of the device identification in the first training data and the device identification in the second training data is denoted as D, the first characteristic parameter encrypted by the first terminal can be expressed as:
进一步地,第一终端可通过加密后的第一特征数据和加密后的第一特征数据的平方计算得到加密后的第一特征参数。若将加密后的第一特征数据的平方记为则第一终端可通过加密后的第一特征数据和加密后的第一特征数梯度系数据的平方计算得到加密后的第一特征参数的过程可表示为:Further, the first terminal may obtain the encrypted first characteristic parameter by calculating the square of the encrypted first characteristic data and the encrypted first characteristic data. If the square of the encrypted first feature data is recorded as Then, the process that the first terminal can obtain the encrypted first characteristic parameter through the square calculation of the encrypted first characteristic data and the encrypted first characteristic number gradient coefficient data can be expressed as:
第二终端在获取第二特征参数时,第二终端获取梯度系数和第二模型参数,根据和第二模型参数计算得到第二特征参数,具体地,加密后的第二特征参数可表示为需要说明的是,本实施例是通过第二特征参数计算损失值,而损失值是要发送给第三终端的,因此为了保护第二终端数据的安全性,需要对计算损失值的数据进行加密。在本发明实施例中,为了便于计算,第一终端加密数据的加密算法和第二终端加密数据的加密算法相同,在其它实施例中,第一终端加密数据的加密算法和第二终端加密数据的加密算法也可以不相同。When the second terminal acquires the second characteristic parameter, the second terminal acquires the gradient coefficient and the second model parameter, and obtains the second characteristic parameter according to the calculation with the second model parameter. Specifically, the encrypted second characteristic parameter can be expressed as It should be noted that, in this embodiment, the loss value is calculated by the second characteristic parameter, and the loss value is to be sent to the third terminal. Therefore, in order to protect the security of the data of the second terminal, it is necessary to encrypt the data for calculating the loss value. . In this embodiment of the present invention, in order to facilitate calculation, the encryption algorithm of the encrypted data of the first terminal is the same as the encryption algorithm of the encrypted data of the second terminal. In other embodiments, the encryption algorithm of the encrypted data of the first terminal and the encrypted data of the second terminal are the same. The encryption algorithm can also be different.
步骤S50,根据所述第一特征数据、所述第二特征数据、所述标签数据、所述第一特征参数和所述第二特征参数计算得到损失值。Step S50, calculating a loss value according to the first feature data, the second feature data, the label data, the first feature parameter and the second feature parameter.
当第二终端得到第一特征参数和第二特征参数后,第二终端根据第一特征数据、第二特征数据、标签数据、第一特征参数和第二特征参数计算得到损失值。需要说明的是,由于计算损失值的各个数据都是加密后的,因此计算所得的损失值也是加密后的。After the second terminal obtains the first characteristic parameter and the second characteristic parameter, the second terminal calculates the loss value according to the first characteristic data, the second characteristic data, the label data, the first characteristic parameter and the second characteristic parameter. It should be noted that, since each data for calculating the loss value is encrypted, the calculated loss value is also encrypted.
具体地,若加密后的损失值记为[[L]],则第二终端计算损失值的损失函数可表示为:Specifically, if the encrypted loss value is denoted as [[L]], the loss function for calculating the loss value by the second terminal can be expressed as:
具体地,损失函数的推导过程如下:Specifically, the derivation process of the loss function is as follows:
由于因此:because therefore:
步骤S60,将所述损失值发送给第三终端,以供所述第三终端根据所述损失值判断所述第一模型参数和所述第二模型参数是否满足停止更新条件,并返回提示信息。Step S60, sending the loss value to the third terminal, so that the third terminal can judge whether the first model parameter and the second model parameter meet the stop updating condition according to the loss value, and return a prompt message .
当第二终端计算得到加密后的损失值后,第二终端将加密后的损失值发送给第三终端。需要说明的是,第二终端可在将残差发送给第一终端的同时,将损失值发送给第三终端,也可不在发送残差给第一终端之后,再发送损失值给第三终端,或者在发送残差给第一终端之前,发送损失值给第三终端。当第三终端接收到加密后的损失值后,第三终端解密加密后的损失值,得到解密后的损失值,并根据解密后的损失值判断第一模型参数和第二模型参数是否满足停止更新条件。其中,停止更新条件可根据具体需要而设置,如可设置为当解密后的损失值小于预设损失值时,确定第一模型参数和第二模型参数满足停止更新条件;当解密后的损失值大于或者等于预设损失值时,确定第一模型参数和第二模型参数未满足停止更新条,其中,预设损失值的大小可根据具体需要而设置。After the second terminal calculates and obtains the encrypted loss value, the second terminal sends the encrypted loss value to the third terminal. It should be noted that the second terminal may send the loss value to the third terminal while sending the residual to the first terminal, or may not send the loss value to the third terminal after sending the residual to the first terminal , or send the loss value to the third terminal before sending the residual to the first terminal. After the third terminal receives the encrypted loss value, the third terminal decrypts the encrypted loss value, obtains the decrypted loss value, and judges whether the first model parameter and the second model parameter satisfy the threshold according to the decrypted loss value. Update conditions. Wherein, the stop update condition can be set according to specific needs. For example, it can be set to determine that the first model parameter and the second model parameter meet the stop update condition when the decrypted loss value is less than the preset loss value; when the decrypted loss value When it is greater than or equal to the preset loss value, it is determined that the first model parameter and the second model parameter do not satisfy the stop updating bar, wherein the size of the preset loss value can be set according to specific needs.
当第三终端确定第一模型参数和第二模型参数是否满足停止更新条件后,生成提示信息,并将提示信息发送给第二终端,也可同时将提示信息发送给第一终端。其中,提示信息中携带有关键字,通过该关键字即可确定第一模型参数和第二模型参数是否满足停止更新条件。如当提示信息中的关键字为“true”时,表明第一模型参数和第二模型参数满足停止更新条件;当提示信息中的关键字为“false”时,表明第一模型参数和第二模型参数未满足停止更新条件。需要说明的是,本实施例中关键字的举例只是为了便于理解,并不构成对关键字的限制,如关键字可设置为“0”和“1”等。After the third terminal determines whether the first model parameter and the second model parameter satisfy the condition for stopping updating, it generates prompt information, and sends the prompt information to the second terminal, and may also send the prompt information to the first terminal at the same time. Wherein, the prompt information carries a keyword, through which it can be determined whether the first model parameter and the second model parameter satisfy the stop updating condition. For example, when the keyword in the prompt information is "true", it indicates that the first model parameter and the second model parameter meet the conditions for stopping updating; when the keyword in the prompt information is "false", it indicates that the first model parameter and the second model parameter Model parameters do not meet the stop update condition. It should be noted that the examples of keywords in this embodiment are only for the convenience of understanding, and do not constitute a limitation on keywords. For example, keywords can be set to "0" and "1".
进一步地,步骤S60包括:Further, step S60 includes:
步骤g,将所述损失值发送给第三终端,以供所述第三终端在接收到所述损失值后,获取上一次更新所述第一模型参数和所述第二模型参数时的损失历史值,并在检测到所述损失值和所述损失历史值之间差值的绝对值小于预设阈值时,确定所述第一模型参数和所述第二模型参数满足停止更新条件,在检测到所述绝对值大于或者等于所述预设阈值时,确定所述第一模型参数和所述第二模型参数未满足所述停止更新条件。Step g, sending the loss value to the third terminal, so that the third terminal can obtain the loss when the first model parameter and the second model parameter were updated last time after receiving the loss value history value, and when it is detected that the absolute value of the difference between the loss value and the loss history value is less than a preset threshold, it is determined that the first model parameter and the second model parameter meet the stop updating condition, and When it is detected that the absolute value is greater than or equal to the preset threshold, it is determined that the first model parameter and the second model parameter do not satisfy the update stop condition.
进一步地,当第二终端将加密后的损失值发送给第三终端,第三终端接收的加密后的损失值,并解密得到解密后的损失值后,第三终端获取上一次更新第一模型参数和第二模型参数时的损失历史值。需要说明的是,在每一次更新模型参数时,都会生成一个损失值,即在每一次更新模型参数时,第三终端都会接收到第二终端发送的损失值,并存储该损失值。当第三终端获取到历史损失值后,第三终端计算当前所接收的损失值和损失历史值之间差值,并计算该差值的绝对值,检测该差值的绝对值是否小于预设阈值。若第三终端检测到该差值的绝对值小于预设阈值,第三终端则确定第一模型参数和第二模型参数满足停止更新条件;若第三终端检测到该差值的绝对值大于或者等于预设阈值,第三终端则确定第一模型参数和第二模型参数未满足停止更新条件。其中,预设阈值的大小可根据具体需要而设置,如可设置为0.00001。Further, when the second terminal sends the encrypted loss value to the third terminal, the third terminal receives the encrypted loss value and decrypts to obtain the decrypted loss value, the third terminal obtains the last updated first model. The loss history value when the parameter and the second model parameter. It should be noted that each time the model parameters are updated, a loss value will be generated, that is, each time the model parameters are updated, the third terminal will receive the loss value sent by the second terminal, and store the loss value. After the third terminal obtains the historical loss value, the third terminal calculates the difference between the currently received loss value and the historical loss value, calculates the absolute value of the difference, and detects whether the absolute value of the difference is smaller than the preset value threshold. If the third terminal detects that the absolute value of the difference is less than the preset threshold, the third terminal determines that the first model parameter and the second model parameter meet the conditions for stopping the update; if the third terminal detects that the absolute value of the difference is greater than or equal to the preset threshold, the third terminal determines that the first model parameter and the second model parameter do not meet the condition for stopping updating. The size of the preset threshold can be set according to specific needs, for example, it can be set to 0.00001.
步骤S70,若根据所述提示信息确定所述第一模型参数和所述第二模型参数未满足所述停止更新条件,则返回执行所述第二终端接收第一终端发送的加密后的第一特征数据,以及获取第二特征数据和所述标签数据的步骤。Step S70, if it is determined according to the prompt information that the first model parameter and the second model parameter do not meet the stop updating condition, then return to executing the encrypted first data sent by the second terminal and sent by the first terminal. feature data, and the steps of acquiring the second feature data and the label data.
当第二终端接收到提示信息,且根据提示信息确定第一模型参数和第二模型参数未满足停止更新条件后,第二终端再次接收第一终端发送的加密后的第一特征数据,以及获取第二特征数据和标签数据,即继续进行模型参数的更新操作。进一步地,当第二终端接收到提示信息,且根据提示信息确定第一模型参数和第二模型参数满足停止更新条件后,不再进行模型参数的更新操作,即不再进行迭代,第二终端将更新后的第二模型参数输入第二预测模型中,得到训练好的第二预测模型。当第一终端根据所接收的提示信息确定第一模型参数和第二模型参数满足停止更新条件后,第一终端将更新后的第一模型参数输入第一预测模型中,得到训练好的第一预测模型。可以理解的是,当第一模型参数和第二模型参数满足停止更新条件时,表明模型参数的更新满足收敛条件。When the second terminal receives the prompt information and determines according to the prompt information that the first model parameter and the second model parameter do not meet the conditions for stopping updating, the second terminal receives the encrypted first feature data sent by the first terminal again, and obtains the The second feature data and label data, that is, continue to update the model parameters. Further, when the second terminal receives the prompt information, and determines according to the prompt information that the first model parameter and the second model parameter meet the conditions for stopping the update, the update operation of the model parameters is no longer performed, that is, the iteration is no longer performed, and the second terminal The updated second model parameters are input into the second prediction model to obtain a trained second prediction model. After the first terminal determines according to the received prompt information that the first model parameter and the second model parameter satisfy the condition for stopping the update, the first terminal inputs the updated first model parameter into the first prediction model, and obtains the trained first model parameter. prediction model. It can be understood that, when the first model parameter and the second model parameter satisfy the update stop condition, it indicates that the update of the model parameter satisfies the convergence condition.
本实施例通过损失值来确定是否结束第一模型参数和第二模型参数的更新操作,并在确定不结束第一模型参数和第二模型参数的更新操作,即确定第一模型参数和第二模型参数未满足停止更新条件时,继续执行第一模型参数和第二模型参数的更新操作,从而提高了根据更新后的模型参数得到预测模型的模型性能,提高了预测模型对数据预测的准确率。In this embodiment, the loss value is used to determine whether to end the update operation of the first model parameter and the second model parameter, and when it is determined not to end the update operation of the first model parameter and the second model parameter, that is, the first model parameter and the second model parameter are determined. When the model parameters do not meet the conditions for stopping the update, continue to perform the update operation of the first model parameters and the second model parameters, thereby improving the model performance of the prediction model obtained according to the updated model parameters, and improving the accuracy of the prediction model for data prediction. .
具体地,参照图3,模型参数的更新方法的整个过程为:步骤一:先初始化权重参数,即初始化第一模型参数和第二模型参数,在本实施例中,用户可根据需要选择如何初始化第一模型参数和第二模型参数,如可以将所有的第一模型参数初始化为同一个数值,也可以将各个第一模型参数初始化成不同数值;步骤二,在对第一模型参数和第二模型参数初始化后,进行设备ID查重,即选择存在相同设备标识的第一训练数据和第二训练数据;步骤三,挑选部分手机端设备的训练数据进行训练,手机端设备的集合即为第一终端(PartA),A1,Ai,Ak等表示不同的手机端设备;步骤四和步骤五是在第一终端(进行的计算过程;步骤六是第二终端(Part B)计算加密损失函数和加密残差的过程,即计算损失值和残差的过程;步骤七和步骤八是第一终端在接收到加密后的残差后的运算过程,在步骤八中,第一终端和第二终端都会计算加密梯度,即计算第一梯度值和第二梯度值;在步骤九中,第三终端(第三方C)会根据第一终端和第二终端发送的梯度值得到解密后的梯度值,并对应返回;在步骤十中,第一终端和第二终端会根据第三终端返回的梯度值,对应更新各自的模型参数;在步骤十一中,第三终端会解密损失函数来判断是否迭代结束,即根据损失值来判断迭代是否结束,其中,迭代结束即表明第一模型参数和第二模型参数满足停止更新条件,迭代未结束即表明第一模型参数和第二模型参数未满足停止更新条件,若迭代结束,则完成模型参数的更新操作,若迭代未结束,返回步骤三,继续进行模型参数的更新操作。Specifically, referring to FIG. 3 , the entire process of the method for updating model parameters is as follows: Step 1: Initialize the weight parameters first, that is, initialize the first model parameter and the second model parameter. In this embodiment, the user can choose how to initialize as needed. For the first model parameters and the second model parameters, for example, all the first model parameters can be initialized to the same value, or each first model parameter can be initialized to different values; step 2, in the first model parameter and the second model parameter. After the model parameters are initialized, the device ID is checked for duplicates, that is, the first training data and the second training data with the same device ID are selected; in step 3, the training data of some mobile devices are selected for training, and the set of mobile devices is the first training data. A terminal (PartA), A 1 , A i , A k , etc. represent different mobile terminal devices; Steps 4 and 5 are the calculation process performed on the first terminal (Part B); Step 6 is the calculation and encryption of the second terminal (Part B) The process of loss function and encrypted residual, that is, the process of calculating loss value and residual; Steps 7 and 8 are the operation process of the first terminal after receiving the encrypted residual. In step 8, the first terminal and The second terminal will calculate the encrypted gradient, that is, calculate the first gradient value and the second gradient value; in step 9, the third terminal (third party C) will obtain the decrypted gradient value according to the gradient values sent by the first terminal and the second terminal. gradient value, and return it accordingly; in step ten, the first terminal and the second terminal will update their respective model parameters according to the gradient value returned by the third terminal; in step eleven, the third terminal will decrypt the loss function to Judging whether the iteration is over, that is, according to the loss value to determine whether the iteration is over, where the end of the iteration means that the first model parameter and the second model parameter meet the stop update condition, and the iteration is not over, it means that the first model parameter and the second model parameter are not If the update stop condition is satisfied, if the iteration ends, the update operation of the model parameters is completed; if the iteration is not ended, return to step 3 to continue the update operation of the model parameters.
需要说明的是,本实施例是对现有联邦学习方案的扩展,联邦学习是一种在保护用户数据隐私的前提下,进行协同建模的技术,它确保数据在不出本地的前提下,仍然能够有效对数据进行建模。按对数据和特征的划分,一般可以分为横向联邦和纵向联邦,横向联邦要求每一个客户端具有相同的特征,且同时具有标签数据,纵向联邦要解决的问题是只有一方有标签数据,其余各方只有特征的情况。It should be noted that this embodiment is an extension of the existing federated learning scheme. Federated learning is a technology for collaborative modeling under the premise of protecting the privacy of user data. Still able to model the data effectively. According to the division of data and features, it can generally be divided into horizontal federation and vertical federation. Horizontal federation requires that each client has the same characteristics and has label data at the same time. The problem to be solved by vertical federation is that only one side has label data, and the rest have label data. The parties have only characteristic situations.
进一步地,提出本发明模型参数的更新方法第三实施例。Further, a third embodiment of the method for updating model parameters of the present invention is proposed.
所述模型参数的更新方法第三实施例与所述模型参数的更新方法第一和/或第二实施例的区别在于,所述模型参数的更新方法还包括:The difference between the third embodiment of the method for updating the model parameters and the first and/or second embodiments for the method for updating the model parameters is that the method for updating the model parameters further includes:
步骤h,将更新后的第二模型参数作为所述第二终端中的贷款预测模型的模型参数,得到贷款预测模型。Step h, using the updated second model parameters as the model parameters of the loan prediction model in the second terminal to obtain the loan prediction model.
步骤i,在接收到待预测数据后,将所述待预测数据输入所述贷款预测模型中,得到所述待预测数据对应的贷款概率,并根据所述贷款概率进行信息推送。Step i, after receiving the data to be predicted, input the data to be predicted into the loan prediction model, obtain the loan probability corresponding to the data to be predicted, and push the information according to the loan probability.
当第二终端得到更新后的第二模型参数后,第二终端将更新后的第二模型参数作为贷款预测模型的模型参数。可以理解的是,此时第二终端中的第二预测模型为贷款预测模型,用户也可以根据需要将第二预测模型设置为文字识别模型或者图片识别模型等。需要说明的是,模型种类的不同,前面所采用的训练数据也就不同,如贷款预测模型对应的训练数据为用户贷款时所产生的数据,图片识别模型对应的训练数据为图片相关数据。After the second terminal obtains the updated second model parameters, the second terminal uses the updated second model parameters as the model parameters of the loan prediction model. It can be understood that, at this time, the second prediction model in the second terminal is a loan prediction model, and the user can also set the second prediction model as a text recognition model or a picture recognition model as required. It should be noted that the training data used above is different depending on the type of model. For example, the training data corresponding to the loan prediction model is the data generated when the user takes a loan, and the training data corresponding to the image recognition model is the picture-related data.
当第二终端得到贷款预测模型后,第二终端将待预测数据输入贷款预测模型中,得到待预测数据对应的贷款概率,可以理解的是,贷款概率是贷款预测模型的输出结果。第二终端可根据贷款概率进行贷款相关信息的推送。After the second terminal obtains the loan prediction model, the second terminal inputs the data to be predicted into the loan prediction model, and obtains the loan probability corresponding to the data to be predicted. It can be understood that the loan probability is the output result of the loan prediction model. The second terminal may push loan-related information according to the loan probability.
本实施例通过将更新后的第二模型参数作为第二终端中贷款预测模型的模型参数,得到贷款预测模型,然后根据贷款预测模型所得的结果贷款概率进行信息推送,以提高贷款相关信息的推送的准确率。In this embodiment, a loan prediction model is obtained by using the updated second model parameters as the model parameters of the loan prediction model in the second terminal, and then the loan probability information is pushed according to the result obtained by the loan prediction model, so as to improve the pushing of loan-related information 's accuracy.
此外,本发明还提供一种模型参数的更新装置,参照图4,所述模型参数的更新装置包括:In addition, the present invention also provides a device for updating model parameters. Referring to FIG. 4 , the device for updating model parameters includes:
接收模块10,用于接收第一终端发送的加密后的第一特征数据,其中,所述第一特征数据是由所述第一终端与至少一个相同类型终端通过横向联邦学习得到的,所述第一终端与所述第二终端是不同类型的终端;The receiving
获取模块20,用于获取第二特征数据和所述第二特征数据对应的标签数据;an
计算模块30,用于根据所述第一特征数据、所述第二特征数据和所述标签数据计算得到残差;a
发送模块40,用于将所述残差发送给所述第一终端,以供所述第一终端根据所述残差计算第一梯度值,并根据所述第一梯度值更新所述第一特征数据对应的第一模型参数;A sending
所述计算模块30还用于根据所述残差计算第二梯度值;The
更新模块50,用于根据所述第二梯度值更新所述第二特征数据对应的第二模型参数。The updating
进一步地,所述获取模块20还用于获取所述第一特征数据对应的加密后的第一特征参数,以及获取所述第二特征数据对应的第二特征参数,其中,所述第一特征数据和所述第二特征数据对应的设备标识相同;Further, the obtaining
所述计算模块30还用于根据所述第一特征数据、所述第二特征数据、所述标签数据、所述第一特征参数和所述第二特征参数计算得到损失值;The
所述发送模块40还用于将所述损失值发送给第三终端,以供所述第三终端根据所述损失值判断所述第一模型参数和所述第二模型参数是否满足停止更新条件,并返回提示信息;The sending
所述模型参数的更新装置还包括:The device for updating the model parameters also includes:
执行模块,用于若根据所述提示信息确定所述第一模型参数和所述第二模型参数未满足所述停止更新条件,则返回执行所述第二终端接收第一终端发送的加密后的第一特征数据,以及获取第二特征数据和所述标签数据的步骤。The execution module is configured to return to execute the encrypted data sent by the second terminal to receive the encrypted data sent by the first terminal if it is determined according to the prompt information that the first model parameter and the second model parameter do not meet the stop updating condition. first feature data, and the step of acquiring the second feature data and the label data.
进一步地,所述发送模块40还用于将所述损失值发送给第三终端,以供所述第三终端在接收到所述损失值后,获取上一次更新所述第一模型参数和所述第二模型参数时的损失历史值,并在检测到所述损失值和所述损失历史值之间差值的绝对值小于预设阈值时,确定所述第一模型参数和所述第二模型参数满足停止更新条件,在检测到所述绝对值大于或者等于所述预设阈值时,确定所述第一模型参数和所述第二模型参数未满足所述停止更新条件。Further, the sending
进一步地,所述获取模块20还用于获取所述第二特征数据对应的训练数据,以及获取所述第二特征数据对应的第三特征参数;Further, the obtaining
所述计算模块30还用于根据所述训练数据、所述第三特征参数和所述残差计算第二梯度值。The
进一步地,所述更新模块50包括:Further, the
获取单元,用于获取所述第二终端对应的更新系数;an obtaining unit, configured to obtain an update coefficient corresponding to the second terminal;
更新单元,用于根据所述第二梯度值和所述更新系数更新所述第二特征数据对应的第二模型参数。An update unit, configured to update the second model parameter corresponding to the second feature data according to the second gradient value and the update coefficient.
进一步地,所述计算模块30包括:Further, the
计算单元,用于计算所述第二特征数据和所述第二特征数据标签数据之间的差值;a calculation unit for calculating the difference between the second characteristic data and the label data of the second characteristic data;
加密单元,用于所述差值进行加密,得到加密后的差值;an encryption unit for encrypting the difference to obtain an encrypted difference;
所述计算单元还用于根据加密后的差值和加密后的第一特征数据计算得到加密后的残差;根据加密后的残差计算得到加密后的第二梯度值;The computing unit is also used to calculate and obtain the encrypted residual according to the encrypted difference and the encrypted first characteristic data; and calculate and obtain the encrypted second gradient value according to the encrypted residual;
发送单元,用于将加密后的第二梯度值发送给第三终端,以供第三终端解密加密后的第二梯度值,并返回解密后的第二梯度值;a sending unit, configured to send the encrypted second gradient value to the third terminal, so that the third terminal can decrypt the encrypted second gradient value, and return the decrypted second gradient value;
所述更新模块50还用于接收所述第三终端返回的,解密后的第二梯度值,根据解密后的第二梯度值更新所述第二特征数据对应的第二模型参数。The updating
进一步地,所述模型参数的更新装置还包括:Further, the device for updating the model parameters also includes:
处理模块,用于将更新后的第二模型参数作为所述第二终端中的贷款预测模型的模型参数,得到贷款预测模型;a processing module, configured to use the updated second model parameter as the model parameter of the loan prediction model in the second terminal to obtain the loan prediction model;
输入模块,用于在接收到待预测数据后,将所述待预测数据输入所述贷款预测模型中,得到所述待预测数据对应的贷款概率,并根据所述贷款概率进行信息推送。The input module is configured to input the data to be predicted into the loan prediction model after receiving the data to be predicted, obtain the loan probability corresponding to the data to be predicted, and push the information according to the loan probability.
本发明模型参数的更新装置具体实施方式与上述模型参数的更新方法各实施例基本相同,在此不再赘述。The specific implementation manner of the apparatus for updating model parameters of the present invention is basically the same as that of the above-mentioned methods for updating model parameters, and details are not described herein again.
此外,本发明还提供一种模型参数的更新设备。如图5所示,图5是本发明实施例方案涉及的硬件运行环境的结构示意图。In addition, the present invention also provides a device for updating model parameters. As shown in FIG. 5 , FIG. 5 is a schematic structural diagram of a hardware operating environment involved in an embodiment of the present invention.
需要说明的是,图5即可为模型参数的更新设备的硬件运行环境的结构示意图。本发明实施例模型参数的更新设备可以是PC,便携计算机等终端设备。It should be noted that FIG. 5 can be a schematic structural diagram of the hardware operating environment of the device for updating model parameters. The device for updating the model parameters in the embodiment of the present invention may be a terminal device such as a PC and a portable computer.
如图5所示,该模型参数的更新设备可以包括:处理器1001,例如CPU,存储器1005,用户接口1003,网络接口1004,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。As shown in FIG. 5 , the device for updating model parameters may include: a
本领域技术人员可以理解,图5中示出的模型参数的更新设备结构并不构成对模型参数的更新设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the structure of the updating device for model parameters shown in FIG. 5 does not constitute a limitation on the updating device for model parameters, and may include more or less components than those shown in the figure, or combine some components, Or a different component arrangement.
如图5所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及模型参数的更新程序。其中,操作系统是管理和控制模型参数的更新设备硬件和软件资源的程序,支持模型参数的更新程序以及其它软件或程序的运行。As shown in FIG. 5 , the
在图5所示的模型参数的更新设备中,用户接口1003主要用于连接第一终端和第三终端,分别与第一终端和第三终端进行数据通信;网络接口1004主要用于后台服务器,与后台服务器进行数据通信;处理器1001可以用于调用存储器1005中存储的模型参数的更新程序,并执行如上所述的模型参数的更新方法的步骤。In the model parameter updating device shown in FIG. 5 , the
本发明模型参数的更新设备具体实施方式与上述模型参数的更新方法各实施例基本相同,在此不再赘述。The specific implementation manner of the device for updating model parameters of the present invention is basically the same as that of the above-mentioned methods for updating model parameters, and details are not described herein again.
此外,本发明实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有模型参数的更新程序,所述模型参数的更新程序被处理器执行时实现如上所述的模型参数的更新方法的步骤。In addition, an embodiment of the present invention also provides a computer-readable storage medium, where an update program for model parameters is stored on the computer-readable storage medium, and the model parameter update program is executed by a processor to implement the above-mentioned model The steps of the parameter's update method.
本发明计算机可读存储介质具体实施方式与上述模型参数的更新方法各实施例基本相同,在此不再赘述。The specific implementation manner of the computer-readable storage medium of the present invention is basically the same as the above-mentioned embodiments of the method for updating model parameters, and details are not described herein again.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages or disadvantages of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on this understanding, the technical solutions of the present invention can be embodied in the form of software products in essence or the parts that make contributions to the prior art, and the computer software products are stored in a storage medium (such as ROM/RAM, magnetic disk, CD-ROM), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of the present invention.
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above are only preferred embodiments of the present invention, and are not intended to limit the scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the description and drawings of the present invention, or directly or indirectly applied in other related technical fields , are similarly included in the scope of patent protection of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010142907.7A CN111368196A (en) | 2020-03-03 | 2020-03-03 | Method, apparatus, device and readable storage medium for updating model parameters |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010142907.7A CN111368196A (en) | 2020-03-03 | 2020-03-03 | Method, apparatus, device and readable storage medium for updating model parameters |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111368196A true CN111368196A (en) | 2020-07-03 |
Family
ID=71208508
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010142907.7A Pending CN111368196A (en) | 2020-03-03 | 2020-03-03 | Method, apparatus, device and readable storage medium for updating model parameters |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111368196A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111839495A (en) * | 2020-07-30 | 2020-10-30 | 深圳前海微众银行股份有限公司 | Detection method, equipment and storage medium |
CN111931216A (en) * | 2020-09-16 | 2020-11-13 | 支付宝(杭州)信息技术有限公司 | Method and system for obtaining joint training model based on privacy protection |
CN112818374A (en) * | 2021-03-02 | 2021-05-18 | 深圳前海微众银行股份有限公司 | Joint training method, device, storage medium and program product of model |
CN113190871A (en) * | 2021-05-28 | 2021-07-30 | 脸萌有限公司 | Data protection method and device, readable medium and electronic equipment |
-
2020
- 2020-03-03 CN CN202010142907.7A patent/CN111368196A/en active Pending
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111839495A (en) * | 2020-07-30 | 2020-10-30 | 深圳前海微众银行股份有限公司 | Detection method, equipment and storage medium |
CN111839495B (en) * | 2020-07-30 | 2023-04-07 | 深圳前海微众银行股份有限公司 | Detection method, device and storage medium |
CN111931216A (en) * | 2020-09-16 | 2020-11-13 | 支付宝(杭州)信息技术有限公司 | Method and system for obtaining joint training model based on privacy protection |
CN112818374A (en) * | 2021-03-02 | 2021-05-18 | 深圳前海微众银行股份有限公司 | Joint training method, device, storage medium and program product of model |
CN113190871A (en) * | 2021-05-28 | 2021-07-30 | 脸萌有限公司 | Data protection method and device, readable medium and electronic equipment |
CN113190871B (en) * | 2021-05-28 | 2023-10-31 | 脸萌有限公司 | Data protection method and device, readable medium and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020177392A1 (en) | Federated learning-based model parameter training method, apparatus and device, and medium | |
US20210232974A1 (en) | Federated-learning based method of acquiring model parameters, system and readable storage medium | |
CN111368196A (en) | Method, apparatus, device and readable storage medium for updating model parameters | |
CN110851786B (en) | Inter-enterprise data interaction method, device, equipment and storage medium based on longitudinal federal learning | |
CN111368901A (en) | Multi-party joint modeling method, equipment and medium based on federated learning | |
US8271424B2 (en) | Privacy and confidentiality preserving reporting of URLs | |
WO2021092977A1 (en) | Vertical federated learning optimization method, appartus, device and storage medium | |
CN107370730A (en) | A kind of log-on message processing method and equipment | |
CN110807528B (en) | Feature correlation calculation method, device and computer readable storage medium | |
CN111340247A (en) | Longitudinal federated learning system optimization method, device and readable storage medium | |
US11363006B2 (en) | Generating bridge match identifiers for linking identifiers from server logs | |
CN105491058B (en) | API access distributed authorization method and system | |
CN111401277A (en) | Face recognition model updating method, device, equipment and medium | |
CN110083459A (en) | The data in cross-page face bury point methods, device, equipment and storage medium | |
WO2021017424A1 (en) | Data preprocessing method and apparatus, ciphertext data obtaining method and apparatus, and electronic device | |
WO2019019393A1 (en) | Business interface calling method, business interface calling device, user terminal and readable storage medium | |
CN114996664B (en) | Digital copyright protection method based on block chain | |
CN114547078A (en) | Federal cross-feature query method, device, medium and equipment based on privacy computation | |
CN111343265B (en) | Information push method, device, device and readable storage medium | |
CN111368314A (en) | Modeling and predicting method, device, equipment and storage medium based on cross features | |
CN111291084A (en) | Sample ID alignment method, device, equipment and storage medium | |
CN112015494B (en) | Third party API tool calling method, system and device | |
CN118786645A (en) | Systems and methods for using cryptography-based storage applications in computer networks to facilitate secure blockchain operations in decentralized applications | |
CN114398678A (en) | Registration verification method and device for preventing electronic file from being tampered, electronic equipment and medium | |
CN112836767A (en) | Federal modeling method, apparatus, apparatus, storage medium and program product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |