Data processing method, device and computer readable storage medium

By receiving and merging the feature statistics results of execution units, and assigning them to multiple execution units for processing, the optimal segmentation features are determined, which solves the problem of wasting computing resources caused by centralized data processing in random forest model training and improves training efficiency.

CN111488942BActive Publication Date: 2024-10-29WEBANK (CHINA)
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010297780.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-15
Publication Date
2024-10-29
Estimated Expiration
2040-04-15

AI Technical Summary

Technical Problem

During the training process of the random forest model, data processing is easily concentrated on one executor, causing other computing resources to be idle and wasting computing resources.

Method used

By receiving the feature statistical results sent by each execution unit, the feature statistical results of the same node are merged, divided into multiple sub-feature statistical results, and distributed to each execution unit, so that each execution unit determines the best cut according to the received target sub-feature statistical results. points, determine the optimal segmentation features, conduct training based on the optimal segmentation features, and distribute the data processing to multiple execution units for processing.

Benefits of technology

It effectively utilizes the computing power of multiple execution units, improves the overall training efficiency of the random forest model, avoids the waste of computing resources, and solves the problem of idle resources caused by centralized data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111488942B_ABST
    Figure CN111488942B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of financial technology (Fintech), and discloses a data processing method, which includes the following steps: receiving feature statistics sent by each execution unit; merging feature statistics of the same node to obtain the total feature statistics of the node to be trained; dividing the total feature statistics into multiple sub-feature statistics, and distributing the sub-feature statistics to each execution unit, so that each execution unit can determine the best segmentation point of each feature in the target sub-feature statistics according to the received target sub-feature statistics; receiving each best segmentation point sent by each execution unit, and determining the optimal segmentation feature of the node to be trained according to each best segmentation point, so as to train based on the optimal segmentation feature to obtain a target model. The present invention also discloses a data processing device and a computer-readable storage medium. The present invention rationally utilizes the computing power of the execution unit and improves the overall training efficiency of the random forest.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of financial technology (Fintech), and in particular to a data processing method, device and computer-readable storage medium. Background Art

[0002] With the development of computer technology, more and more technologies (big data, distributed, blockchain, artificial intelligence, etc.) are applied in the financial field. The traditional financial industry is gradually transforming to Fintech, but due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology. Random forest is a widely used machine learning technology in the financial field and a very important ensemble learning algorithm. Random forest consists of multiple decision trees, each of which is trained by extracting input data.

[0003] With the development of the Internet and information technology, the amount of data accumulated in various industries has increased significantly. The previous single-machine-based data processing methods are difficult to meet the needs of efficient big data modeling. Spark is a big data parallel computing framework, so the prior art proposes a random forest model training method based on Spark, which improves the training efficiency of random forests in big data to a certain extent and shortens the training time. However, during the training process, the data processing is easily concentrated on one executor, resulting in idleness of other computing resources, thus wasting computing resources.

