Decision tree construction method, device and electronic device based on federated learning system
By compressing and encrypting the training sample data of decision trees in vertical federated learning, the amount of data transmission and processing is reduced, the problem of low efficiency in decision tree construction in vertical federated learning is solved, and the efficiency of decision tree construction is improved.
Patent Information
- Application Number
- CN202110875333.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-30
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2041-07-30
AI Technical Summary
In vertical federated learning, the amount of data transmission and processing during the decision tree construction process is large, resulting in high transmission overhead and affecting efficiency.
By compressing the reference data of the training samples, determining the compression control parameters such as the maximum number of integer digits, fixed-point precision of floating point numbers, and number of samples, data compression and encryption are performed to reduce the amount of intermediate transmission data, and between the participating devices. Perform split point construction and decompression processing to determine the global split point of the decision tree.
It effectively reduces the amount of data transmission and processing during the decision tree construction process, reduces the transmission overhead, and improves the efficiency of decision tree construction.
Smart Images

Figure CN113408668B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to artificial intelligence technology, and in particular to a decision tree construction method, device, electronic device, storage medium and computer program product based on a federated learning system. Background Art
[0002] In the field of federated learning of artificial intelligence, a model is trained jointly by data providers and data users, and then each data user makes corresponding predictions based on their own model. Under the general trend of gradually strengthening data privacy protection in various industries, federated learning, a technology that can establish machine learning by coordinating multi-party data while protecting data privacy, has become one of the keys to cooperation between enterprises / industries. Today, the federated ladder tree model: gradient boosting tree, random forest, classification decision tree, has been widely used in vertical federation scenarios and has become one of the commonly used and powerful algorithms in the fields of finance and risk control. In this field, classification tasks are used most frequently.
[0003] However, in the vertical tree model, the guest (i.e., the active party with labels) needs to encrypt and transmit the gradient or label statistics, and the host (i.e., the participant without labels) needs to receive the homomorphically encrypted ciphertext, perform calculations, and then return the split point, which contains the encrypted construction result. The guest needs to further calculate the optimal split point based on this construction result. In real scenarios, the time consumption of the guest's homomorphic encryption of labels, the host's calculation of ciphertexts, and the transmission of public networks is very high. Therefore, in actual applications of federated vertical trees, encryption calculations, ciphertext calculations, and communication time will account for a large part. Summary of the invention
[0004] The embodiments of the present application provide a decision tree construction method, device, electronic device, computer-readable storage medium and computer program product based on a federated learning system, which can effectively reduce the data transmission and processing volume in the decision tree construction process, thereby reducing transmission overhead and improving the decision tree construction efficiency.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] The embodiment of the present application provides a decision tree construction method based on a federated learning system, wherein the federated learning system includes a first participant device having label information and at least one second participant device, and the method is applied to the first participant device, including:
[0007] Acquire training samples and the type of decision tree to be constructed, and determine reference data of splitting points for constructing the decision tree based on the training samples and the type;
[0008] Compressing the reference data to obtain first compressed data, and sending the first compressed data to a second participant device;
[0009] receiving splitting point data sent by a second participant device, where the splitting point data is obtained by the second participant device constructing a splitting point corresponding to the decision tree based on the first compressed data;
[0010] Based on the splitting point data, a global splitting point of the decision tree is determined, and based on the global splitting point, the decision tree is constructed.
[0011] The embodiment of the present application provides a decision tree construction device based on a federated learning system, including:
[0012] An acquisition module, used to acquire training samples and the type of decision tree to be constructed, and determine reference data of splitting points for constructing the decision tree based on the training samples and the type;
[0013] A compression module, configured to compress the reference data to obtain first compressed data, and send the first compressed data to a second participant device;
[0014] A receiving module, configured to receive splitting point data sent by a second participant device, where the splitting point data is obtained by the second participant device constructing a splitting point corresponding to the decision tree based on the first compressed data;
[0015] A construction module is used to determine a global splitting point of the decision tree based on the splitting point data, and to construct the decision tree based on the global splitting point.
[0016] In the above scheme, the compression module is also used to determine corresponding compression control parameters based on the type of the decision tree, and the compression control parameters include at least one of the following: the maximum number of homomorphic integer bits, the fixed-point precision of floating-point numbers, the number of labels, and the number of samples; based on the compression control parameters and the bit length of the reference data, the compression parameters are determined; based on the compression parameters, the reference data is compressed to obtain first compressed data.
[0017] In the above scheme, when the decision tree is a gradient boosting decision tree, the reference data is a sample gradient, the compression control parameters include the maximum number of homomorphic integer bits, the fixed-point precision of the floating-point number and the number of samples, and the compression module is further used to perform fixed-point processing on the sample gradient based on the fixed-point precision of the floating-point number to obtain the fixed-point integer corresponding to the sample gradient, and determine the placeholder corresponding to the sample gradient based on the number of samples and the fixed-point integer; sum the placeholders of the sample gradients to determine the total compressed placeholders; perform integer division processing on the maximum number of homomorphic integer bits and the total compressed placeholders to determine the ciphertext compression amount; and use the placeholders of the sample gradients, the total compressed placeholders and the ciphertext compression amount as the compression parameters.
[0018] In the above scheme, when the decision tree is a classification decision tree, the reference data is a sample label, the compression control parameters include the maximum number of homomorphic integer bits, the number of labels and the number of samples, and the compression module is further used to determine the label placeholder based on the sample label; perform a product processing on the bit length of the number of samples and the number of labels to determine the total compressed placeholder; perform an integer division processing on the maximum number of homomorphic integer bits and the total compressed placeholder to determine the ciphertext compression amount; and use the label placeholder, the total compressed placeholder and the ciphertext compression amount as the compression parameters.
[0019] In the above scheme, the compression module is also used to perform homomorphic encryption on the first compressed data, and send the homomorphically encrypted first compressed data to the second participant device, so that the second participant device constructs the splitting point corresponding to the decision tree based on the homomorphically encrypted first compressed data to obtain the splitting point data.
[0020] In the above scheme, the splitting point data is that the second participant device constructs the splitting point of the decision tree based on the first compressed data to obtain the splitting point construction result, and compresses the splitting point construction result. The construction module is also used to decompress the splitting point data to obtain the splitting point construction result; combine the splitting point construction result and the training sample to determine the global splitting point of the decision tree.
[0021] In the above scheme, the construction module is also used to traverse the splitting points of the decision tree based on the training samples to determine the first splitting point; based on the training samples and the splitting point construction results, traverse the splitting points in the decision tree to determine the second splitting point; compare the first splitting point and the second splitting point to determine the global splitting point of the decision tree.
[0022] In the above scheme, the construction module is also used to obtain the label of the training sample; based on the label of the training sample and the reference data, the splitting points of the decision tree are traversed to determine the first feature splitting gain histogram corresponding to the first participant device; wherein the first feature splitting gain histogram is used to determine the maximum gain splitting point in the first feature splitting gain histogram; based on the first feature splitting gain histogram, the gain value of the splitting point of the decision tree is determined, and the splitting point with the largest gain value is selected as the first splitting point; obtain the label of the training sample; based on the label of the training sample and the splitting point construction result, the splitting points of the decision tree are traversed to determine the second feature splitting gain histogram corresponding to the second participant device; wherein the second feature splitting gain histogram is used to determine the maximum gain splitting point in the second feature splitting gain histogram based on a preset gain calculation formula; based on the second feature splitting gain histogram, the gain value of the splitting point of the decision tree is determined, and the splitting point with the largest gain value is selected as the second splitting point.
[0023] In the above scheme, the construction module is also used to obtain the gain value of the first splitting point and the gain value of the second splitting point respectively; compare the gain value of the first splitting point and the gain value of the second splitting point, and select the splitting point corresponding to the larger gain value as the global splitting point of the decision tree.
[0024] In the above scheme, the construction module is also used to obtain the feature value and feature code of the global splitting point; determine the feature corresponding to the feature code, and determine the feature splitting method in combination with the feature and the feature value; and construct the decision tree based on the feature splitting method.
[0025] In the above scheme, the construction module is also used to obtain the splitting point code corresponding to the global splitting point when the global splitting point belongs to the first participant device, and determine the feature value and feature code of the global splitting point based on the splitting point code; when the global splitting point belongs to the second participant device, send the splitting point code corresponding to the global splitting point to the second participant device, and receive the feature value and feature code returned by the second participant device based on the splitting point code.
[0026] An embodiment of the present application provides an electronic device, including:
[0027] A memory for storing executable instructions;
[0028] The processor is used to implement the decision tree construction method based on the federated learning system provided in the embodiment of the present application when executing the executable instructions stored in the memory.
[0029] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute and implement a decision tree construction method based on a federated learning system provided in an embodiment of the present application.
[0030] An embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the decision tree construction method based on the federated learning system provided in the embodiment of the present application.
[0031] The embodiments of the present application have the following beneficial effects:
[0032] Compared with the existing process of building a decision tree, the present application compresses the reference data obtained based on the training sample according to the type of decision tree to be built, obtains the first compressed data, and then determines the corresponding split point data through the first compressed data, thereby determining the global split point of the decision tree, and then building the decision tree. In this way, by compressing the intermediate transmission data, the data transmission and processing volume in the decision tree construction process can be effectively reduced, thereby reducing the transmission overhead and improving the efficiency of decision tree construction. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a schematic diagram of an implementation scenario of a decision tree construction method based on a federated learning system provided in an embodiment of the present application;
[0034] Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0035] Figure 3 It is a flowchart of a decision tree construction method based on a federated learning system provided in an embodiment of the present application;
[0036] Figure 4 It is an optional flow chart of the data compression method provided in the embodiment of the present application;
[0037] Figure 5 It is an optional schematic diagram of a process of traversing a decision tree provided in an embodiment of the present application;
[0038] Fig. 6A is an optional splitting point splitting schematic diagram of the splitting point provided in the embodiment of the present application;
[0039] Figure 6B is an optional splitting point splitting schematic diagram of the splitting point provided in the embodiment of the present application;
[0040] Fig. 7A is an optional splitting point splitting schematic diagram of the splitting point provided in the embodiment of the present application;
[0041] Figure 7Bis an optional splitting point splitting schematic diagram of the splitting point provided in the embodiment of the present application;
[0042] Figure 8 is an optional splitting point splitting schematic diagram of the splitting point provided in the embodiment of the present application;
[0043] Fig. 9 It is a flowchart of a decision tree construction method based on a federated learning system provided in an embodiment of the present application;
[0044] Fig.10 It is a flowchart of a decision tree construction method based on a federated learning system provided in an embodiment of the present application;
[0045] Fig.11 It is a schematic diagram of the compression process of a four-classification decision tree based on a federated learning system provided in an embodiment of the present application;
[0046] Fig.12 It is a schematic diagram of the compression process of the gradient boosting decision tree based on the federated learning system provided in the embodiment of the present application;
[0047] Fig.13 It is an optional structural diagram of a decision tree construction device based on a federated learning system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0049] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0050] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0052] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0053] 1) Decision Tree is a machine learning method. It is specifically a tree structure, in which each internal node represents a judgment on an attribute, each branch represents the output of a judgment result, and finally each leaf node represents a classification result.
[0054] 2) Federated machine learning (Federated Learning), also known as federated learning, joint learning, and alliance learning. Federated machine learning is a machine learning framework that can effectively help multiple institutions use data and conduct machine learning modeling while meeting the requirements of user privacy protection, data security, and government regulations. As a distributed machine learning paradigm, federated learning can effectively solve the problem of data silos, allowing participants to jointly model without sharing data, which can technically break data silos and achieve collaborative intelligence.
[0055] Federated Learning (aka Federated Machine Learning) can be divided into three categories: Horizontal Federated Learning, Vertical Federated Learning, and Federated Transfer Learning.
[0056] Among them, horizontal federated learning is also called feature-aligned federated learning (Feature-Aligned Federated Learning), that is, the data features of participants in horizontal federated learning are aligned, which is suitable for the situation where the data features of participants overlap a lot, but the sample IDs (ID, Identity document) overlap less. Vertical federated learning is also called sample-aligned federated learning (Sample-Aligned Federated Learning), that is, the training samples of participants in vertical federated learning are aligned, which is suitable for the situation where the training sample IDs of participants overlap a lot, but the data features overlap less.
[0057] 3) Homomorphic encryption (HE) is a symmetric encryption algorithm proposed by Craig Gentry of IBM in 2009. The purpose of homomorphic encryption is to find an encryption algorithm that can perform addition and multiplication operations on ciphertext, so that the result of a certain operation on the encrypted ciphertext is exactly equal to the ciphertext obtained by performing the expected operation on the plaintext before encryption. Homomorphic encryption effectively ensures that the data processor can directly process the ciphertext of the data accordingly without knowing the plaintext information of the data it processes. This feature of homomorphic encryption ensures that the user's data and privacy can be properly secured. Therefore, homomorphic encryption is applied to many real-world scenarios to ensure data security.
[0058] If an encryption function satisfies both additive homomorphism and multiplicative homomorphism, it is called fully homomorphic encryption. This encryption function can be used to perform various encrypted operations (addition, subtraction, multiplication, division, polynomial evaluation, exponential, logarithmic, trigonometric functions, etc.).
[0059] The decision tree based on the federated learning system in the embodiment of the present application can be applied to risk control management. For example, the constructed decision tree can be used to predict the credit of a user as trustworthy or dishonest, and then the risk control for the user (such as lending or not lending) can be performed in combination with the prediction result. For another example, the constructed decision tree can be used to predict and score the risk level of a project, and then the risk control for the project (implementation or non-implementation) can be performed in combination with the prediction result.
[0060] Based on the above explanations of the nouns and terms involved in the embodiments of the present application, the following describes the implementation scenario of the decision tree construction method based on the federated learning system provided in the embodiments of the present application. Figure 1 , Figure 1 It is a schematic diagram of an implementation scenario of a decision tree construction method based on a federated learning system provided in an embodiment of the present application. To support an exemplary application, a first participant device 200-1 is connected to a second participant device 200-2 via a network 300, wherein the first participant device 200-1 may be an active party device storing user tag information, such as a bank, and the second participant device 200-2 may be a passive party device storing user feature data, such as a shopping mall or a supermarket. The first participant device 200-1 and the second participant device 200-2 assist each other in performing federated learning so that the first participant device 200-1 obtains a decision tree. The network 300 may be a wide area network or a local area network, or a combination of the two, and data transmission is achieved using wireless or wired links.
[0061] The first participant device (including the first participant device 200-1) is used to obtain training samples and the type of the decision tree to be constructed, and determine reference data of the splitting points for constructing the decision tree based on the training samples and the type; compress the reference data to obtain first compressed data, and send the first compressed data to the second participant device;
[0062] The second participant device (including the second participant device 200-2) is used to obtain the first compressed data sent by the first participant device; based on the first compressed data, construct the splitting point data corresponding to the decision tree; and send the splitting point data to the first participant device.
[0063] The first participant device (including the first participant device 200-1) is also used to receive the splitting point data sent by the second participant device; determine the global splitting point of the decision tree based on the splitting point data, and construct the decision tree based on the global splitting point.
[0064] In practical applications, the decision tree constructed based on the federated learning system can be applied to risk control management. For example, based on the user feature data of the target user, the decision tree can be used to predict the user's credit, and an evaluation result of whether the target user is trustworthy can be obtained, thereby obtaining the target user's credit level, and combining the predicted user's credit to execute risk control for the user.
[0065] In actual applications, the first participant device 200-1 and the second participant device 200-2 can be independent physical servers, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The first participant device 200-1 and the second participant device 200-2 can also be smart phones, tablet computers, laptops, desktop computers, smart speakers, smart watches, etc., but are not limited to them. The first participant device 200-1 and the second participant device 200-2 can be directly or indirectly connected via wired or wireless communication, and this application does not limit this.
[0066] The hardware structure of the electronic device for implementing the decision tree construction method based on the federated learning system provided in the embodiment of the present application is described in detail below. The electronic device includes but is not limited to a server or a terminal. Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 2The electronic device 200 shown includes: at least one processor 210, a memory 250, at least one network interface 220 and a user interface 230. The various components in the electronic device 200 are coupled together via a bus system 240. It is understood that the bus system 240 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 240 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 240 is not described in detail. Figure 2 Various buses are labeled as bus system 240 .
[0067] The processor 210 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0068] The user interface 230 includes one or more output devices 231 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 230 also includes one or more input devices 232, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0069] The memory 250 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 250 may optionally include one or more storage devices that are physically remote from the processor 210.
[0070] The memory 250 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 250 described in the embodiments of the present application is intended to include any suitable type of memory.
[0071] In some embodiments, memory 250 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0072] Operating system 251, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0073] A network communication module 252, used to reach other computing devices via one or more (wired or wireless) network interfaces 220, exemplary network interfaces 220 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB);
[0074] The input processing module 253 is used to detect one or more user inputs or interactions from one of the one or more input devices 232 and translate the detected inputs or interactions.
[0075] In some embodiments, the decision tree construction device based on the federated learning system provided in the embodiments of the present application can be implemented in a software manner. Figure 2 A decision tree construction device 254 based on a federated learning system stored in a memory 250 is shown, which may be software in the form of a program and a plug-in, etc., and includes the following software modules: an acquisition module 2541, a compression module 2542, a receiving module 2543, and a construction module 2544. These modules are logical, and therefore can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be explained below.
[0076] In other embodiments, the decision tree construction device based on the federated learning system provided in the embodiments of the present application can be implemented in a combination of software and hardware. As an example, the decision tree construction device based on the federated learning system provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the decision tree construction method based on the federated learning system provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.
[0077] Based on the above description of the implementation scenario and electronic device of the decision tree construction method based on the federated learning system in the embodiment of the present application, the decision tree construction method based on the federated learning system provided by the embodiment of the present application is described below. Figure 3 , Figure 3: is a flow chart of a decision tree construction method based on a federated learning system provided in an embodiment of the present application. The decision tree construction method based on a federated learning system provided in an embodiment of the present application includes:
[0078] Step 101: The first participant device obtains training samples and the type of decision tree to be constructed, and determines reference data of splitting points for constructing the decision tree based on the training samples and the type.
[0079] Here, the training sample may be a user shared by the first participant device and the second participant device. The first participant device serves as a label holder and feature provider of the training sample, and the second participant device serves only as a feature provider of the training sample.
[0080] Exemplarily, when the decision tree to be constructed is applied to risk control management or risk control prediction, the label of the training sample can be a binary classification label that identifies whether the user is trustworthy or not, or a binary classification label that identifies whether the user has high or low loyalty, or a binary classification label used to evaluate whether the user is a high-quality customer. Here, the first participant is a platform that conducts credit assessment on the user, for example, a financial loan platform (such as a bank), and the second participant can be a platform that holds the user's feature data, such as various types of consumer platforms (for example, shopping malls, supermarkets, online shopping platforms, game platforms, mobile application stores, etc.), or Internet companies, etc. Among them, the user's feature data may include but is not limited to the user's basic information, business data, behavior data and device information, etc. The basic information includes but is not limited to the user's name, gender, age, education, occupation, mobile phone number, ID number, address, income data (for example, annual salary, monthly salary), etc. Business data includes data under multiple business scenarios. For example, if the business scenario is loan business, business data includes loan data and repayment data, etc. Loan data includes loan amount, loan time and loan institution (for example, xx bank), etc. Repayment data includes repayment amount, repayment time, repayment institution and overdue repayment data (for example, number of overdue payments and number of overdue days), etc. For example, if the business scenario is consumption scenario, business data includes consumption purpose (for example, education consumption, shopping consumption, medical consumption, life consumption, etc.), consumption amount, consumption time, consumption institution (for example, shopping malls, supermarkets, convenience stores, online shopping stores, etc.), consumption method (for example, credit card consumption or savings card consumption, etc.) and the address of the user at the time of consumption, etc. Behavior data can be, for example, the payment institution commonly used by users (for example, WeChat payment, bank card payment, etc.), the payment method commonly used by users (for example, QR code payment method, card payment method) and operation frequency (for example, the frequency of payment operations within a period of time), etc. Device information includes the model of the device commonly used by users, the address of the device when the user behavior is implemented, etc.
[0081] It should be noted that, before using the training samples for model training, the embodiment of the present application also performs feature binning on the data of the training samples, for example, binning the age feature into less than 30 years old, 30-50 years old, and greater than 50 years old, etc. The model obtained by feature binning training is more interpretable.
[0082] Here, the types of decision trees to be constructed include gradient boosting decision trees, classification decision trees, and random forests.
[0083] In actual implementation, when the decision tree to be constructed is a classification decision tree, the data labels corresponding to the feature binned data are obtained; a label vector is constructed based on the data label. For example, if the label has only two categories, a one-dimensional vector is generated for each sample, which is [1] if it is a positive class, and [0] if it is a negative class; if the label has multiple categories, a multi-dimensional one-hot code vector is generated. For example, if there are four categories, if the labels are 1, 2, 3, and 4, the corresponding vectors are [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], and [0, 0, 0, 1]; a label vector set is determined based on the constructed label vector, so that the label vector set is used as reference data.
[0084] In actual implementation, when the decision tree to be constructed is a gradient boosting decision tree, the data labels and residuals corresponding to the feature binned data are obtained; based on the data labels and residuals, sample gradients, i.e., first-order gradients and second-order gradients, are constructed. Exemplarily, a total of t generations of trees need to be constructed, where t is a positive integer greater than or equal to 1. Among them, the height of each decision tree is the same, the first participant device counts the number of labels, and calculates the first-order gradient g and the second-order gradient h based on the local labels and the residuals of the previous t-1 generation of trees; based on the constructed first-order gradients and second-order gradients, the first-order gradient set and the second-order gradient set are determined, so that the first-order gradient set and the second-order gradient set are used as reference data.
[0085] It should be noted that since the random forest classification is a combination of classification decision trees, the difference is that each tree adds row / column sampling, and the rest of the construction process is consistent with the classification decision tree. The final prediction result is a combination of all trees. Therefore, the construction and application process of the random forest classification can refer to the classification decision tree, and this application will not go into details.
[0086] Step 102: compress the reference data to obtain first compressed data, and send the first compressed data to the second participant device.
[0087] Here, for the process of compressing the reference data to obtain the first compressed data, see Figure 4 , Figure 4 is an optional flow chart of the data compression method provided in the embodiment of the present application, based on Figure 3, step 102 can be implemented as follows:
[0088] Step 1021: The first participant device determines corresponding compression control parameters based on the type of decision tree.
[0089] Here, the compression control parameters are determined by a compression planning module, and the compression control parameters include at least one of the following: the maximum number of homomorphic integer digits, the fixed-point precision of floating-point numbers, the number of labels, and the number of samples.
[0090] In actual implementation, when the decision tree is a classification decision tree, the corresponding compression control parameters include the maximum number of homomorphic integer digits, the number of labels, and the number of samples; when the decision tree is a gradient boosting decision tree, the corresponding compression control parameters include the maximum number of homomorphic integer digits, the fixed-point precision of floating-point numbers, and the number of samples.
[0091] Step 1022, determining compression parameters based on the compression control parameters and the bit length of the reference data.
[0092] In actual implementation, when the decision tree is a classification decision tree, first determine the label placeholder based on the sample label; then multiply the bit length of the sample number and the number of labels to determine the total compressed placeholder; then perform integer division on the maximum number of homomorphic integer bits and the total compressed placeholder to determine the ciphertext compression amount; finally, use the label placeholder, the total compressed placeholder and the ciphertext compression amount as compression parameters.
[0093] Exemplarily, the first participant device reads the compression control parameters through the compression planning module, determines the maximum number of homomorphic integer digits, the number of labels and the number of samples, and then determines the number of bits occupied by a single label, i.e., the label placeholder, based on the sample label, and then determines the plaintext compression result, i.e., the total compressed placeholder, as the bit length of the number of samples * the number of labels, based on the bit length of the number of labels and the number of samples, and then determines the ciphertext compression amount as the maximum number of homomorphic integer digits / / total placeholder, based on the maximum number of homomorphic integer digits and the total compressed placeholder.
[0094] It should be noted that, because in the case of a decision tree, the processed label is 0 or 1, the result of the histogram statistical sum must be less than 1*number of samples, so we can compress the label vector of a sample into an integer, from which we can calculate the number of bits occupied by the compressed plaintext and the compression amount when the ciphertext is compressed.
[0095] In actual implementation, when the decision tree is a gradient boosting decision tree, the sample gradient is first fixed-pointed based on the fixed-point accuracy of floating-point numbers to obtain the fixed-point integer corresponding to the sample gradient; the number of samples and the fixed-point integer are then multiplied to determine the placeholder of the corresponding sample gradient; the placeholders of the sample gradients are then summed to determine the total compressed placeholder; the maximum number of homomorphic integer digits and the total compressed placeholder are then integer divided to determine the ciphertext compression amount; finally, the placeholder of the sample gradient, the total compressed placeholder and the ciphertext compression amount are used as compression parameters.
[0096] Exemplarily, the first participant device reads the compression control parameters through the compression planning module, determines the maximum number of homomorphic integer digits, the fixed-point precision of floating-point numbers, and the number of samples, and then determines the first-order gradient g and the second-order gradient h corresponding to the sample based on the sample gradient, so as to perform fixed-point processing on the first-order gradient g and the second-order gradient h, and obtain the fixed-point integers corresponding to the first-order gradient g and the second-order gradient h, that is, the first-order gradient g integer = int(g*2^ (定点化精度) ), second-order gradient h integer = int(h*2^ (定点化精度) ), and the second-order gradient h itself is between [0,1], so there is no need to do fixed-point conversion. Then consider the maximum value of the sum of the integer part of the first-order gradient g and the integer part of the second-order gradient h to ensure that the number of bits will not overflow. The number of samples is multiplied by the fixed-point integer to determine the corresponding sample gradient position, that is, the first-order gradient g position = the number of bits (int(g_max*2^ (定点化精度) )*number of samples), second-order gradient h occupies = number of bits (int(h_max*2^ (定点化精度) )*number of samples), and then based on the first-order gradient g position and the second-order gradient h position, determine the total compressed position, which is the sum of the first-order gradient g position and the second-order gradient h position. Then, based on the maximum number of homomorphic integer digits and the total compressed position, determine the ciphertext compression amount as the result of integer division of the maximum number of homomorphic integer digits and the total position.
[0097] Here, if the total number of occupancy is less than the maximum number of homomorphic integer digits, the algorithm can continue, otherwise the algorithm stops and informs that the number of digits is insufficient.
[0098] It should be noted that because the first-order gradient g may be negative, if the integer after plaintext packaging is negative, the ciphertext compression through addition and multiplication cannot obtain the correct result. Therefore, before the first-order gradient g is fixed-point processed, in order to correctly execute the ciphertext compression operation of the gradient boosting decision tree, the first-order gradient g must be offset to a positive number. Specifically, the first-order gradient g in the classification task is between [-1,1], so it is necessary to first add 1 to g to offset it to between [0,2].
[0099] Here, after obtaining the compression parameter, the first participant device saves the compression parameter and sends the compression parameter to the second participant device at the same time.
[0100] Step 1023: compress the reference data based on the compression parameter to obtain first compressed data.
[0101] In some embodiments, when the decision tree to be constructed is a classification decision tree, the first participant device calls a plaintext compression module to compress the total placeholders according to the single label placeholders, and compresses the label vector of each sample into a large integer, namely, the first compressed data. By way of example, assuming that the label vector here is [0, 0, 0, 1], the sample label is represented by an 80-bit integer, that is, 0 and 1 in the label vector are represented by 20-bit integers respectively. In this way, the label vector is compressed into an 80-bit large integer.
[0102] In other embodiments, when the decision tree to be constructed is a gradient boosting decision tree, the first participant device calls a plaintext compression module, and based on the integer obtained after the first-order gradient and the second-order gradient are fixed-pointed in step 1022, the integer corresponding to the first-order gradient is shifted to the left by the bit length of the integer corresponding to the second-order gradient to obtain a displacement integer, and the displacement integer is added to the integer corresponding to the second-order gradient to obtain a packaged plaintext compressed gradient, i.e., the first compressed data. By way of example, it is assumed that the fixed-point first-order gradient g here is an integer with a bit length of 74 bits, and the fixed-point second-order gradient h is an integer with a bit length of 73 bits, the g integer corresponding to the first-order gradient is shifted to the left by 73 bits, and the h integer with a bit length of 73 bits corresponding to the second-order gradient is added to obtain a 147-bit compressed gradient g_h.
[0103] Here, taking the gradient boosting decision tree as an example, the g of sample 1 is 1 0.023,h 1 is 0.01, and the g of sample 2 2 is 0.01, h 2 is 0.01, and after converting it to an integer, we get g 1 =23,h 1 =10,g 2 =10,h 2 =10, compressed to get g_h 1 =2310,g_h 2 =1010, then the compression gradients are 2310 and 1010.
[0104] In this way, by compressing the transmitted data during the interaction between the first participant device and the second participant device, the amount of data sent from the first participant device to the second participant is reduced, the overhead of data transmission is reduced, and at the same time, the amount of data encryption in subsequent homomorphic encryption is reduced, thereby improving data processing efficiency.
[0105] In some embodiments, after obtaining the first compressed data, the first participant device homomorphically encrypts the first compressed data, and sends the homomorphically encrypted first compressed data to the second participant device, so that the second participant device constructs the splitting point of the corresponding decision tree based on the homomorphically encrypted first compressed data to obtain the splitting point data. In this way, privacy protection is achieved through the encryption operation of the first compressed data, and the security of the data transmission process is improved.
[0106] Step 103: Receive splitting point data sent by the second participant device.
[0107] Here, the splitting point data is obtained by the second participant device constructing the splitting point of the corresponding decision tree based on the first compressed data.
[0108] In some embodiments, based on Figure 3 Step 103 can also be implemented in the following manner: the first participant device receives the splitting point data sent by the second participant device, the splitting point data is, the second participant device constructs the splitting point of the decision tree based on the first compressed data to obtain the splitting point construction result, and compresses the splitting point construction result.
[0109] In actual implementation, after receiving the first compressed data sent by the first participant device, the second participant device traverses the splitting points of the decision tree based on the first compressed data. For example, see Figure 5 , Figure 5 This is an optional schematic diagram of the process of traversing the decision tree provided in the embodiment of the present application. Assuming that the sample data is (32 years old, bachelor degree), the second participant device traverses the decision tree according to the sample data. Figure 5 After the decision tree is shown, the result is labeled as A 34 The classification results.
[0110] As an example, when the decision tree to be constructed is a binary classification decision tree, see Fig. 6A , Fig. 6A It is an optional splitting point splitting diagram of the splitting point provided in the embodiment of the present application. Exemplarily, the splitting points of the decision tree are age and education level, and the label is used to indicate the credit level of the user. By classifying and predicting 5 training samples, based on the first compression parameter, the second participant device traverses the age and education level of the 5 samples to determine the splitting point construction result, such as the construction result corresponding to the age classification according to 20 and the education level classification according to the undergraduate classification, or the construction result corresponding to the age classification according to 30 and the education level classification according to the master classification.
[0111] As an example, when the tree to be built is a binary gradient boosted decision tree, see Fig. 7A , Fig. 7AIt is an optional splitting point splitting diagram of the splitting point provided in the embodiment of the present application. Exemplarily, the splitting points of the decision tree are age and education level, and the label is used to indicate the credit level of the user. By classifying and predicting 5 training samples, based on the first compression parameter, the second participant device traverses the age and education level of the 5 samples to determine the splitting point construction result, such as the construction result corresponding to the age classification according to 20 and the education level classification according to the undergraduate classification, or the construction result corresponding to the age classification according to 30 and the education level classification according to the master classification.
[0112] In some embodiments, after the second participant device obtains the splitting point construction result based on the first compressed data, the second participant device calls the ciphertext compression module to compress the splitting point construction result based on the received compression parameter to obtain a large encrypted integer.
[0113] In actual implementation, the compression parameters here include the total occupancy and the ciphertext compression amount. The ciphertext compression module is called to compress the encrypted split point construction result. Specifically, assuming that there are n split point construction results in total, the ciphertext compression amount is k, and k encrypted split point construction results are taken out from n in a loop without putting them back. If there are less than k, all the remaining split points are taken out, and the first encrypted split point construction result taken out in each cycle is used as the first summary result. Starting from the second encrypted split point construction result, to the kth, the final summary result = ((k-1)th summary result * 2^ 总占位 ) + the kth encrypted split point construction result, save the final summary result, if n split points have been processed, jump out of the loop; after processing all the summary results, multiple final summary results are obtained. Here, each summary result is a large encrypted integer.
[0114] Continuing with the above example, after receiving the ciphertexts [
[2310] ] and [
[1010] ], they can be compressed into one ciphertext by calculating [
[2310] ]*10000+[
[1010] ]=[[23101010]].
[0115] In actual implementation, after obtaining multiple final summary results, the multiple final summary results are sent to the first participant device. It should be noted that the multiple final summary results can also be made into a compressed ciphertext list to send the compressed ciphertext list to the first participant device. Here, this application does not limit the method of sending the final summary results to the first participant device.
[0116] Step 104: determine the global splitting point of the decision tree based on the splitting point data, and construct the decision tree based on the global splitting point.
[0117] In actual implementation, after receiving the splitting point data sent by the second participant device, the first participant device decompresses the splitting point data to obtain the splitting point construction result; then combines the splitting point construction result and the training sample to determine the global splitting point of the decision tree.
[0118] Here, the process of decompressing the split point data to obtain the split point construction result is described in detail:
[0119] It should be noted that before decompressing the splitting point data, the splitting point data needs to be decrypted, that is, multiple summary results, that is, multiple large encrypted integers are decrypted to obtain a large integer, and then the large integer is disassembled using a decompression module to obtain a splitting point construction result. Specifically,
[0120] for i=0;i<ciphertext compression amount;i++;
[0121] Mask = 2^ 总占位 -1;
[0122] Statistical result = plain text & mask;
[0123] The plaintext shifted right occupies a total of bits;
[0124] Save the statistical results;
[0125] Here, the statistical result is the construction result. At each traversal, the following processing is performed to determine the mask = 2^ 总占位 -1, then determine the statistical result = plaintext & mask, where the plaintext is the large integer obtained by decryption, and then move the plaintext to the right by the total occupied bit length to obtain the split point construction result and save it.
[0126] It should be noted that the above decompression process is the decompression process of the compression process of the second participant device. Next, the decompression process of the compression process of the first participant device will be described:
[0127] When the decision tree to be constructed is a classification decision tree, the first participant device disassembles the construction results of multiple split points according to the number of bits occupied by a single label to obtain the final construction result. Exemplarily, when the sample is 1000 (binary bit length is 10), the number of label categories is 4, the bit length of the split point construction result is 40, the integer represented by the first 10 bits of a 40-bit integer is 400, the integer represented by the first 10 bits is 200, the integer represented by the third 10 bits is 100, and the integer represented by the fourth 10 bits is 300. At this time, for this split point, the number of samples corresponding to the label vectors [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1] are 400, 200, 100, 300 respectively.
[0128] When the decision tree to be constructed is a gradient boosting decision tree, the first participant device performs floating point conversion on the construction results of multiple split points to obtain the sum of the offset first-order gradient g and the sum of the second-order gradient h. For example, for each construction result, the construction result is shifted right by the second-order gradient h position to obtain an integer construction result of the first-order gradient g, and then the construction result & (2^ h占位 -1), get the integer construction result of the second-order gradient h, and then divide the construction result of the first-order gradient g by 2^ (精度位) , get the construction result of the first-order gradient g, and finally divide the construction result of the second-order gradient h by 2^ (精度位) , and obtain the construction result of the second-order gradient h, thus obtaining the construction result of the first-order gradient g and the construction result of the second-order gradient h, that is, the sum of the first-order gradient g and the sum of the second-order gradient h after the shift. Then the first participant device restores the sum of the first-order gradient g after the shift based on the number of samples. Specifically, the number of samples of the split point construction result is determined, and the construction result of g is subtracted by (1*the number of samples of the split point construction result), so as to offset the shift. In this way, the final construction result is obtained.
[0129] In some embodiments, after obtaining the final construction result, the global split point of the decision tree is determined in combination with the final construction result and the training samples.
[0130] Here, in combination with the final construction result and the training sample, the process of determining the global splitting point of the decision tree can be that the first participant device traverses the splitting points of the decision tree based on the training sample to determine the first splitting point, and at the same time, the first participant device traverses the splitting points in the decision tree based on the training sample and the splitting point construction result to determine the second splitting point; here, the first splitting point is the optimal splitting point at the first participant device, and the second splitting point is the optimal splitting point at the second participant device; the first splitting point and the second splitting point are compared to determine the global splitting point of the decision tree.
[0131] In actual implementation, based on the training samples, the splitting points of the decision tree are traversed to determine the first splitting point. The process may be to obtain the labels of the training samples; based on the labels of the training samples and the reference data, the splitting points of the decision tree are traversed to determine the first feature splitting gain histogram corresponding to the first participant device; wherein the first feature splitting gain histogram is used to determine the maximum gain splitting point in the first feature splitting gain histogram; based on the first feature splitting gain histogram, the gain value of the splitting point of the decision tree is determined, and the splitting point with the largest gain value is selected as the first splitting point.
[0132] In actual implementation, based on the training samples and the splitting point construction results, the splitting points in the decision tree are traversed to determine the second splitting point. The process may be to obtain the label of the training sample; based on the label of the training sample and the splitting point construction results, the splitting points of the decision tree are traversed to determine the second feature splitting gain histogram corresponding to the second participant device; wherein the second feature splitting gain histogram is used to determine the maximum gain splitting point in the second feature splitting gain histogram; based on the second feature splitting gain histogram, the gain value of the splitting point of the decision tree is determined, and the splitting point with the largest gain value is selected as the second splitting point.
[0133] Here, the process of determining the maximum gain splitting point in the first feature splitting gain histogram and the second feature splitting gain histogram may be based on a preset gain formula to determine the maximum gain splitting point in the first feature splitting gain histogram and the second feature splitting gain histogram.
[0134] It should be noted that when the decision tree to be constructed is a classification decision tree, the preset gain formula here can be a formula for calculating information gain, information entropy, Gini index, information gain rate, etc. Exemplarily, when the preset gain formula is a formula for calculating the Gini index:
[0135]
[0136] Here, D is the data set, P k Assuming there are K classes, the probability that the sample point belongs to the Kth class, for example, for dividing D into D according to feature A 1 and D 2 ,but
[0137]
[0138] It should be noted here that the methods of determining the maximum gain splitting point are different based on the properties of different formulas. For example, for information entropy and Gini index, the smaller the calculated result, the larger the gain value of the corresponding splitting point. For information gain and information gain rate, the larger the calculated result, the larger the gain value of the corresponding splitting point.
[0139] Continuing with the above example, see Figure 6B , Figure 6B This is an optional splitting point splitting diagram provided in the embodiment of the present application. Here, when the five training samples are sample 1 (19-year-old undergraduate with high credit), sample 2 (18-year-old undergraduate with high credit), sample 3 (21-year-old high school with low credit), sample 4 (29-year-old master with high credit) and sample 5 (34-year-old master with low credit), substituting the data into formula (2) yields:
[0140]
[0141]
[0142]
[0143]
[0144] In this way, by comparing the Gini index, the smaller the Gini index, the greater the gain value of the corresponding split point, and the split point with the largest gain value can be obtained, that is, the split point corresponding to the age classification of 30 and the split point corresponding to the undergraduate classification.
[0145] In other embodiments, when the decision tree to be constructed is a gradient boosting decision tree, the preset gain formula here is:
[0146]
[0147] Where M is the calculation gain, the G L is the sum of the first-order gradients of the samples on the left side of the split point, G R is the sum of the first-order gradients of the samples on the right side of the split point, and the H L is the sum of the second-order gradients of the samples on the left side of the split point, H R is the sum of the second-order gradients of the samples on the right side of the splitting point, G is the sum of the first-order gradients of the samples at the splitting point, H is the sum of the second-order gradients of the samples at the splitting point, and λ is an adjustment parameter used to adjust the value range of the gain. Therefore, when performing the calculation, it should be noted that the sample data of the training sample has a value range, and there are multiple splittable points within the value range. Based on each splittable point, the sample data can be split to obtain sample data on the left side of the splitting point and sample data on the right side of the splitting point, wherein the sample data on the left side of the splitting point corresponds to the left node of the splitting point after the splitting point is split, and the sample data on the right side of the splitting point corresponds to the right node of the splitting point after the splitting point is split, and then the gain, that is, the value of M is calculated, and then the splitting point corresponding to the largest M value is taken as the maximum gain splitting point.
[0148] Continuing with the above example, see Figure 7B , Figure 7B This is an optional splitting point splitting schematic diagram of the splitting point provided in an embodiment of the present application. Here, after obtaining the sum of the first-order gradients and the sum of the second-order gradients corresponding to the age classification of 20, 30, and the academic degree classification of undergraduate and master, the sum of the first-order gradients and the sum of the second-order gradients on the left and right sides of the splitting point are respectively substituted into the above-mentioned preset gain formula to calculate the gain values corresponding to different splitting points. In this way, by comparing the gain values, the splitting point with the largest gain value can be obtained, that is, the splitting point corresponding to the age classification of 30 and the splitting point corresponding to the academic degree classification of undergraduate.
[0149] In actual implementation, after determining the first splitting point and the second splitting point, the first splitting point and the second splitting point are compared to determine the global splitting point of the decision tree, which can be to obtain the gain value of the first splitting point and the gain value of the second splitting point respectively; compare the gain value of the first splitting point and the gain value of the second splitting point, and select the splitting point corresponding to the larger gain value as the global splitting point of the decision tree.
[0150] It should be noted that the gain value of the first splitting point and the gain value of the second splitting point obtained here are the gain values of the corresponding first splitting point and the second splitting point obtained in the process of determining the first splitting point and the second splitting point.
[0151] In some embodiments, after determining the global splitting point, the process of constructing a decision tree based on the global splitting point can be by obtaining the feature value and feature coding of the global splitting point; determining the features of the corresponding feature coding, and determining the feature splitting method in combination with the features and feature values; and constructing a decision tree based on the feature splitting method.
[0152] It should be noted that when the global splitting point belongs to the first participant device, the splitting point code corresponding to the global splitting point is obtained, and the feature value and feature code of the global splitting point are determined based on the splitting point code; at the same time, an empty message is sent to the second participant device.
[0153] When the global splitting point belongs to the second participant device, a splitting point code corresponding to the global splitting point is sent to the second participant device, and a feature value and a feature code returned by the second participant device based on the splitting point code are received; and at the same time, it is recorded that the splitting point belongs to the second participant device.
[0154] For example, see Figure 8 , Figure 8 This is an optional splitting point splitting diagram provided by the embodiment of the present application. Here, the sample data falling on the splitting point includes the corresponding sample data of samples 2, 5, 7, 8 and 10. The feature code corresponding to the global splitting point is 3, and the feature value = 0.4. Here, when the global splitting point belongs to the second participant device, the first participant device sends the global splitting point in the form of a number to the second participant device. The second participant device obtains the feature code and feature value corresponding to the global splitting point based on the number, and sends the corresponding feature code and feature value to the first participant device. Figure 8 As shown, after splitting the split point, the left child node corresponds to sample 2, sample 5 and sample 10, and the right child node corresponds to sample 7 and sample 8.
[0155] In actual implementation, when the decision tree to be constructed is a classification decision tree, if the decision tree at the split point does not meet the stop splitting condition, the splitting continues until the stop splitting condition is met, and the construction of the decision tree is completed. Here, the probability of the predicted class is determined by the proportion of each sample in the leaf node of the first participant device.
[0156] In actual implementation, when the decision tree to be constructed is a gradient boosting decision tree, if the decision tree at the split point does not meet the stop splitting condition, the splitting continues until the stop splitting condition is met, and the construction of the decision tree of this generation is completed. Here, the output of the previous generation tree is used to update the current prediction value, and the first participant device continues to calculate the loss function to determine whether the loss function converges. If not, continue to build a new decision tree until the loss function converges, or determine whether the number of decision trees reaches a preset number. If not, continue to build a new decision tree until the preset number is reached. When the loss function converges or the decision tree reaches the preset number, the construction of the decision tree is completed.
[0157] It should be noted that the conditions for stopping splitting may be that the depth of the decision tree reaches a preset depth, the gain value of the decision tree reaches a preset gain value, or the number of samples does not meet the requirement for continued splitting.
[0158] In this way, when the amount of data calculation and transmission is large during the data transmission process between the first participant device and the second participant device, the sample label or sample gradient is compressed in plain text and then encrypted to ensure that the original sample gradient and sample label can satisfy the addition and subtraction operations under compression, thereby reducing the encryption and decryption amount of the first participant device and the calculation amount of the second participant device.
[0159] By applying the above-mentioned embodiment of the present application, in the process of constructing a decision tree, the reference data obtained based on the training sample is compressed according to the type of decision tree to be constructed to obtain first compressed data, and then the corresponding splitting point data is determined through the first compressed data, thereby determining the global splitting point of the decision tree, and then constructing the decision tree. In this way, by compressing the intermediate transmission data, the data transmission and processing volume in the process of building the decision tree can be effectively reduced, thereby reducing the transmission overhead and improving the efficiency of building the decision tree.
[0160] The following describes exemplary applications of the embodiments of the present application in two practical application scenarios.
[0161] Next, taking the application scenario of the vertical federated classification decision tree as an example, the decision tree construction method based on the federated learning system provided in the embodiment of the present application is introduced. Fig. 9 This is an optional flow chart of a decision tree construction method based on a federated learning system provided in an embodiment of the present application, see Fig. 9The decision tree construction method based on the federated learning system provided in the embodiment of the present application is implemented by the first participant device (leading party guest) and the second participant device (participant host) in collaboration. The first participant device and the second participant device can be a server or a terminal. Fig. 9 , the decision tree construction method based on the federated learning system provided in the embodiment of the present application includes:
[0162] In step 201, the first participant device and the second participant device respectively complete local initialization, bin local features and start to jointly construct a classification decision tree.
[0163] Here, the classification decision tree to be constructed can be a binary classification decision tree or a multi-classification decision tree. As an example, in this embodiment, the classification decision tree to be constructed is a four-classification decision tree. For example, for labels 1, 2, 3, and 4, the corresponding vectors are [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], and [0, 0, 0, 1].
[0164] Step 202: The first participant device processes the label according to each sample label to obtain a label vector.
[0165] Step 203: The first participant device calls the compression planning module, calculates the compression parameters and sends them to the second participant device.
[0166] Here, before the first participant device calls the compression planning module and calculates the compression parameters, the first participant device needs to determine the compression control parameters, where the compression control parameters include the maximum number of homomorphic integer digits, the number of labels, and the number of samples.
[0167] In actual implementation, the first participant device reads the compression control parameters through the compression planning module, calculates and saves the compression parameters, and sends the compression parameters to the second participant device. The compression parameters here include the number of bits occupied by a single label, the total number of bits occupied by plaintext, and the amount of ciphertext compression.
[0168] As an example, see here Fig.11 , Fig.11 This is a schematic diagram of the compression process of the four-classification decision tree based on the federated learning system provided in an embodiment of the present application. Here, the maximum number of homomorphic integer bits is 2046, the number of labels is 4, and the number of samples is 1000000. 1000000 binary is 20 bits, then the number of bits occupied by a single label is 20, and the total number of bits occupied by the labels is 20*4=80 bits. The ciphertext compression amount is 2046 / / 80=25. Then, the first participant device sends the number of bits occupied by a single label, 20, the total number of bits occupied, and the ciphertext compression amount, 25, to the second participant device.
[0169] It should be noted that the combined plaintext is an 80-bit integer. When operating on this 80-bit integer, the result will definitely not overflow 80 bits, and each 20 bits can correctly reflect the result of label accumulation. In this way, even if 1,000,000 samples have the same label, the number of bits of the result of label accumulation will not exceed 20.
[0170] In step 204, the first participant device calls a plaintext compression module to compress the label vector of each sample to obtain a large integer corresponding to the label vector of each sample.
[0171] Here, calling the plaintext compression module means compressing the label vector of each sample into a large integer according to the number of bits occupied by a single label and the number of bits occupied by the plaintext through the plaintext compression layer in the decision tree.
[0172] Continuing with the above example, assuming that the label vector here is [0, 0, 0, 1], the sample label is represented by an 80-bit integer, that is, 0 and 1 in the label vector are represented by 20-bit integers respectively. In this way, the label vector is compressed into an 80-bit large integer.
[0173] Step 205: Perform homomorphic encryption on the large integer to obtain an encrypted integer, and send it to the second participant device.
[0174] Step 206: The first participant device and the second participant device initialize the root node, and all samples fall on the root node and are added to the node list.
[0175] Step 207: Take out a node from the node list, and at the current split node, the first participant device uses local features and labels to determine the optimal split point of the dominant party.
[0176] Step 208: The second participant device constructs a splitting point based on the received encrypted integer to obtain an encrypted splitting point construction result.
[0177] Here, the second participant device traverses the splitting points of the decision tree to be constructed based on the received encrypted integers through histogram statistical operations to obtain an encrypted splitting point construction result.
[0178] Continuing with the above example, the encrypted split point construction result here is an 80-bit encrypted integer.
[0179] Step 209: The second participant device calls the ciphertext compression module, compresses the encrypted split point construction result based on the received compression parameter to obtain a large encrypted integer, and sends the large encrypted integer to the first participant device.
[0180] Continuing with the above example, the ciphertext compression amount here is 25, and the total occupancy is 80. Assuming that there are 250 encrypted split point construction results, the 25 encrypted split point construction results are compressed into one ciphertext compression result, that is, the compression process is cycled 10 times, and 10 final summary results are calculated. For the calculation process of each final summary result, specifically, the final summary result = {(the first encrypted split point statistical result * 2^ 80 )+the second encrypted split point statistics}*2^ 80 ……+the 25th encrypted split point statistical result. Here, after obtaining 10 final summary results, the 10 final summary results are made into a compressed ciphertext list and sent to the first participant device.
[0181] It should be noted that the final summary result here is the large encrypted integer, and the split point statistical result here is the split point construction result.
[0182] Step 210: The first participant device uses a decompression module to decrypt the large encrypted integer to obtain a large integer.
[0183] Continuing with the above example, the large integer here is the integer obtained by decrypting the 10 final summary results respectively, and this integer is composed of 25 80-bit integers.
[0184] Step 211: The first participant device uses a decompression module to decompose the large integer to obtain a result of constructing multiple splitting points.
[0185] Continuing with the above example, the large integer formed by concatenating 25 80-bit integers is disassembled to obtain 25 80-bit integers. Since there are 10 large integers here, we finally get 250 80-bit integers.
[0186] It should be noted that the 250 80-bit integers here are the construction results corresponding to each split point, that is, the construction results of 250 split points.
[0187] Step 212: The first participant device decomposes the construction results of multiple split points according to the number of bits occupied by a single tag to obtain a final construction result.
[0188] Continuing with the above example, here, based on the 20 bits occupied by a single label, the results of constructing 250 split points are disassembled, that is, the 80 bits of the 250 80-bit integers are divided according to the 20-bit number, and a corresponding integer is obtained for every 20 bits, that is, 4 integers are obtained. It should be noted that in the case of a decision tree, the processed label is 0 or 1, so based on the 4 integers, the number of samples of each category label corresponding to each split point of the second participant device can be obtained.
[0189] Step 213: Based on the final construction result, the gains of multiple splitting points are calculated to obtain the optimal splitting point of the participants.
[0190] Step 214: Based on the optimal splitting points of the participants, the optimal splitting points of the dominant party are integrated to obtain the global optimal splitting point.
[0191] In actual implementation, by comparing the gains of the optimal splitting point of the participating party with the optimal splitting point of the dominant party, the splitting point with the larger gain is selected as the global optimal splitting point.
[0192] Step 215, determine whether the stop splitting condition is met, if not, return to step 206, if yes, execute step 216.
[0193] In actual implementation, if the splitting condition is met, the current node is split based on the feature value and feature code, the leaf node is added to the node list, and the process returns to step 206;
[0194] If the splitting condition is not met, the establishment of the decision tree is stopped and step 216 is executed.
[0195] Step 216, completing the construction of the decision tree.
[0196] By applying the above-mentioned embodiment of the present application, in the process of constructing a decision tree, the reference data obtained based on the training sample is compressed according to the type of decision tree to be constructed to obtain first compressed data, and then the corresponding splitting point data is determined through the first compressed data, thereby determining the global splitting point of the decision tree, and then constructing the decision tree. In this way, by compressing the intermediate transmission data, the data transmission and processing volume in the process of building the decision tree can be effectively reduced, thereby reducing the transmission overhead and improving the efficiency of building the decision tree.
[0197] Next, taking the application scenario of the classification vertical gradient boosting decision tree as an example, the decision tree construction method based on the federated learning system provided in the embodiment of the present application is introduced. Fig.10 This is an optional flow chart of a decision tree construction method based on a federated learning system provided in an embodiment of the present application, see Fig.10 The decision tree construction method based on the federated learning system provided in the embodiment of the present application is implemented by the first participant device (leading party guest) and the second participant device (participant host) in collaboration. The first participant device and the second participant device can be a server or a terminal. Fig.10 , the decision tree construction method based on the federated learning system provided in the embodiment of the present application includes:
[0198] In step 301, the first participant device and the second participant device respectively complete local initialization, bin local features and start to jointly construct a first-generation decision tree.
[0199] Here, there are t generations of trees to be constructed, where t is a positive integer greater than or equal to 1. The height of each decision tree is the same.
[0200] As an example, there are 30 generations of trees to be built, with a tree height of 5.
[0201] Step 302: The first participant device counts the number of tags and calculates the first-order gradient g and the second-order gradient h based on the local tags and the residual of the previous t-1 generation tree.
[0202] Here, if it is a binary classification (n=2) task, the total number of labels is 1, otherwise the total number of labels is n.
[0203] Continuing with the above example, here is a binary classification gradient boosting decision tree.
[0204] Here, after completing the operations of the above steps 301 to 302, it is assumed that the current label i=0, and for each category of labels in the total number of labels, the process of steps 303 to 317 is performed.
[0205] Step 303: The first participant device calls the compression planning module, calculates the compression parameters and sends them to the second participant device.
[0206] As an example, see here Fig.12 , Fig.12 : This is a schematic diagram of the compression process of the gradient boosting decision tree based on the federated learning system provided in the embodiment of the present application. Here, taking 53 precision bits, 1000000 samples, and 2046 as an example, the value of g after offset is 1.2312, then the fixed-point is g integer = int (1.2312*2^ 53 )=11089663722437110, then calculate that g occupies = bit length (18014398509481984000000) = 74 bits, h occupies = bit length (9007199254740992000000) = 73 bits, then calculate that total occupancy = 73+74=147, ciphertext compression amount = 2046 / / 147=13, then, the first participant device sends g occupies 74, h occupies 73, total occupancy 147, ciphertext compression amount 13 to the second participant device.
[0207] Step 304: The first participant device calls the plaintext compression module to compress g and h of each sample to obtain a compressed gradient g_h corresponding to each sample.
[0208] Continuing with the above example, here g is fixed-pointed to an integer with a bit length of 74 bits, and h is fixed-pointed to an integer with a bit length of 73 bits. Shift g to the left by 73 bits, and add h (which has a bit length of 73 after the fixed-point conversion) to obtain a 147-bit large integer g_h.
[0209] Step 305: The first participant device homomorphically encrypts the compressed gradient g_h of the corresponding class to obtain [[g_h]] and sends it to the second participant device.
[0210] Step 306: The first participant device and the second participant device initialize the root node, and all samples fall on the root node and are added to the node list.
[0211] Step 307: Take out a node from the node list. At the current split node, the first participant device uses the local features and g and h to determine the optimal split point of the dominant party.
[0212] Step 308: The second participant device constructs a splitting point based on the received encrypted integer to obtain an encrypted splitting point construction result.
[0213] Here, the second participant device takes out a node from the node list, uses the received [[g_h]] to calculate a histogram at the current split node, and constructs a split point based on the histogram to obtain an encrypted split point construction result.
[0214] Here, the encrypted splitting point construction result is that the second participant device traverses the splitting points based on local features and the received [[g_h]], and obtains an encrypted integer for each splitting point, which is concatenated from the sum of g and the sum of h.
[0215] Continuing with the above example, the encrypted split point construction result here is a 147-bit encrypted integer.
[0216] Step 309: The second participant device calls the ciphertext compression module, compresses the encrypted split point construction result based on the received compression parameter to obtain a large encrypted integer, and counts the number of samples in each split point construction result, and sends the large encrypted integer and the counted number of samples to the first participant device.
[0217] Continuing with the above example, the ciphertext compression amount here is 13, and the total occupancy is 147. Assuming that there are 130 encrypted split point construction results, the 13 encrypted split point construction results are compressed into one ciphertext compression result, that is, the compression process is cycled 10 times, and 10 final summary results are calculated. For the calculation process of each final summary result, specifically, the final summary result = {(the first encrypted split point statistical result * 2^ 147 )+the second encrypted split point statistics}*2^ 147……+the thirteenth encrypted split point statistical result. Here, after obtaining 10 final summary results, the 10 final summary results are made into a compressed ciphertext list and sent to the first participant device.
[0218] It should be noted that the final summary result here is the large encrypted integer, and the split point construction result here is the split point statistical result.
[0219] Step 310: The first participant device uses a decompression module to decrypt the large encrypted integer to obtain a large integer.
[0220] Continuing with the above example, the large integer here is the integer obtained by decrypting the 10 final summary results respectively. This integer is composed of 13 147-bit integers.
[0221] Step 311: The first participant device uses a decompression module to decompose the large integer to obtain a result constructed as multiple splitting points.
[0222] Continuing with the above example, the large integer formed by concatenating 13 147-bit integers is disassembled to obtain 13 147-bit integers. Since there are 10 large integers here, we will eventually get 130 147-bit integers.
[0223] It should be noted that the 130 147-bit integers here are the construction results corresponding to each split point, that is, 130 split point construction results.
[0224] Step 312: The first participant device performs floating point conversion on the construction results of the multiple splitting points to obtain the sum of g and the sum of h after the shift.
[0225] Continuing with the above example, the 130 split point construction results are converted to floating points, that is, 130 147-bit integers are converted to floating points. Specifically, for each 147-bit integer, it is shifted 73 bits to the right to obtain a 74-bit integer construction result of g. The 147-bit integer &2^ 73 -1, get the 73-bit integer construction result of h, then divide the 74-bit integer construction result of g by 2^ 53 , get the construction result of g, which is the sum of g after the shift, and divide the 73-bit integer construction result of h by 2^ 53 , and get the construction result of h, which is the sum of h.
[0226] Step 313: The first participant device restores the offset g based on the number of received samples.
[0227] Step 314: Based on the sum of g and the sum of h, the gains of multiple splitting points are calculated to obtain the optimal splitting point of the participant.
[0228] Step 315: Based on the optimal splitting points of the participants, the optimal splitting points of the dominant party are integrated to obtain the global optimal splitting point.
[0229] Step 316, determine whether the stop splitting condition is met, if it is met, return to step 308, if it is not met, execute step 317.
[0230] In actual implementation, if the stop splitting condition is not met, the current node is split based on the feature value and feature coding, the leaf node is added to the node list, and step 308 is returned to repeat until the current tree is built. If it is met, stop building the decision tree and execute step 317.
[0231] Continuing with the above example, when the height of the current decision tree reaches 5, or reaches the preset gain value, or the number of samples does not meet the splitting requirement, the conditions for stopping splitting are met.
[0232] Step 317, determine whether the decision trees corresponding to all classes of this generation have been constructed. If the decision trees corresponding to all classes of this generation have been constructed, execute step 318; if the decision trees corresponding to all classes of this generation have not been constructed, execute step 303.
[0233] Step 318, using the output of the previous generation tree to update the current prediction value.
[0234] Step 319, checking whether the stop condition is met, if not, the first participant device and the second participant device continue to jointly construct the decision tree and return to step 302, if satisfied, execute step 320.
[0235] Continuing with the above example, the loss function is calculated to determine whether the loss function converges or 30 trees have been built to meet the stopping condition.
[0236] Step 320, completing the construction of the decision tree.
[0237] In this way, the above-mentioned embodiments of the present application greatly reduce the modeling time and improve the modeling speed. The modeling party can eventually build multiple models and adjust parameters in less time to obtain a decision tree model with lossless effect.
[0238] By applying the above-mentioned embodiment of the present application, in the process of constructing a decision tree, the reference data obtained based on the training sample is compressed according to the type of decision tree to be constructed to obtain first compressed data, and then the corresponding splitting point data is determined through the first compressed data, thereby determining the global splitting point of the decision tree, and then constructing the decision tree. In this way, by compressing the intermediate transmission data, the data transmission and processing volume in the process of building the decision tree can be effectively reduced, thereby reducing the transmission overhead and improving the efficiency of building the decision tree.
[0239] The following is a description of the decision tree construction device 254 based on the federated learning system provided in the embodiment of the present application, see Fig.13 , Fig.13 is a schematic diagram of the structure of a decision tree construction device 254 based on a federated learning system provided in an embodiment of the present invention. The decision tree construction device 254 based on a federated learning system provided in an embodiment of the present invention includes:
[0240] An acquisition module 2541 is used to acquire training samples and the type of decision tree to be constructed, and determine reference data of split points for constructing the decision tree based on the training samples and the type;
[0241] A compression module 2542, configured to compress the reference data to obtain first compressed data, and send the first compressed data to a second participant device;
[0242] The receiving module 2543 is configured to receive splitting point data sent by the second participant device, where the splitting point data is obtained by the second participant device constructing a splitting point corresponding to the decision tree based on the first compressed data;
[0243] The construction module 2544 is used to determine the global splitting point of the decision tree based on the splitting point data, and construct the decision tree based on the global splitting point.
[0244] In some embodiments, the compression module 2542 is also used to determine corresponding compression control parameters based on the type of the decision tree, and the compression control parameters include at least one of the following: the maximum number of homomorphic integer bits, the fixed-point precision of floating-point numbers, the number of labels, and the number of samples; based on the compression control parameters and the bit length of the reference data, determine the compression parameters; based on the compression parameters, compress the reference data to obtain first compressed data.
[0245] In some embodiments, when the decision tree is a gradient boosting decision tree, the reference data is a sample gradient, and the compression control parameters include the maximum number of homomorphic integer bits, the fixed-point precision of the floating-point number, and the number of samples. The compression module 2542 is also used to perform fixed-point processing on the sample gradient based on the fixed-point precision of the floating-point number to obtain the fixed-point integer corresponding to the sample gradient, and determine the placeholder corresponding to the sample gradient based on the number of samples and the fixed-point integer; sum the placeholders of the sample gradients to determine the total compressed placeholders; perform integer division processing on the maximum number of homomorphic integer bits and the total compressed placeholders to determine the ciphertext compression amount; and use the placeholders of the sample gradients, the total compressed placeholders, and the ciphertext compression amount as the compression parameters.
[0246] In some embodiments, when the decision tree is a classification decision tree, the reference data is a sample label, the compression control parameters include the maximum number of homomorphic integer bits, the number of labels and the number of samples, and the compression module 2542 is further used to determine the label placeholders based on the sample labels; perform a product processing on the bit length of the number of samples and the number of labels to determine the total compressed placeholders; perform an integer division processing on the maximum number of homomorphic integer bits and the total compressed placeholders to determine the ciphertext compression amount; and use the label placeholders, the total compressed placeholders and the ciphertext compression amount as the compression parameters.
[0247] In some embodiments, the compression module 2542 is also used to perform homomorphic encryption on the first compressed data, and send the homomorphically encrypted first compressed data to the second participant device, so that the second participant device constructs the splitting point corresponding to the decision tree based on the homomorphically encrypted first compressed data to obtain the splitting point data.
[0248] In some embodiments, the splitting point data is that the second participant device constructs the splitting point of the decision tree based on the first compressed data to obtain a splitting point construction result, and compresses the splitting point construction result. The construction module 2544 is also used to decompress the splitting point data to obtain the splitting point construction result; combine the splitting point construction result and the training sample to determine the global splitting point of the decision tree.
[0249] In some embodiments, the construction module 2544 is also used to traverse the splitting points of the decision tree based on the training samples to determine a first splitting point; traverse the splitting points in the decision tree based on the training samples and the splitting point construction results to determine a second splitting point; and compare the first splitting point and the second splitting point to determine a global splitting point of the decision tree.
[0250] In some embodiments, the construction module 2544 is also used to obtain the label of the training sample; based on the label of the training sample and the reference data, the splitting points of the decision tree are traversed to determine the first feature splitting gain histogram corresponding to the first participant device; wherein the first feature splitting gain histogram is used to determine the maximum gain splitting point in the first feature splitting gain histogram; based on the first feature splitting gain histogram, the gain value of the splitting point of the decision tree is determined, and the splitting point with the largest gain value is selected as the first splitting point; obtain the label of the training sample; based on the label of the training sample and the splitting point construction result, the splitting points of the decision tree are traversed to determine the second feature splitting gain histogram corresponding to the second participant device; wherein the second feature splitting gain histogram is used to determine the maximum gain splitting point in the second feature splitting gain histogram based on a preset gain calculation formula; based on the second feature splitting gain histogram, the gain value of the splitting point of the decision tree is determined, and the splitting point with the largest gain value is selected as the second splitting point.
[0251] In some embodiments, the construction module 2544 is further used to obtain the gain value of the first splitting point and the gain value of the second splitting point respectively; compare the gain value of the first splitting point and the gain value of the second splitting point, and select the splitting point corresponding to the larger gain value as the global splitting point of the decision tree.
[0252] In some embodiments, the construction module 2544 is also used to obtain the feature value and feature code of the global splitting point; determine the feature corresponding to the feature code, and determine the feature splitting method in combination with the feature and the feature value; and construct the decision tree based on the feature splitting method.
[0253] In some embodiments, the construction module 2544 is further used to, when the global splitting point belongs to the first participant device, obtain the splitting point code corresponding to the global splitting point, and determine the feature value and feature code of the global splitting point based on the splitting point code; when the global splitting point belongs to the second participant device, send the splitting point code corresponding to the global splitting point to the second participant device, and receive the feature value and feature code returned by the second participant device based on the splitting point code.
[0254] It should be noted that the description of the device of the embodiment of the present application is similar to the description of the above-mentioned method embodiment, and has similar beneficial effects as the method embodiment, so it will not be repeated.
[0255] An embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements a decision tree construction method based on a federated learning system provided in an embodiment of the present application.
[0256] An embodiment of the present application provides a computer-readable storage medium storing executable instructions, wherein executable instructions are stored. When the executable instructions are executed by a processor, the processor will be caused to execute the method provided by the embodiment of the present application.
[0257] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.
[0258] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0259] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0260] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0261] In summary, the embodiments of the present application can effectively reduce the amount of data transmission and processing in the process of building a decision tree, thereby reducing transmission overhead and improving the efficiency of building a decision tree.
[0262] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A decision tree construction method based on a federated learning system, characterized in that: The federated learning system includes a first participant device having label information and at least one second participant device. The method is applied to the first participant device, including: Acquire training samples and the type of decision tree to be constructed, and determine reference data for constructing splitting points of the decision tree based on the training samples and the type, wherein the type of decision tree to be constructed includes but is not limited to a gradient boosting decision tree and a classification decision tree; when the type of the decision tree is a gradient boosting decision tree, the reference data is a sample gradient, and when the type of the decision tree is a classification decision tree, the reference data is a sample label; Compressing the reference data to obtain first compressed data, and sending the first compressed data to a second participant device; receiving splitting point data sent by a second participant device, where the splitting point data is obtained by the second participant device constructing a splitting point corresponding to the decision tree based on the first compressed data; Based on the splitting point data, a global splitting point of the decision tree is determined, and based on the global splitting point, the decision tree is constructed.
2. The method according to claim 1, characterized in that The compressing the reference data to obtain first compressed data includes: Based on the type of the decision tree, determine corresponding compression control parameters, wherein the compression control parameters include at least one of the following: the maximum number of homomorphic integer digits, the fixed-point precision of floating-point numbers, the number of labels, and the number of samples; Determining a compression parameter based on the compression control parameter and the bit length of the reference data; Based on the compression parameter, the reference data is compressed to obtain first compressed data.
3. The method according to claim 2, characterized in that When the decision tree is a gradient boosting decision tree, the reference data is a sample gradient, and the compression control parameters include the maximum number of homomorphic integer digits, the floating point number fixed-point precision, and the number of samples; The determining of the compression parameter based on the compression control parameter and the bit length of the reference data comprises: Based on the fixed-point precision of the floating-point number, the sample gradient is fixed-point processed to obtain a fixed-point integer corresponding to the sample gradient, and based on the number of samples and the fixed-point integer, a placeholder corresponding to the sample gradient is determined; Summing up the space occupied by the sample gradients to determine the total compressed space occupied; Perform integer division processing on the homomorphic maximum integer digit and the total compressed occupancy to determine the ciphertext compression amount; The placeholder of the sample gradient, the total compressed placeholder and the ciphertext compression amount are used as the compression parameters.
4. The method according to claim 2, characterized in that: When the decision tree is a classification decision tree, the reference data is a sample label, and the compression control parameters include the maximum number of homomorphic integer digits, the number of labels, and the number of samples; Based on the sample labels, determining label placeholders; The bit length of the sample number and the number of labels are multiplied to determine the total compressed bit size; Perform integer division processing on the homomorphic maximum integer digit and the compression total to determine the ciphertext compression amount; The label placeholder, the total compressed placeholder and the ciphertext compression amount are used as the compression parameters.
5. The method according to claim 1, characterized in that The sending the first compressed data to the second participant device includes: The first compressed data is homomorphically encrypted, and the homomorphically encrypted first compressed data is sent to the second participant device, so that the second participant device constructs a splitting point corresponding to the decision tree based on the homomorphically encrypted first compressed data to obtain the splitting point data.
6. The method according to claim 1, characterized in that The splitting point data is obtained by the second participant device constructing the splitting points of the decision tree based on the first compressed data, and compressing the splitting point construction result; The determining the global splitting point of the decision tree based on the splitting point data includes: Decompressing the splitting point data to obtain the splitting point construction result; The global splitting point of the decision tree is determined by combining the splitting point construction result and the training samples.
7. The method according to claim 6, characterized in that The step of combining the split point construction result and the training sample to determine the global split point of the decision tree includes: Based on the training sample, traverse the splitting points of the decision tree to determine a first splitting point; Based on the training samples and the splitting point construction result, traverse the splitting points in the decision tree to determine a second splitting point; The first splitting point and the second splitting point are compared to determine a global splitting point of the decision tree.
8. The method according to claim 7, characterized in that The traversing the splitting points of the decision tree based on the training sample to determine the first splitting point includes: Obtaining labels of the training samples; Based on the labels of the training samples and the reference data, the splitting points of the decision tree are traversed to determine a first feature splitting gain histogram corresponding to the first participant device; wherein the first feature splitting gain histogram is used to determine the maximum gain splitting point in the first feature splitting gain histogram; Based on the first feature splitting gain histogram, determine the gain value of the splitting point of the decision tree, and select the splitting point with the largest gain value as the first splitting point; The traversing the splitting points in the decision tree based on the training samples and the splitting point construction result to determine the second splitting point includes: Based on the labels of the training samples and the splitting point construction results, the splitting points of the decision tree are traversed to determine a second feature splitting gain histogram corresponding to the second participant device; wherein the second feature splitting gain histogram is used to determine the maximum gain splitting point in the second feature splitting gain histogram; Based on the second feature splitting gain histogram, the gain values of the splitting points of the decision tree are determined, and the splitting point with the largest gain value is selected as the second splitting point.
9. The method according to claim 7, characterized in that: The comparing the first splitting point and the second splitting point to determine the global splitting point of the decision tree includes: respectively obtaining a gain value of the first splitting point and a gain value of the second splitting point; The gain value of the first splitting point and the gain value of the second splitting point are compared, and the splitting point corresponding to the larger gain value is selected as the global splitting point of the decision tree.
10. The method according to claim 1, characterized in that The step of constructing the decision tree based on the global splitting point includes: Obtaining the feature value and feature code of the global splitting point; Determine a feature corresponding to the feature code, and determine a feature splitting method in combination with the feature and the feature value; Based on the feature splitting method, the decision tree is constructed.
11. The method according to claim 10, characterized in that The obtaining of the feature value and feature code of the global splitting point includes: When the global splitting point belongs to the first participant device, obtaining a splitting point code corresponding to the global splitting point, and determining a feature value and a feature code of the global splitting point based on the splitting point code; When the global splitting point belongs to the second participant device, a splitting point code corresponding to the global splitting point is sent to the second participant device, and a feature value and a feature code returned by the second participant device based on the splitting point code are received.
12. A decision tree construction device based on a federated learning system, characterized in that: The device comprises: An acquisition module, used to acquire training samples and the type of decision tree to be constructed, and based on the training samples and the type, determine reference data for constructing split points of the decision tree, wherein the type of decision tree to be constructed includes but is not limited to a gradient boosting decision tree and a classification decision tree; when the type of the decision tree is a gradient boosting decision tree, the reference data is a sample gradient, and when the type of the decision tree is a classification decision tree, the reference data is a sample label; A compression module, configured to compress the reference data to obtain first compressed data, and send the first compressed data to a second participant device; A receiving module, configured to receive splitting point data sent by a second participant device, where the splitting point data is obtained by the second participant device constructing a splitting point corresponding to the decision tree based on the first compressed data; A construction module is used to determine a global splitting point of the decision tree based on the splitting point data, and to construct the decision tree based on the global splitting point.
13. An electronic device, characterized in that: The electronic device comprises: A memory for storing executable instructions; A processor, configured to implement the method according to any one of claims 1 to 11 when executing the executable instructions stored in the memory.
14. A computer-readable storage medium, characterized in that: Executable instructions are stored, and when executed by a processor, the method described in any one of claims 1 to 11 is implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
Citation Information
Patent Citations
Method and device for constructing isolated forest model based on federated learning
CN110991552A
Multi-party joint modeling method and device based on federated learning and medium
CN111368901A
Federal learning system
CN111507481A
Order placing rate prediction method and device, and readable storage medium
CN111768242A
Federated learning classification tree construction method, model construction method and terminal equipment
CN111783139A
