A method, device, equipment and medium for training a three-party privacy decision tree supporting missing values
By calculating the sum of the weights and information entropy of the sample set and sample subset, the problem of missing values in the training of data sets with multiple parties involved is solved, the efficiency of decision tree training and the accuracy of model prediction are improved, and data privacy is protected at the same time.
Patent Information
- Application Number
- CN202211509892.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-29
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2042-11-29
AI Technical Summary
In the training of datasets with the participation of multiple parties, existing technologies find it difficult to effectively handle the problem of missing values, resulting in a decline in dataset quality and reduced prediction accuracy, while also failing to guarantee data privacy.
By using the sum of the weights of the sample set and the sample subset and the information gain of the information entropy to calculate the attribute, the steps of calculating the ratio are reduced, and the data privacy is protected by combining the replication secret sharing technology.
It improves the efficiency of decision tree training, supports data with missing attribute values to participate in training, enhances data privacy protection, and improves model prediction accuracy.
Smart Images

Figure CN115759251B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a decision tree training method and device, computer equipment and computer readable storage medium. BACKGROUND
[0002] Machine learning has been widely applied in daily life, and decision tree algorithms such as ID3, C4.5 and CART are classic machine learning algorithms. As a kind of supervised learning algorithm, the input of decision tree is training data containing attribute values and classification results, and the output is the generated decision tree model. The trained model can predict the classification results of new data, and the prediction accuracy of the model depends largely on the size and quality of the training data, so the collection of data before training is crucial. In order to make it easier to collect data and increase the size of the data set, organizations as data owners usually cooperate with each other to obtain greater economic benefits.
[0003] However, in actual data collection, data will have the problem of missing attribute values in many scenarios, for example, enterprises use questionnaires to collect data, which contain some sensitive data such as wages and medical history. Some users choose to provide private data, but some users refuse to provide private data, which leads to incomplete questionnaire data submitted by users. Some methods for handling missing values are to process and fill in missing data to make the data complete to meet the training requirements. But this way needs at least one party to know the whole training data set, when the data set is distributed among multiple participants and each participant does not want to disclose its data, this cannot solve the data privacy problem. Another way is to discard these attributes without collecting them, but this will cause the number of data sets to decrease, affecting the quality of the data set and reducing the prediction accuracy of the trained model. SUMMARY
[0004] The purpose of the present application is to provide a decision tree training method, device, computer equipment and computer readable storage medium, by calculating the information gain of the attribute according to the weight sum and information entropy of the sample set and sample subset, compared with the previous way of calculating the information gain according to the proportion, the step of calculating the proportion is reduced, the data amount calculation is reduced at the same time, and the efficiency of decision tree training is improved.
[0005] According to one aspect of the present application, the present application provides a decision tree training method, comprising:
[0006] Obtaining training data and attributes;
[0007] According to the attributes, extracting a sample set and a sample subset from the training data, respectively;
[0008] Using an information entropy calculation formula to calculate the information entropy corresponding to the sample set and the sample subset, respectively;
[0009] calculating the weight sum corresponding to the sample set and the sample subset respectively by using a summation formula;
[0010] calculating the information gain of the attribute according to the weight sum and the information entropy;
[0011] constructing a decision tree according to the information gain.
[0012] Optionally, the calculating the information gain of the attribute according to the weight sum and the information entropy comprises:
[0013] multiplying the weight sum of the sample set by the information entropy to obtain a first value;
[0014] multiplying the weight sum of the sample subset by the information entropy to obtain a second value, and adding the second values corresponding to all the sample subsets to obtain a third value;
[0015] subtracting the first value from the third value to obtain the information gain of the attribute.
[0016] Optionally, before the calculating the weight sum corresponding to the sample set and the sample subset respectively by using a summation formula, the method further comprises:
[0017] setting the weight of a sample in the sample set and the sample subset respectively.
[0018] Optionally, the extracting a sample set and a sample subset from the training data according to the attribute comprises:
[0019] extracting a sample set corresponding to the attribute from the training data according to the attribute;
[0020] extracting a sample subset corresponding to a partition value of the attribute from the sample set according to the partition value.
[0021] Optionally, the constructing a decision tree according to the information gain comprises:
[0022] sorting the information gains of all the attributes;
[0023] determining an attribute corresponding to the information gain with the largest value, and taking the attribute as a root node of the decision tree;
[0024] dividing attribute values corresponding to the attribute according to the information gain to obtain a data set, and taking the data set as a child node of the root node.
[0025] Optionally, before the obtaining training data, the method further comprises:
[0026] The training data is transmitted by using a replicated secret sharing technology.
[0027] The application provides a data processing method based on the decision tree training method.
[0028] Obtain data information.
[0029] Analyze and predict the data information by using the trained decision tree to obtain classification results and regression results of the data information.
[0030] The application provides a decision tree training device, characterized by comprising:
[0031] An obtaining module is configured to obtain training data and attributes.
[0032] An extracting module is configured to extract a sample set and a sample subset from the training data according to the attributes.
[0033] A first calculating module is configured to calculate information entropy corresponding to the sample set and the sample subset by using an information entropy calculation formula.
[0034] A second calculating module is configured to calculate a weight sum corresponding to the sample set and the sample subset by using a summation formula.
[0035] An information gain calculating module is configured to calculate information gain of the attributes by using the weight sum and the information entropy.
[0036] A constructing module is configured to construct a decision tree according to the information gain.
[0037] The application provides a computer device, comprising:
[0038] A memory is configured to store a computer program.
[0039] A processor is configured to execute the computer program to realize the decision tree training method.
[0040] The application provides a computer readable storage medium, wherein the computer readable storage medium stores computer executable instructions, and the computer executable instructions are loaded and executed by a processor to realize the steps of the decision tree training method.
[0041] It can be seen that, compared with the previous way of calculating information gain according to the proportion, the way of calculating the information gain of the attribute according to the weight sum and the information entropy of the sample set and the sample subset reduces the step of calculating the proportion, reduces the data amount calculation, and improves the efficiency of the decision tree training. The application also provides a decision tree training device, a computer device and a computer readable storage medium, which have the above beneficial effects. BRIEF DESCRIPTION OF DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of the provided drawings.
[0043] Figure 1 A flowchart of a decision tree training method provided by the embodiments of the present application;
[0044] Figure 2 A structural block diagram of a decision tree training device provided by the embodiments of the present application;
[0045] Figure 3 A structural block diagram of a computer device provided by the embodiments of the present application. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical scheme and advantages of the embodiments of the present application more clear, the technical scheme in the embodiments of the present application will be described clearly and completely in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.
[0047] Machine learning has been widely applied in daily life, and decision tree algorithms such as ID3, C4.5 and CART are classic machine learning algorithms. As a kind of supervised learning algorithm, the input of the decision tree is training data containing attribute values and classification results, and the output is the generated decision tree model. The trained model can predict the classification result of new data, and the prediction accuracy of the model depends largely on the size and quality of the training data, so the collection of data before training is crucial. In order to more easily collect data and increase the size of the data set, organizations as data owners usually cooperate with each other to obtain greater economic benefits.
[0048] However, in actual data collection, data will have the problem of missing attribute values in many scenarios, for example, enterprises use questionnaires for data collection, and the questionnaires contain some sensitive data such as wages, medical history, etc. Some users choose to provide private data, but some users refuse to provide private data, which leads to incomplete questionnaire data submitted by users. At present, some methods for processing missing values are to process and fill in missing data to make the data complete to meet the training requirements. But this way needs at least one party to know the entire training data set, when the data set is distributed among multiple participants and each participant does not want to disclose its data, this cannot solve the data privacy problem. Another is to discard these attributes without collection, but this will cause the number of data sets to decrease, affect the quality of the data set, and reduce the prediction accuracy of the trained model.
[0049] Therefore, the present application provides a decision tree training method, by calculating the information gain of the attribute according to the weight sum and the information entropy of the sample set and the sample subset, compared with the previous method of calculating the information gain according to the proportion, the step of calculating the proportion is reduced, the data amount calculation is reduced, and the efficiency of the decision tree training is improved.
[0050] The following will be described in detail, please refer to Figure 1 , Figure 1 The flowchart of the decision tree training method provided by the embodiment of the present application can include:
[0051] Step S101: Obtain training data and attributes.
[0052] In the embodiment of the present application, the attributes can be divided into continuous attributes and discrete attributes, wherein the continuous attributes are continuous numerical values, and there is an order relationship between the numerical values, such as height, weight, etc. The discrete attributes are limited or countable numerical values, such as gender, etc.
[0053] In the embodiment of the present application, the training data is a data set used to train a machine learning model or a manually annotated data set. It should be noted that the content of the training data can be different data sets obtained according to different participants, wherein the form of the participants can be an institution or a company, and the embodiment of the present application does not limit this. For example, if the participant is an educational institution, the data set of the training data can be student information and subject information, etc.
[0054] It should be noted that before the training data is acquired in the embodiment of the present application, the participants can send the training data by using the replicated secret sharing technology to improve the privacy of the data. In the embodiment of the present application, the number of participants is not limited, and the decision tree training can be performed for the three participants, for example, the three participants are data providers and use the lightweight replicated secret sharing technology to provide the training data, so that the data is available but invisible. After the training data is used to complete the decision tree training, the trained decision tree is also saved in the three participants by using the replicated secret sharing technology. Specifically, in the embodiment of the present application, the replicated secret sharing technology can be based on secret sharing values to generate random values and distribute the random values to the participants, and then the participants perform operations according to the random values to ensure the privacy of the data. For example, if there are three participants, for secret values 2 n The ring is a module, and three random values are randomly generated And x=x1+x2+x3, the random values are divided into three parts {(x1,x2),(x2,x3),(x3,x1)}, each participant has a part, for example, the participant 1 has (x1,x2), which can be represented as [[x]], the participant 2 has (x2,x3), which can be represented as [[y]], and the participant 3 has (x3,x1), which can be represented as [[z]]. Then the participants perform addition and multiplication operations according to the random values. For the addition of two secret values [[x]]+[[y]], each party does not need to communicate with each other, but only needs to perform local calculation [[x+y]]:={(x1+y1,x2+y2),(x2+y2,x3+y3),(x3+y3,x1+y1)}. If the secret value is added with a constant [[x]]+c, only one share is added with the constant [[x]]+c:={(x1+c,x2),(x2,x3),(x3,x1+c)}. For the multiplication of the secret value and the constant, each share can be multiplied with the constant (c[[x]]:={(cx1,cx2),(cx2,cx3),(cx3,cx1)}). For the multiplication operation of two secret values [[x]]·[[y]], each party needs to interact to complete the operation. [[z]] can be defined as [[xy]], and the three participants calculate the relevant randomness α, β, γ, and α+β+γ=0. Participant 1 can calculate z1=x1y1+x1y2+x2y1+α and send it to participant 2, participant 2 calculates z2=x2y2+x2y3+x3y2+β and sends it to participant 3, and participant 3 calculates z3=x3y3+x3y1+x1y3+γ and sends it to participant 1.
[0055] The decision tree training is performed by using the replicated secret sharing technology in the embodiment of the application, the privacy of data is protected, and the security of the decision tree training is improved.
[0056] Step S102: extracting a sample set and a sample subset from the training data according to the attribute.
[0057] The sample set is a sample set without missing values on the attribute, and the sample subset is a sample set extracted from the sample set according to the division value of the attribute. The sample set and the sample subset can each contain one or more samples, which is not limited in the embodiment of the application. It should be noted that, in the embodiment of the application, it can be determined whether there is an attribute value corresponding to the attribute in the training data. If not, the extraction is not performed according to the attribute. If yes, the sample set corresponding to the attribute can be extracted from the training data according to the attribute, and then the sample subset corresponding to the division value can be extracted from the sample set according to the division value of the attribute. For example, there are training data such as {a = male}, {a = male}, {a = null}, {a = female}, {a = female}, and {a = female}, where a is an attribute representing gender. It can be determined whether there is an attribute value corresponding to the attribute in the training data, and then the sample corresponding to the attribute a is extracted from the training data according to the attribute, to obtain a sample set containing {a = male}, {a = male}, {a = female}, {a = female}, and {a = female}. Then, according to the attribute a, two division values of male and female are obtained according to the division value, to obtain the corresponding sample subsets, that is, the sample subset {a = male}, {a = male} is obtained according to the male division from the sample set, and the sample subset {a = female}, {a = female}, and {a = female} is obtained according to the female division.
[0058] Step S103: calculating the information entropy corresponding to the sample set and the sample subset by using an information entropy calculation formula.
[0059] The information entropy is a commonly used index for measuring the purity of a sample set, which can be calculated by using the information entropy calculation formula, and the formula is as follows:
[0060]
[0061] wherein, p k (k∈{1,2,…,|y|}) is the proportion of the kth class of samples in the set D, Ent(D) represents the information entropy of D, log is a logarithmic function, the logarithm needs to be quantified, and the calculated logarithmic value is limited to [0.5, 1), and then the corresponding calculation result is generated by using the approximate value.
[0062] The information entropy corresponding to the sample set and the sample subset can be calculated according to the above formula, for example, the training set D and the attribute a are given in the embodiment of the application, and the information entropy of the sample set and the sample subset can be calculated according to the above formula. In the representation, there is a sample subset with no missing values on attribute a. It can be assumed that attribute a has V possible values {a 1 ,a 2 ,...,a V},make express In the case of attribute a, the value is a v The sample subset is used, using the formula, which is as follows:
[0063]
[0064]
[0065]
[0066] The proportion of the kth category in the set.
[0067] Execute step S104: Use the summation formula to calculate the weight sum corresponding to the sample set and the sample subset respectively. After obtaining the weight sum, execute step S105: According to the weight sum and information entropy, calculate the information gain of the attribute.
[0068] In the embodiment of the present invention, the sum of weights is the sum of the weights of each sample. Before calculating the sum of weights, the weights of the samples in the sample set and the sample subset can be set separately. In the embodiment of the present invention, there is no restriction on the set weight values. Designers can set them according to needs or according to specific usage scenarios. For example, a weight can be assigned to each sample x. In the initial stage of decision tree training, the weights of each sample in the root node are initialized to 1.
[0069] In the embodiment of the present invention, information gain is a statistic used to describe the ability of an attribute to distinguish data samples. The information gain of the attribute can be calculated based on the weight sum and information entropy. Specifically, in the embodiment of the present invention, the weight sum of the sample set and the information entropy can be multiplied to obtain a first value, and then the weight sum of the sample subset and the information entropy can be multiplied to obtain a second value. The second values corresponding to all sample subsets are added to obtain a third value. Finally, the first value and the third value are subtracted to obtain the information gain of the attribute. It should be noted that the above process can be expressed by a formula, which is as follows:
[0070]
[0071] Where x represents the sample, Indicates the sample set with no missing values on attribute a, V indicates that there are V possible values in attribute a {a 1 ,a 2 ,...,a V}, express In the case of attribute a, the value is a v A subset of samples, Represents a sample set The sum of the weights of express The information entropy of Represents a sample subset The sum of the weights of express The information entropy of The calculated value is the first value in the above process. The calculated value is the second value in the above process, The calculated value is the third value in the above process.
[0072] In the embodiment of the present invention, by improving the information gain calculation method, the calculation of specific sample ratios is avoided, the amount of calculation is reduced, and data with missing attribute values are supported to participate in training, thereby improving the efficiency of training decision trees.
[0073] Step S106: Construct a decision tree based on information gain.
[0074] The decision tree in the embodiment of the present invention is a decision analysis method that uses a decision tree to determine the probability that the expected value of the net present value is greater than or equal to zero based on the known probabilities of various situations, evaluate project risks, and determine its feasibility. It is a graphical method that intuitively uses probability analysis.
[0075] In an embodiment of the present invention, the information gain of all attributes can be sorted, and the attribute corresponding to the maximum information gain can be determined. The attribute is used as the root node of the decision tree. Based on the information gain, the attribute values corresponding to the attribute are divided to obtain a data set, and the data set is used as a child node of the root node. For example, if the information gain of the discrete attribute gender is 0.8 and the information gain of the continuous attribute height is 0.9, and the continuous attributes include 160cm, 170cm, 175cm, 180cm, and 190cm, the information gain of the two is compared, and the continuous attribute is extracted as the root node of the decision tree. If the dividing point corresponding to the information gain is 175cm, the data sets of 160cm, 170cm, and 175cm are used as child nodes on the left, and the data sets of 180cm and 190cm are used as child nodes on the right. Then, the next iteration is entered to construct the decision tree.
[0076] Further, the embodiment of the present application further provides a data processing method, which can obtain data information, and then analyzes and predicts the data information by using the trained decision tree to obtain classification results and regression results of the data information, so as to realize more accurate prediction of the data.
[0077] Based on the above embodiment, the embodiment of the present application provides a decision tree training method, which can calculate the information gain of the attribute according to the weight sum and the information entropy of the sample set and the sample subset, compared with the previous method of calculating the information gain according to the proportion, the method reduces the step of calculating the proportion, reduces the data amount calculation, and improves the efficiency of the decision tree training.
[0078] The decision tree training device and the computer equipment provided by the embodiment of the present application are introduced below, and the decision tree training device and the computer equipment described below can be correspondingly referred to each other with the decision tree training method described above.
[0079] Please refer to Figure 2 , Figure 2 The structure block diagram of the decision tree training device provided by the embodiment of the present application can include:
[0080] The acquisition module 10 is configured to acquire training data and attributes;
[0081] The extraction module 11 is configured to extract a sample set and a sample subset from the training data according to the attributes;
[0082] The first calculation module 12 is configured to calculate the information entropy corresponding to the sample set and the sample subset by using an information entropy calculation formula;
[0083] The second calculation module 13 is configured to calculate the weight sum corresponding to the sample set and the sample subset by using a summation formula;
[0084] The information gain calculation module 14 is configured to calculate the information gain of the attribute according to the weight sum and the information entropy;
[0085] The construction module 15 is configured to construct a decision tree according to the information gain.
[0086] Based on the above embodiment, the acquisition module 10 can further include:
[0087] The secret sharing module is configured to send the training data by using a replicated secret sharing technology.
[0088] Based on any of the above embodiments, the extraction module 11 can include:
[0089] The first extraction module is configured to extract a sample set corresponding to the attribute from the training data according to the attribute.
[0090] The second extraction module is configured to extract a sample subset corresponding to a division value of the attribute from the sample set according to the division value.
[0091] According to any of the above embodiments, the information gain calculation module 14 can include:
[0092] The first calculation unit is configured to multiply the weight sum of the sample set by the information entropy to obtain a first value.
[0093] The second calculation unit is configured to multiply the weight sum of the sample subset by the information entropy to obtain a second value, and add the second values corresponding to all the sample subsets to obtain a third value.
[0094] The information gain calculation unit is configured to subtract the first value from the third value to obtain the information gain of the attribute.
[0095] According to any of the above embodiments, the second calculation module 13 can further include:
[0096] The setting module is configured to set the weights of the samples in the sample set and the sample subset, respectively.
[0097] According to any of the above embodiments, the construction module 15 can include:
[0098] The information gain sorting unit is configured to sort the information gains of all the attributes.
[0099] The determination unit is configured to determine the attribute corresponding to the largest value, and take the attribute as the root node of the decision tree.
[0100] The division unit is configured to divide the attribute values corresponding to the attribute according to the information gain to obtain a data set, and take the data set as a child node of the root node.
[0101] In the embodiment of the application, the information gain of the attribute can be calculated according to the weight sum and the information entropy of the sample set and the sample subset, which reduces the step of calculating the proportion and improves the efficiency of the decision tree training while reducing the data amount.
[0102] Please refer to Figure 3 , Figure 3 The structure block diagram of a computer device provided by the embodiment of the application includes:
[0103] The memory 10 is configured to store a computer program.
[0104] The processor 20 is configured to implement the above-mentioned decision tree training method when executing the computer program.
[0105] like Figure 3 , which is a schematic diagram of the structure of a computer device, may include: a memory 10 , a processor 20 , a communication interface 31 , an input / output interface 32 , and a communication bus 33 .
[0106] In an embodiment of the present invention, the memory 10 is used to store one or more programs. The program may include program code, and the program code includes computer operating instructions. In an embodiment of the present application, the memory 10 may store programs for implementing the following functions:
[0107] Get training data and attributes;
[0108] extracting a sample set and a sample subset from the training data according to the attributes;
[0109] Calculating the information entropy corresponding to the sample set and the sample subset respectively using an information entropy calculation formula;
[0110] Calculating the sum of the weights corresponding to the sample set and the sample subset respectively using a summation formula;
[0111] Obtaining the information gain of the attribute by calculation according to the weight sum and the information entropy;
[0112] A decision tree is constructed according to the information gain.
[0113] In one possible implementation, the memory 10 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function, etc.; the data storage area may store data created during use.
[0114] In addition, the memory 10 may include a read-only memory and a random access memory, and provides instructions and data to the processor. A portion of the memory may also include NVRAM. The memory stores an operating system and operating instructions, executable modules or data structures, or a subset or an extended set thereof. The operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and processing hardware-based tasks.
[0115] The processor 20 can be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array, or other programmable logic device. The processor 20 can be a microprocessor or any conventional processor, etc. The processor 20 can invoke a program stored in the memory 10.
[0116] The communication interface 31 can be an interface for connecting with other devices or systems.
[0117] The input / output interface 32 can be an interface for acquiring input data from the outside or outputting data to the outside.
[0118] Of course, it should be noted that, Figure 3 The structures shown do not constitute a limitation on the computer device in the embodiments of the present application. In actual applications, the computer device can include more or fewer components than those shown, or some components can be combined. Figure 3 The structures shown do not constitute a limitation on the computer device in the embodiments of the present application. In actual applications, the computer device can include more or fewer components than those shown, or some components can be combined.
[0119] In the embodiments of the present application, the information gain of the attribute can be calculated according to the weight sum and the information entropy of the sample set and the sample subset, which reduces the step of calculating the proportion and improves the efficiency of the decision tree training while reducing the data amount calculation, compared with the previous way of calculating the information gain according to the proportion.
[0120] The embodiments of the present application also provide a computer readable storage medium, which stores computer executable instructions. When the computer executable instructions are loaded and executed by a processor, the following steps are implemented: obtaining training data and an attribute; extracting a sample set and a sample subset from the training data according to the attribute; calculating information entropy corresponding to the sample set and the sample subset by using an information entropy calculation formula; calculating a weight sum corresponding to the sample set and the sample subset by using a summation formula; calculating information gain of the attribute by using the weight sum and the information entropy; and constructing a decision tree according to the information gain. In the embodiments of the present application, the information gain of the attribute can be calculated according to the weight sum and the information entropy of the sample set and the sample subset, which reduces the step of calculating the proportion and improves the efficiency of the decision tree training while reducing the data amount calculation, compared with the previous way of calculating the information gain according to the proportion.
[0121] The embodiments in the description are described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same or similar parts of each embodiment can be referred to each other. For the device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the related parts can be referred to the method part.
[0122] Those skilled in the art will further appreciate that the functions of the various examples illustrated in the several embodiments disclosed herein can be implemented using electronic hardware, computer software, or any combination thereof. To clearly illustrate this interchangeability of hardware and software, various components will be described generally in terms of their functionality, without reference to the particular
[0123] The steps of a method or algorithm described in connection with the embodiments disclosed herein can be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module can reside in Random Access Memory (RAM), non-volatile memory (NVM), or any other form of storage, such as a hard disk drive, a solid state drive, a flash drive, or a magnetic tape.
[0124] The above provides a decision tree training method, device, computer equipment and storage medium. The principle and implementation of the present application are described by applying specific examples. The above description of the embodiments is only to help understand the method and its core idea of the present application. It should be pointed out that for those skilled in the art, without departing from the principle of the present application, some improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
Claims
1. A tripartite privacy decision tree training method supporting missing values, characterized by: include: Get training data and attributes; The training data is questionnaire data obtained by an enterprise through data collection using a questionnaire. The content of the training data includes data content obtained through different participants, such as companies or educational institutions. The questionnaire data includes private data provided by users or missing values caused by users refusing to provide private data. In addition, there are no missing values in the attributes. extracting a sample set and a sample subset from the training data according to the attributes; Calculating the information entropy corresponding to the sample set and the sample subset respectively using an information entropy calculation formula; Calculating the sum of the weights corresponding to the sample set and the sample subset respectively using a summation formula; Obtaining the information gain of the attribute by calculation according to the weight sum and the information entropy; Constructing a decision tree according to the information gain; Before obtaining the training data and attributes, the method further includes: sending the training data using a replicated secret sharing technique; The extracting of the sample set and the sample subset from the training data according to the attribute includes: extracting the sample set corresponding to the attribute from the training data according to the attribute; and extracting the sample subset corresponding to the partition value from the sample set according to the partition value of the attribute; Before using the summation formula to calculate the sum of the weights corresponding to the sample set and the sample subset, the method further includes: setting the weights of the samples in the sample set and the sample subset respectively; The information gain of the attribute is obtained by calculation based on the weight sum and the information entropy, including: multiplying the weight sum of the sample set by the information entropy to obtain a first value; multiplying the weight sum of the sample subset by the information entropy to obtain a second value, adding the second values corresponding to all the sample subsets to obtain a third value; and subtracting the first value from the third value to obtain the information gain of the attribute.
2. The method for training a tripartite privacy-preserving decision tree supporting missing values according to claim 1, wherein: The step of constructing a decision tree according to the information gain includes: Rank the information gains of all said attributes; Determine the attribute corresponding to the information gain with the largest value, and use the attribute as the root node of the decision tree; According to the information gain, the attribute values corresponding to the attribute are divided to obtain a data set, and the data set is used as a child node of the root node.
3. A data processing method, characterized in that: The method for training a tripartite privacy-preserving decision tree supporting missing values according to claim 1 or 2 includes: Get data information; The trained decision tree is used to analyze and predict the data information to obtain classification results and regression results of the data information.
4. A tripartite privacy decision tree training device supporting missing values, characterized in that: include: Acquisition module, used to obtain training data and attributes; The training data is questionnaire data obtained by an enterprise through data collection using a questionnaire. The content of the training data includes data content obtained through different participants, such as companies or educational institutions. The questionnaire data includes private data provided by users or missing values caused by users refusing to provide private data. In addition, there are no missing values in the attributes. An extraction module, configured to extract a sample set and a sample subset from the training data according to the attributes; A first calculation module is used to calculate the information entropy corresponding to the sample set and the sample subset respectively using an information entropy calculation formula; A second calculation module is used to calculate the sum of weights corresponding to the sample set and the sample subset respectively using a summation formula; An information gain calculation module, configured to obtain the information gain of the attribute by calculation based on the weight sum and the information entropy; A construction module, configured to construct a decision tree according to the information gain; The three-party privacy decision tree training device supporting missing values further includes: a secret sharing module for sending the training data using a replicated secret sharing technique; The extraction module includes: a first extraction module for extracting a sample set corresponding to the attribute from the training data according to the attribute; a second extraction module for extracting a sample subset corresponding to the partition value from the sample set according to the partition value of the attribute; The tripartite privacy decision tree training device supporting missing values further includes: a setting module for setting weights of samples in the sample set and the sample subset respectively; The information gain calculation module includes: a first calculation unit, used to multiply the sum of the weights of the sample set by the information entropy to obtain a first value; a second calculation unit, used to multiply the sum of the weights of the sample subsets by the information entropy to obtain a second value, and add the second values corresponding to all the sample subsets to obtain a third value; an information gain calculation unit, used to subtract the first value from the third value to obtain the information gain of the attribute.
5. A computer device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the tripartite privacy decision tree training method supporting missing values as described in any one of claims 1 to 3 when executing the computer program.
6. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are loaded and executed by the processor, the steps of the three-party privacy decision tree training method supporting missing values as described in any one of claims 1 to 3 are implemented.