[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The main purpose of the present invention is to provide a data processing method, device and computer-readable storage medium, aiming to solve the technical problem of easily concentrating the execution on one executor when processing data.

[0006] To achieve the above object, the present invention provides a data processing method, which is applied to a management unit and comprises the following steps:

[0007] Receiving feature statistics results sent by each execution unit, wherein each execution unit counts the feature distribution of its own training sample at the node to be trained to obtain the feature statistics results of the node to be trained;

[0008] Merge the feature statistics of the same nodes to obtain the total feature statistics of the nodes to be trained;

[0009] Dividing the total feature statistical result into a plurality of sub-feature statistical results, and distributing the sub-feature statistical results to each execution unit, so that each execution unit can determine the best splitting point of each feature in the target sub-feature statistical result according to the received target sub-feature statistical result;

[0010] Receive each optimal segmentation point sent by each execution unit, and determine the optimal segmentation feature of the node to be trained according to each optimal segmentation point, so as to obtain a target model through training based on the optimal segmentation feature.

[0011] Optionally, the step of dividing the total feature statistical result into a plurality of sub-feature statistical results comprises:

[0012] According to a preset feature division rule, the feature statistical results of different features in the total feature statistical results are respectively used as sub-feature statistical results; or,

[0013] According to a preset node division rule, the feature statistical results of different nodes in the total feature statistical result are respectively used as sub-feature statistical results.

[0014] Optionally, the step of merging the feature statistics of the same nodes to obtain the total feature statistics of the nodes to be trained includes:

[0015] The feature statistics of the same nodes are accumulated respectively to obtain the total feature statistics of each node to be trained.

[0016] Optionally, before the step of receiving the feature statistical results sent by each execution unit, the step further includes:

[0017] Get multiple nodes to be trained in the random forest model;

[0018] The multiple nodes to be trained are broadcasted to each execution unit.

[0019] Optionally, the step of obtaining a target model through training based on the optimal segmentation feature includes:

[0020] Splitting the nodes to be trained based on the optimal segmentation features to obtain new nodes to be trained;

[0021] Determine whether the new node to be trained meets the training stop condition;

[0022] If the new node to be trained does not meet the training stop condition, then based on the new node to be trained, the steps of: receiving the statistical results sent by each execution unit, wherein each execution unit counts the feature distribution of its own training sample at the node to be trained in its own decision tree to obtain the statistical results;

[0023] If the new node to be trained meets the training stop condition, the training of the random forest model is stopped to obtain the target model.

[0024] In addition, to achieve the above object, the present invention further provides a data processing method, which is applied to an execution unit and includes the following steps:

[0025] Count the feature distribution of the training samples at each node to be trained, and obtain the feature statistics of each node to be trained;

[0026] The feature statistical result is sent to the management unit, so that the management unit can merge the feature statistical results received from each execution unit to obtain the total feature statistical result of each node to be trained, divide the total feature statistical result into multiple sub-feature statistical results, and distribute the sub-feature statistical results to each execution unit;

[0027] Receive the target sub-feature statistical results sent by the management unit, determine the best splitting point of the target sub-feature statistical results according to the target sub-feature statistical results, and send the best splitting point to the management unit, so that the management unit can determine the optimal splitting feature corresponding to the node to be trained according to the best splitting point, so as to train the random forest model based on the optimal splitting feature to obtain the target model.

[0028] Optionally, the step of determining the best split point of the target sub-feature statistical result according to the target sub-feature statistical result comprises:

[0029] Based on the statistical results of the target sub-features, determining a plurality of preliminary segmentation points;

[0030] Calculating the characteristic coefficients of the prepared cutting points respectively;

[0031] A preliminary segmentation point whose characteristic coefficient meets a preset condition is selected from each of the preliminary segmentation points as the optimal segmentation point for the target sub-feature statistical result.

[0032] In addition, to achieve the above-mentioned purpose, the present invention also provides a data processing device, which includes: a memory, a processor, and a data processing program stored in the memory and executable on the processor, and the data processing program implements the steps of the above-mentioned data processing method when executed by the processor.

[0033] In addition, to achieve the above-mentioned purpose, the present invention also provides a data processing device, which includes: a memory, a processor, and a data processing program stored in the memory and executable on the processor, and the data processing program implements the steps of the above-mentioned data processing method when executed by the processor.

[0034] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a data processing program is stored, and when the data processing program is executed by a processor, the steps of the data processing method as described above are implemented.

[0035] The present invention receives the feature statistics sent by each execution unit, wherein each execution unit counts the feature distribution of its own training samples at the node to be trained, and obtains the feature statistics of the node to be trained; merges the feature statistics of the same node to obtain the total feature statistics of the node to be trained; divides the total feature statistics into multiple sub-feature statistics, and distributes the sub-feature statistics to each execution unit, so that each execution unit can determine the best split point of each feature in the target sub-feature statistics according to the received target sub-feature statistics; receives each best split point sent by each execution unit, and determines the optimal split feature of the node to be trained according to each best split point, so as to train and obtain the target model based on the optimal split feature. In this embodiment, the total feature statistics are distributed to multiple execution units for processing, and a large amount of processing data contained in the total feature statistics are distributed to multiple execution units for execution, so that a large amount of processing data is dispersed to multiple execution units for processing, and the computing power of the execution unit is reasonably used to improve the overall training efficiency of the random forest. Therefore, it is avoided that the processing data is easily concentrated on one executor to cause other computing resources to be idle, and the problem of wasting computing resources is solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 It is a schematic diagram of the structure of a data processing device in a hardware operating environment involved in an embodiment of the present invention;

[0037] Figure 2 FIG. 1 is a flow chart of a first embodiment of a data processing method according to the present invention.

[0038] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0039] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0040] like Figure 1 As shown, Figure 1 It is a schematic diagram of the structure of a data processing device of a hardware operating environment involved in an embodiment of the present invention.

[0041] like Figure 1As shown, the data processing device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0042] Optionally, the data processing device may also include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like.

[0043] Those skilled in the art will understand that Figure 1 The data processing device structure shown in the figure does not constitute a limitation of the data processing device, and may include more or less components than shown in the figure, or combine some components, or arrange the components differently.

[0044] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a data processing program.

[0045] exist Figure 1 In the data processing device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the data processing program stored in the memory 1005.

[0046] In this embodiment, the data processing device includes: a memory 1005, a processor 1001, and a data processing program stored in the memory 1005 and executable on the processor 1001, wherein the processor 1001 calls the data processing program stored in the memory 1005 and performs the following operations:

[0047] Receiving feature statistics results sent by each execution unit, wherein each execution unit counts the feature distribution of its own training sample at the node to be trained to obtain the feature statistics results of the node to be trained;

[0048] Merge the feature statistics of the same nodes to obtain the total feature statistics of the nodes to be trained;

[0049] Dividing the total feature statistical result into a plurality of sub-feature statistical results, and distributing the sub-feature statistical results to each execution unit, so that each execution unit can determine the best splitting point of each feature in the target sub-feature statistical result according to the received target sub-feature statistical result;

[0050] Receive each optimal segmentation point sent by each execution unit, and determine the optimal segmentation feature of the node to be trained according to each optimal segmentation point, so as to obtain a target model through training based on the optimal segmentation feature.

[0051] Further, the processor 1001 may call the data processing program stored in the memory 1005, and further perform the following operations:

[0052] According to a preset feature division rule, the feature statistical results of different features in the total feature statistical results are respectively used as sub-feature statistical results; or,

[0053] According to a preset node division rule, the feature statistical results of different nodes in the total feature statistical result are respectively used as sub-feature statistical results.

[0054] Further, the processor 1001 may call the data processing program stored in the memory 1005, and further perform the following operations:

[0055] The feature statistics of the same nodes are accumulated respectively to obtain the total feature statistics of each node to be trained.

[0056] Further, the processor 1001 may call the data processing program stored in the memory 1005, and further perform the following operations:

[0057] Get multiple nodes to be trained in the random forest model;

[0058] The multiple nodes to be trained are broadcasted to each execution unit.

[0059] Further, the processor 1001 may call the data processing program stored in the memory 1005, and further perform the following operations:

[0060] Splitting the nodes to be trained based on the optimal segmentation features to obtain new nodes to be trained;

[0061] Determine whether the new node to be trained meets the training stop condition;

[0062] If the new node to be trained does not meet the training stop condition, then based on the new node to be trained, the steps of: receiving the statistical results sent by each execution unit, wherein each execution unit counts the feature distribution of its own training sample at the node to be trained in its own decision tree to obtain the statistical results;

[0063] If the new node to be trained meets the training stop condition, the training of the random forest model is stopped to obtain the target model.

[0064] Further, the processor 1001 may call the data processing program stored in the memory 1005, and further perform the following operations:

[0065] Count the feature distribution of the training samples at each node to be trained, and obtain the feature statistics of each node to be trained;

[0066] The feature statistical result is sent to the management unit, so that the management unit can merge the feature statistical results received from each execution unit to obtain the total feature statistical result of each node to be trained, divide the total feature statistical result into multiple sub-feature statistical results, and distribute the sub-feature statistical results to each execution unit;

[0067] Receive the target sub-feature statistical results sent by the management unit, determine the best splitting point of the target sub-feature statistical results according to the target sub-feature statistical results, and send the best splitting point to the management unit, so that the management unit can determine the optimal splitting feature corresponding to the node to be trained according to the best splitting point, so as to train the random forest model based on the optimal splitting feature to obtain the target model.

[0068] Further, the processor 1001 may call the data processing program stored in the memory 1005, and further perform the following operations:

[0069] Based on the statistical results of the target sub-features, determining a plurality of preliminary segmentation points;

[0070] Calculating the characteristic coefficients of the prepared cutting points respectively;

[0071] A preliminary segmentation point whose characteristic coefficient meets a preset condition is selected from each of the preliminary segmentation points as the optimal segmentation point for the target sub-feature statistical result.

[0072] The present invention also provides a data processing method, referring to Figure 2 , Figure 2 This is a flow chart of a first embodiment of a data processing method of the present invention. The data processing method comprises the following steps:

[0073] Random forest is an extended variant of ensemble learning method, which uses decision tree as bagging (bootstrap aggregating, a model prediction combination method) base learner, and each base learner is a decision tree. In the training process of random forest model, the training data set of each tree in the random forest model is obtained by sampling with replacement; when generating training nodes, a part of features is randomly selected from all features, and then the best split point is found from the selected features.

[0074] Spark is a big data computing engine. Based on Spark, big data parallel computing can be realized to improve the efficiency of big data computing. The node roles in the Spark cluster are management and execution. The management is responsible for managing the nodes that the execution needs to work. The roles during task execution are management unit and execution unit. The machine to which the user submits the task is the management unit. After applying for computing resources through the management unit, it is allocated to multiple execution units. During the task execution process, the management unit distributes the task to each execution unit, and each execution unit runs in parallel. After the task is completed at the execution unit, the result is counted to the management unit. Therefore, Spark can process the tasks in each execution unit in parallel by efficiently utilizing the management unit. In this embodiment, Spark is used to process the tasks in each execution unit in parallel to improve the efficiency of training the random forest model.

[0075] This embodiment is applied to a model training device of a random forest model, and the model training device includes: multiple execution units and management units, etc. The random forest model includes multiple decision trees, such as a random forest model with 100 trees, and each decision tree includes multiple nodes, which are split downward from the root node. A root node can split two or more nodes, and each node can also be used as a root node to split multiple nodes downward. This tree that is continuously split downward from the root node into a tree structure is a decision tree. The random forest model in this embodiment is illustrated by taking multiple decision trees as an example.

[0076] Step S10, receiving the feature statistics results sent by each execution unit, wherein each execution unit counts the feature distribution of its own training sample at the node to be trained to obtain the feature statistics results of the node to be trained;

[0077] The nodes to be trained are a preset number of nodes being trained in each execution unit, and a preset number of nodes to be trained are obtained from all the nodes to be trained in the random forest model. The nodes to be trained include multiple nodes to be trained, and the number of nodes to be trained is generally less than the nodes to be trained in the random forest. The execution unit is a data processing unit in the model training device. The execution unit can be a network device such as a computer, including a server cluster formed by multiple execution units. Preferably, the execution unit can use cloud computing technology for information processing. The feature distribution corresponds to the training data on each node to be trained, and the feature distribution is stored in an array as a feature distribution result.

[0078] In one embodiment, during the training process of the random forest model, for multiple execution units, the management unit obtains a preset number of nodes to be trained from all the nodes to be trained in the random forest model, and distributes the nodes to be trained to all the execution units, so that each execution unit can obtain a preset number of nodes to be trained from all the nodes to be trained in the random forest model, and the number and type of nodes to be trained in each execution unit are consistent. In the random forest model, multiple decision trees contain multiple nodes to be trained, and a limited number of nodes to be trained among the multiple nodes to be trained are distributed to each execution unit for training. For the limited number of nodes to be trained, due to the limited memory of the execution unit, that is, the limited execution capacity of the execution unit, only a limited number of nodes to be trained can be trained at the same time each time. Each execution unit stores training samples for training the random forest model. When the execution unit is assigned to the training task of the node to be trained, for the preset classification problem, each execution unit counts the feature distribution of its own training samples at the node to be trained, and obtains the feature statistics of all nodes to be trained. The management unit collects the feature distribution results of each node to be trained in each execution unit, and the feature distribution results of the nodes to be trained calculated by each execution unit are sent to the management unit for the management unit to receive the feature statistical results sent by each execution unit, wherein the training samples stored in each execution unit are different, and the feature distribution may include feature distributions of multiple types of features, such as gender distribution, age distribution, etc.

[0079] For example, multiple decision trees in the random forest model contain a total of 1,000 nodes to be trained, and each execution unit can only train 101 nodes to be trained at a time. For each execution unit in all execution units, the same nodes to be trained are trained in each execution unit. For example, each execution unit obtains the 1st to 101th nodes to be trained, and each execution unit uses the training samples stored in each execution unit to count the age feature distribution and gender feature distribution of the 1st to 101th nodes to be trained for the classification problem of whether to smoke, so as to obtain the feature statistical results of the 1st to 101th nodes to be trained on the question of whether to smoke.

[0080] Step S20, merging the feature statistics of the same nodes to obtain the total feature statistics of the nodes to be trained;

[0081] In one embodiment, since the feature statistics tasks of the nodes to be trained are distributed to multiple execution units for processing, after each execution unit completes the statistics of its own feature statistics tasks, the management unit collects the feature statistics results in each execution unit, and for the same node to be trained, the management unit merges the feature statistics results of the same features in the same node, thereby obtaining the total feature statistics results. After the feature statistics tasks of the nodes to be trained are distributed to multiple execution units for processing, and the management unit performs the steps of collecting and merging, all feature statistics tasks for the nodes to be trained are completed, which improves the speed and efficiency of data processing, and can avoid the problem that the total statistics task is processed by one processor and easily causes downtime.

[0082] For example, assuming there are 10 execution units, each of which is assigned to nodes to be trained No. 1 to 101, and each node to be trained corresponds to two different feature distributions, namely age feature distribution and gender feature distribution. Then the management unit collects the feature statistics of each node from the 10 execution units, and merges the collected feature statistics of each node according to the same node and the same feature type. Then there will be total feature statistics about gender features and total feature statistics about age features based on node No. 1 to be trained. In addition to the total feature statistics of node No. 1 to be trained, it also includes the total feature statistics of nodes No. 2 to 101 to be trained.

[0083] Step S30, dividing the total feature statistical result into a plurality of sub-feature statistical results, and distributing the sub-feature statistical results to each execution unit, so that each execution unit can determine the best splitting point of each feature in the target sub-feature statistical result according to the received target sub-feature statistical result;

[0084] In one embodiment, after the management unit calculates and obtains the total feature statistical results of the node to be trained, the management unit divides the total feature statistical results of the node to be trained into multiple parts according to the preset task division rule to obtain multiple sub-feature statistical results, and uses the allocated total feature statistical results of the node to be trained as the sub-feature statistical results, and the number of the total feature statistical results of the node to be trained is consistent with the number of execution units, so that the total feature statistical results obtained by statistics are divided into multiple sub-feature statistical results. Afterwards, according to the preset allocation rule, the divided sub-feature statistical results are allocated to each execution unit, so that the divided total feature statistical results of the node to be trained are allocated to multiple execution units for execution, wherein the sub-feature statistical results can be evenly allocated to each execution unit. The management unit sends the allocated target sub-feature statistical results to each execution unit, so that each execution unit receives the sub-feature statistical results allocated by the management unit, and respectively calculates the optimal splitting points of each feature distribution in the total feature statistical results for the total feature statistical results of each node in the sub-feature statistical results, so as to calculate the optimal splitting points of each feature in the target sub-feature statistical results according to the received target sub-feature statistical results.

[0085] For example, assuming that multiple decision trees in a random forest model contain a total of 1,000 nodes to be trained, and the nodes to be trained currently are nodes 1 to 101 to be trained. If there are 10 execution units, the total feature statistics of the nodes to be trained are divided into 10 parts, and one of the total feature statistics, i.e., the sub-feature statistics, is assigned to an execution unit. Assuming that the total feature statistics of nodes 1 to 11 to be trained are assigned to an execution unit as sub-feature statistics, the execution unit receives the total feature statistics of nodes 1 to 11 to be trained, and calculates the best split point of each feature distribution corresponding to each node for each node 1 to 11. Assuming that the feature distribution of node 1 includes age distribution and gender distribution, the best age split point is calculated for the age distribution of node 1, and the best gender split point is calculated for the gender distribution of node 1. For example, the calculated best age split point may be 20 years old. Since there is only one possible split for the gender feature, the calculated best gender split point is the gender.

[0086] Step S40, receiving each optimal segmentation point sent by each execution unit, and determining the optimal segmentation feature of the node to be trained according to each optimal segmentation point, so as to obtain a target model through training based on the optimal segmentation feature.

[0087] In one embodiment, after each execution unit calculates the best split point of each feature distribution in the total feature statistics of each node to be trained, the best split point of each feature distribution of the total feature statistics is sent to the management unit. The management unit receives all the best split points sent from each execution unit, and calculates the target best split point among the best split points corresponding to each node according to the best split points corresponding to each feature distribution in each node received, and uses the target best split point as the optimal split feature, thereby obtaining the optimal split feature of each node to be trained, and each node to be trained is split according to the optimal split feature to obtain the split node of the node to be trained, thereby updating the decision tree in the random forest model, and when the training of the random forest model is completed, the target model after the training of the random forest model is completed is obtained.

[0088] The data processing method proposed in this embodiment receives feature statistical results sent by each execution unit, wherein each execution unit counts the feature distribution of its own training samples at the node to be trained to obtain the feature statistical results of the node to be trained; merges the feature statistical results of the same node to obtain the total feature statistical results of the node to be trained; divides the total feature statistical results into multiple sub-feature statistical results, and distributes the sub-feature statistical results to each execution unit, so that each execution unit can determine the best splitting point of each feature in the target sub-feature statistical results according to the received target sub-feature statistical results; receives each best splitting point sent by each execution unit, and determines the optimal splitting feature of the node to be trained according to each best splitting point, so as to obtain the target model through training based on the optimal splitting feature. In this embodiment, the total feature statistical results are distributed to multiple execution units for processing, and a large amount of processing data contained in the total feature statistical results are distributed to multiple execution units for execution, thereby dispersing a large amount of processing data to multiple execution units for processing, rationally utilizing the computing power of the execution units, and improving the overall training efficiency of the random forest. Therefore, it is avoided that the processing data is easily concentrated on one executor, resulting in other computing resources being idle, thereby solving the problem of wasting computing resources.

[0089] Based on the first embodiment, a second embodiment of the data processing method of the present invention is proposed. In this embodiment, step S30 includes:

[0090] Step a, according to a preset feature division rule, the feature statistical results of different features in the total feature statistical results are respectively used as sub-feature statistical results; or,

[0091] Step b: according to a preset node division rule, the feature statistical results of different nodes in the total feature statistical result are respectively used as sub-feature statistical results.

[0092] In one embodiment, after the management unit calculates and obtains the total feature statistical results of the node to be trained, the management unit divides the total feature statistical results of the node to be trained into multiple parts according to the preset task division rule to obtain multiple sub-feature statistical results. Specifically, the management unit can use the feature statistical results of different features in the total feature statistical results as sub-feature statistical results according to the preset feature division rule; or use the feature statistical results of different nodes in the total feature statistical results as sub-feature statistical results according to the preset node division rule.

[0093] Furthermore, in one embodiment, the step of merging the feature statistics of the same nodes to obtain the total feature statistics of the nodes to be trained includes:

[0094] Step c: accumulate the feature statistics of the same nodes respectively to obtain the total feature statistics of each node to be trained.

[0095] In one embodiment, since the feature statistics tasks of the nodes to be trained are distributed to multiple execution units for processing, after each execution unit completes the statistics of its own feature statistics tasks, the management unit collects the feature statistics results in each execution unit, and for the same node to be trained, the management unit respectively accumulates the feature statistics results of the same feature in the same node, thereby obtaining the total feature statistics results. After the feature statistics tasks of the nodes to be trained are distributed to multiple execution units for processing, and the management unit performs the steps of collecting and merging, all feature statistics tasks for the nodes to be trained are completed, which improves the rate and efficiency of data processing, and can avoid the problem that the total statistical task is processed by one processor and easily causes downtime.

[0096] Furthermore, in one embodiment, before the step of receiving the feature statistical results sent by each execution unit, the step further includes:

[0097] Step d, obtaining multiple nodes to be trained in the random forest model;

[0098] Step e: broadcast the multiple nodes to be trained to each execution unit.

[0099] In one embodiment, during the training process of the random forest model, for multiple execution units, the management unit obtains a preset number of nodes to be trained from all the nodes to be trained in the random forest model, and broadcasts the nodes to be trained to each execution unit, so that each execution unit can obtain a preset number of nodes to be trained from all the nodes to be trained in the random forest model, and the number and type of nodes to be trained in each execution unit are consistent. In the random forest model, multiple decision trees contain multiple nodes to be trained, and a limited number of nodes to be trained among the multiple nodes to be trained are assigned to each execution unit for training. For the limited number of nodes to be trained, since the memory of the execution unit is limited, that is, the execution capacity of the execution unit is limited, only a limited number of nodes to be trained can be trained at the same time each time.

[0100] Furthermore, in one embodiment, the step of training based on the optimal segmentation feature to obtain a target model includes:

[0101] Step f, segmenting the nodes to be trained based on the optimal segmentation features to obtain new nodes to be trained;

[0102] Step g, determining whether the new node to be trained meets the training stop condition;

[0103] Step h, if the new node to be trained does not meet the training stop condition, then based on the new node to be trained, the steps of: receiving the statistical results sent by each execution unit, wherein each execution unit counts the feature distribution of its own training sample at the node to be trained in its own decision tree to obtain the statistical results;

[0104] Step i: If the new node to be trained meets the training stop condition, stop training the random forest model to obtain the target model.

[0105] In one embodiment, after obtaining the optimal segmentation feature of each node to be trained, each node to be trained is split according to the optimal segmentation feature to obtain a split node of the node to be trained, and the split node is a new node to be trained. During the training of the random forest model, it is detected in real time whether the new node to be trained after the node to be trained is split meets the training stop condition. Then, after splitting the node to be trained, if the new node to be trained does not meet the training stop condition, that is, the node to be trained has not been completely split, then the optimal splitting feature is calculated for the new node to be trained to split the new node to be trained, and the following steps are continued: receiving the statistical results sent by each execution unit, wherein each execution unit counts the feature distribution of its own training samples at the node to be trained in its own decision tree to obtain the statistical results; merging the feature statistical results of the same node to obtain the total feature statistical results of the node to be trained; dividing the total feature statistical results into multiple sub-feature statistical results, and distributing the sub-feature statistical results to each execution unit, so that each execution unit can determine the best splitting point for each feature in the target sub-feature statistical results according to the received target sub-feature statistical results; receiving each best splitting point sent by each execution unit, and determining the optimal splitting feature of the node to be trained according to each best splitting point, so as to train based on the optimal splitting feature to obtain the target model.

[0106] In addition, an embodiment of the present invention further provides a data processing method, which is applied to an execution unit. In this embodiment, the data processing method includes the following steps:

[0107] Step S100, counting the feature distribution of the training samples at each node to be trained, and obtaining the feature statistics result of each node to be trained;

[0108] The nodes to be trained are a preset number of nodes being trained in each execution unit, and a preset number of nodes to be trained are obtained from all the nodes to be trained in the random forest model. The nodes to be trained include multiple nodes to be trained, and the number of nodes to be trained is generally less than the nodes to be trained in the random forest. The execution unit is a data processing unit in the model training device. The execution unit can be a network device such as a computer, including a server cluster formed by multiple execution units. Preferably, the execution unit can use cloud computing technology for information processing. The feature distribution corresponds to the training data on each node to be trained, and the feature distribution is stored in an array as a feature distribution result.

[0109] In one embodiment, during the training process of the random forest model, for multiple execution units, the management unit obtains a preset number of nodes to be trained from all the nodes to be trained in the random forest model, and distributes the nodes to be trained to all the execution units, so that each execution unit can obtain a preset number of nodes to be trained from all the nodes to be trained in the random forest model, and the number and type of nodes to be trained in each execution unit are consistent. In the random forest model, multiple decision trees contain multiple nodes to be trained, and a limited number of nodes to be trained among the multiple nodes to be trained are distributed to each execution unit for training. For the limited number of nodes to be trained, due to the limited memory of the execution unit, that is, the limited execution capacity of the execution unit, only a limited number of nodes to be trained can be trained at the same time each time. Each execution unit stores training samples for training the random forest model. When the execution unit is assigned to the training task of the node to be trained, for the preset classification problem, each execution unit counts the feature distribution of its own training samples at the node to be trained, and obtains the feature statistics of all nodes to be trained. The management unit collects the feature distribution results of each node to be trained in each execution unit, and the feature distribution results of the nodes to be trained calculated by each execution unit are sent to the management unit for the management unit to receive the feature statistical results sent by each execution unit, wherein the training samples stored in each execution unit are different, and the feature distribution may include feature distributions of multiple types of features, such as gender distribution, age distribution, etc.

[0110] For example, multiple decision trees in the random forest model contain a total of 1,000 nodes to be trained, and each execution unit can only train 101 nodes to be trained at a time. For each execution unit in all execution units, the same nodes to be trained are trained in each execution unit. For example, each execution unit obtains the 1st to 101th nodes to be trained, and each execution unit uses the training samples stored in each execution unit to count the age feature distribution and gender feature distribution of the 1st to 101th nodes to be trained for the classification problem of whether to smoke, so as to obtain the feature statistical results of the 1st to 101th nodes to be trained on the question of whether to smoke.

[0111] Step S200, sending the feature statistical result to the management unit, so that the management unit merges the feature statistical results received from each execution unit to obtain the total feature statistical result of each node to be trained, divides the total feature statistical result into multiple sub-feature statistical results, and distributes the sub-feature statistical results to each execution unit;

[0112] In one embodiment, since the feature statistics tasks of the nodes to be trained are distributed to multiple execution units for processing, after each execution unit completes the statistics of its own feature statistics tasks, the management unit collects the feature statistics results in each execution unit, and for the same node to be trained, the management unit merges the feature statistics results of the same features in the same node, thereby obtaining the total feature statistics results. After the feature statistics tasks of the nodes to be trained are distributed to multiple execution units for processing, and the management unit performs the steps of collecting and merging, all feature statistics tasks for the nodes to be trained are completed, which improves the speed and efficiency of data processing, and can avoid the problem that the total statistics task is processed by one processor and easily causes downtime.

[0113] For example, assuming there are 10 execution units, each of which is assigned to nodes to be trained No. 1 to 101, and each node to be trained corresponds to two different feature distributions, namely age feature distribution and gender feature distribution. Then the management unit collects the feature statistics of each node from the 10 execution units, and merges the collected feature statistics of each node according to the same node and the same feature type. Then there will be total feature statistics about gender features and total feature statistics about age features based on node No. 1 to be trained. In addition to the total feature statistics of node No. 1 to be trained, it also includes the total feature statistics of nodes No. 2 to 101 to be trained.

[0114] After the management unit calculates and obtains the total feature statistical results of the node to be trained, the management unit divides the total feature statistical results of the node to be trained into multiple parts according to the preset task division rules to obtain multiple sub-feature statistical results, and uses the allocated total feature statistical results of the node to be trained as the sub-feature statistical results, and the number of the total feature statistical results of the node to be trained is consistent with the number of execution units, so that the total feature statistical results obtained by statistics are divided into multiple sub-feature statistical results. Afterwards, according to the preset allocation rule, the divided sub-feature statistical results are allocated to each execution unit, so that the divided total feature statistical results of the node to be trained are allocated to multiple execution units for execution, wherein the sub-feature statistical results can be evenly allocated to each execution unit. The management unit sends the allocated target sub-feature statistical results to each execution unit so that each execution unit receives the sub-feature statistical results allocated by the management unit, and respectively calculates the optimal splitting points of each feature distribution in the total feature statistical results for the total feature statistical results of each node in the sub-feature statistical results, so as to calculate the optimal splitting points of each feature in the target sub-feature statistical results according to the received target sub-feature statistical results.

[0115] For example, assuming that multiple decision trees in a random forest model contain a total of 1,000 nodes to be trained, and the nodes to be trained currently are nodes 1 to 101 to be trained. If there are 10 execution units, the total feature statistics of the nodes to be trained are divided into 10 parts, and one of the total feature statistics, i.e., the sub-feature statistics, is assigned to an execution unit. Assuming that the total feature statistics of nodes 1 to 11 to be trained are assigned to an execution unit as sub-feature statistics, the execution unit receives the total feature statistics of nodes 1 to 11 to be trained, and calculates the best split point of each feature distribution corresponding to each node for each node 1 to 11. Assuming that the feature distribution of node 1 includes age distribution and gender distribution, the best age split point is calculated for the age distribution of node 1, and the best gender split point is calculated for the gender distribution of node 1. For example, the calculated best age split point may be 20 years old. Since there is only one possible split for the gender feature, the calculated best gender split point is the gender.

[0116] Step S300, receiving the target sub-feature statistical results sent by the management unit, and determining the optimal splitting point of the target sub-feature statistical results based on the target sub-feature statistical results, and sending the optimal splitting point to the management unit, so that the management unit can determine the optimal splitting feature corresponding to the node to be trained based on the optimal splitting point, so as to train the random forest model based on the optimal splitting feature to obtain the target model.

[0117] In one embodiment, after each execution unit calculates the best split point of each feature distribution in the total feature statistics of each node to be trained, the best split point of each feature distribution in the total feature statistics is sent to the management unit. The management unit receives all the best split points sent from each execution unit, and calculates the target best split point among the best split points corresponding to each node according to the best split points corresponding to each feature distribution in each node received, and uses the target best split point as the optimal split feature, thereby obtaining the optimal split feature of each node to be trained, wherein each node to be trained is split according to the optimal split feature to obtain the split node of the node to be trained.

[0118] Furthermore, in one embodiment, the step of determining the best segmentation point of the target sub-feature statistical result according to the target sub-feature statistical result includes:

[0119] Step j, determining a plurality of preliminary segmentation points based on the statistical results of the target sub-features;

[0120] Step k, respectively calculating the characteristic coefficients of the prepared segmentation points;

[0121] Step 1: Selecting a preliminary segmentation point whose characteristic coefficient meets a preset condition from each of the preliminary segmentation points as the optimal segmentation point for the target sub-feature statistical result.

[0122] In one embodiment, each execution unit determines the preliminary segmentation point of each feature distribution in the target sub-feature statistical result based on the received target sub-feature statistical result, such as the preliminary segmentation point of the gender feature distribution is gender, and the preliminary segmentation point of the age feature distribution is 5 years old, 7 years old, 19 years old, 23 years old, etc. Then, the feature coefficient corresponding to each feature distribution is calculated to calculate the feature coefficient of each preliminary segmentation point.

[0123] Each execution unit compares multiple characteristic coefficients based on multiple characteristic coefficients to select a preliminary cutting point whose characteristic coefficient meets the preset conditions from each preliminary cutting point as the best cutting point of the target sub-feature statistical result. Finding the best cutting point of the sub-feature statistical result is divided into two steps. First, find the characteristic coefficient of a certain characteristic distribution, and then compare the characteristic coefficients in all characteristic distributions horizontally, so as to find the best cutting point according to the characteristic coefficient. For example, first find the characteristic coefficient of the gender characteristic distribution. Because there are only two physiological sexes, there is only one cutting method, which is to separate men and women. The corresponding Gini coefficient can be calculated as 0.1244; for the age characteristic distribution, if the alternative cutting points include [less than or equal to 5 years old, greater than 5 years old], [less than or equal to 7 years old, greater than 7 years old], [less than or equal to 19 years old, greater than 19 years old], [less than or equal to 23 years old, greater than 23 years old], that is, the cutting points include 5 years old, 7 years old, 19 years old and 23 years old, and their corresponding Gini coefficients are 0.4828, 0.4969, 0.4952, and 0.4938 respectively. Then the best split point for the age feature distribution is 5 years old, and its Gini coefficient is 0.4828. After finding the characteristic coefficient corresponding to the characteristic distribution of the sub-feature statistical result, compare the characteristic coefficient of the gender feature distribution with the characteristic coefficient of the age feature distribution to obtain the best split point for the target sub-feature statistical result.

[0124] The data processing method proposed in this embodiment obtains feature statistical results of each node to be trained by statistically analyzing the feature distribution of training samples at each node to be trained; sends the feature statistical results to a management unit so that the management unit can merge the feature statistical results received from each execution unit to obtain a total feature statistical result of each node to be trained, divide the total feature statistical result into multiple sub-feature statistical results, and distribute the sub-feature statistical results to each execution unit; receives the target sub-feature statistical results sent by the management unit, and determines the best splitting point of the target sub-feature statistical results according to the target sub-feature statistical results, and sends the best splitting point to the management unit so that the management unit can determine the optimal splitting feature corresponding to the node to be trained according to the best splitting point, so as to train the random forest model based on the optimal splitting feature to obtain the target model. In this embodiment, the total feature statistical results are distributed to multiple execution units for processing, and a large amount of processing data contained in the total feature statistical results are distributed to multiple execution units for execution, thereby dispersing a large amount of processing data to multiple execution units for processing, rationally utilizing the computing power of the execution units, and improving the overall training efficiency of the random forest. Therefore, it is avoided that the processing data is easily concentrated on one executor, resulting in other computing resources being idle, thereby solving the problem of wasting computing resources.

[0125] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a data processing program is stored. When the data processing program is executed by a processor, the steps of the data processing method as described in any one of the above are implemented.

[0126] The specific embodiments of the computer-readable storage medium of the present invention are basically the same as the embodiments of the above-mentioned data processing method, and will not be described in detail here.

[0127] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0128] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0129] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0130] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A data processing method, characterized in that: The data processing method is applied to a management unit, and the data processing method comprises the following steps: Receiving feature statistics results sent by each execution unit, wherein each execution unit counts the feature distribution of its own training sample at the node to be trained to obtain the feature statistics results of the node to be trained; Accumulate the feature statistics of the same nodes respectively to obtain the total feature statistics of each node to be trained; Dividing the total feature statistical result into a plurality of sub-feature statistical results, and distributing the sub-feature statistical results to each execution unit, so that each execution unit can determine the best splitting point of each feature in the target sub-feature statistical result according to the received target sub-feature statistical result; The step of dividing the total feature statistical result into a plurality of sub-feature statistical results and distributing the sub-feature statistical results to each execution unit so that each execution unit can determine the optimal splitting point of each feature in the target sub-feature statistical result according to the received target sub-feature statistical result includes: According to the preset task division rule, the total feature statistical result of the node to be trained is divided into multiple parts to obtain multiple sub-feature statistical results, and the allocated total feature statistical result of the node to be trained is used as the sub-feature statistical result, and the number of the total feature statistical result of the node to be trained is consistent with the number of the execution units, so that the total feature statistical result obtained by statistics is divided into multiple sub-feature statistical results; According to a preset allocation rule, the divided sub-feature statistical results are allocated to each of the execution units, so as to allocate the divided total feature statistical results of the nodes to be trained to the multiple execution units for execution; Sending the allocated target sub-feature statistical results to each of the execution units, so that each of the execution units receives the allocated sub-feature statistical results, and respectively calculating the optimal splitting point of each feature distribution in the total feature statistical results for the total feature statistical results of each node in the sub-feature statistical results; Receive each optimal segmentation point sent by each execution unit, and determine the optimal segmentation feature of the node to be trained according to each optimal segmentation point, so as to obtain a target model through training based on the optimal segmentation feature.

2. The data processing method according to claim 1, characterized in that: The step of dividing the total feature statistical result into a plurality of sub-feature statistical results comprises: According to a preset feature division rule, the feature statistical results of different features in the total feature statistical results are respectively used as sub-feature statistical results; or, According to a preset node division rule, the feature statistical results of different nodes in the total feature statistical result are respectively used as sub-feature statistical results.

3. The data processing method according to claim 1, characterized in that: Before the step of receiving the characteristic statistical results sent by each execution unit, the method further includes: Get multiple nodes to be trained in the random forest model; The multiple nodes to be trained are broadcasted to each execution unit.

4. The data processing method according to claim 1, characterized in that: The step of obtaining a target model by training based on the optimal segmentation feature comprises: Splitting the nodes to be trained based on the optimal segmentation features to obtain new nodes to be trained; Determine whether the new node to be trained meets the training stop condition; If the new node to be trained does not meet the training stop condition, then based on the new node to be trained, the steps of: receiving the statistical results sent by each execution unit, wherein each execution unit counts the feature distribution of its own training sample at the node to be trained in its own decision tree to obtain the statistical results; If the new node to be trained meets the training stop condition, the training of the random forest model is stopped to obtain the target model.

5. A data processing method, characterized in that: The data processing method is applied to an execution unit, and the data processing method comprises the following steps: Count the feature distribution of the training samples at each node to be trained, and obtain the feature statistics of each node to be trained; The feature statistical results are sent to a management unit so that the management unit can accumulate the feature statistical results of the same node respectively to obtain the total feature statistical results of each node to be trained. The management unit divides the total feature statistical results of the node to be trained into multiple parts according to a preset task division rule to obtain multiple sub-feature statistical results, and uses the allocated total feature statistical results of the node to be trained as the sub-feature statistical results. The number of copies of the total feature statistical results of the node to be trained is consistent with the number of the execution units, so that the total feature statistical results obtained by statistics are divided into multiple sub-feature statistical results; According to a preset allocation rule, the divided sub-feature statistical results are allocated to each of the execution units, so as to allocate the divided total feature statistical results of the nodes to be trained to the multiple execution units for execution; The management unit sends the assigned target sub-feature statistical results to each of the execution units, so that each of the execution units receives the sub-feature statistical results assigned by the management unit, and respectively calculates the optimal splitting points of each feature distribution in the total feature statistical results for the total feature statistical results of each node in the sub-feature statistical results, and sends the optimal splitting points to the management unit, so that the management unit determines the optimal splitting features corresponding to the nodes to be trained according to the optimal splitting points, so as to train the random forest model based on the optimal splitting features to obtain the target model.

6. The data processing method according to claim 5, characterized in that: The step of determining the best segmentation point of the target sub-feature statistical result according to the target sub-feature statistical result comprises: Based on the statistical results of the target sub-features, determining a plurality of preliminary segmentation points; Calculating the characteristic coefficients of the prepared cutting points respectively; A preliminary segmentation point whose characteristic coefficient meets a preset condition is selected from each of the preliminary segmentation points as the optimal segmentation point for the target sub-feature statistical result.

7. A data processing device, characterized in that: The data processing device comprises: a memory, a processor, and a data processing program stored in the memory and executable on the processor, wherein the data processing program implements the steps of the data processing method according to any one of claims 1 to 4 when executed by the processor.

8. A data processing device, characterized in that: The data processing device comprises: a memory, a processor, and a data processing program stored in the memory and executable on the processor, wherein the data processing program implements the steps of the data processing method according to any one of claims 5 to 6 when executed by the processor.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a data processing program, and when the data processing program is executed by a processor, the steps of the data processing method according to any one of claims 1 to 4 or 5 to 6 are implemented.

Citation Information

Patent Citations

  • Decision tree model training method and system, storage medium and prediction method

    CN110728317A