A report generation method based on random forest model and related equipment

Through the report generation method based on the random forest model, the problems of low report generation efficiency and poor accuracy in the financial industry are solved, and efficient and accurate report generation is achieved in a variety of businesses and massive data environments.

CN113901770BActive Publication Date: 2024-10-29CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111275770.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-29
Publication Date
2024-10-29
Estimated Expiration
2041-10-29

AI Technical Summary

Technical Problem

In the financial industry, when faced with multiple businesses and massive amounts of data, report production is inefficient and error-prone, and it is difficult to quickly generate accurate reports with existing technology.

Method used

The report generation method based on the random forest model is adopted. By receiving the report generation instructions and inputting the field set into the target random forest model, the path set and the decision tree model are determined, the correct field data is obtained and the report is generated to improve accuracy and efficiency.

Benefits of technology

In a variety of business and massive data environments, it improves the accuracy and efficiency of report generation, avoids users from obtaining wrong field data, and simplifies the report generation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113901770B_ABST
    Figure CN113901770B_ABST
Patent Text Reader

Abstract

The embodiment of the present application is applied to the field of artificial intelligence, and discloses a report generation method based on a random forest model and related equipment, including: receiving a report generation instruction carrying a first field set, inputting the first field set into a target random forest model; determining a path set including the first field set in the target random forest model when it is determined that the fields included in the first field set can generate a report; receiving a selection instruction indicating the first path in the path set; determining that the fields corresponding to each node included in the first path are a second field set; and generating a first report based on each field in the second field set and the data corresponding to each field obtained. By adopting the embodiment of the present application, reports can be quickly generated in the face of a variety of different businesses and massive data, which improves the accuracy and efficiency of generating reports. The present application involves blockchain technology, and the above-mentioned reports / data can be stored in the blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a report generation method based on a random forest model and related equipment. Background Art

[0002] With the development of information technology, all walks of life are accelerating the process of electronicization. For example, in the financial industry, the progress of electronic technology represents the symbol of the comprehensive strength and future prospects of enterprises. The amount of data generated by electronicization is large and complex. For enterprises, each time a report is made, it takes a lot of time and manpower, which is inefficient. Especially when the business of the enterprise changes, the indicators required for statistical production are also constantly changing.

[0003] At present, in enterprises, a set of report templates are usually designed for a certain business. When using the report template, the report maker searches for the data of the statistical indicators required for report making, and then fills in the report template to obtain the report. However, this method requires the report maker to manually obtain the data of the desired statistical indicators and then fill in the report template. Faced with the complex business and massive data of the enterprise, the efficiency of report making is low and prone to errors.

[0004] Therefore, how to quickly generate reports for multiple businesses and massive amounts of data is a technical problem that needs to be solved urgently. Summary of the invention

[0005] The embodiment of the present application provides a report generation method and related equipment based on a random forest model. By judging the field set included in the report generation instruction, it can prevent users from obtaining data corresponding to erroneous report fields when facing various businesses and massive data, thereby improving the accuracy and efficiency of report generation.

[0006] In a first aspect, an embodiment of the present application provides a report generation method based on a random forest model, comprising:

[0007] receiving a report generation instruction, the report generation instruction carrying a first field set, and inputting the first field set into a target random forest model;

[0008] In the case where it is determined through the target random forest model that the fields included in the first field set can generate a report, determining a path set in the target random forest model that includes the first field set;

[0009] Receive a selection instruction, the selection instruction carries a path identifier, the path identifier is used to indicate a first path in the path set, the first path is a path of a decision tree model in the target random forest model, and the first path includes a root node to a target leaf node of the decision tree model;

[0010] Determine that the fields corresponding to the nodes in the first path are the second field set;

[0011] The data corresponding to each field in the second field set is obtained, and a first report is generated according to each field in the second field set and the data corresponding to each field.

[0012] Furthermore, before inputting each field in the first field set into the target random forest model, the method further includes:

[0013] Obtaining fields in a historical report set, and determining a third field set based on the fields in the historical report set;

[0014] Randomly select N fields from the third field set, and use the selected N fields to form training samples to obtain a first training sample set, where N is an integer greater than 1;

[0015] In the case where it is determined that the second report includes the N fields of the first training sample, the first training sample is determined as a positive sample; in the case where it is determined that the second report does not include the N fields of the first training sample, the first training sample is determined as a negative sample;

[0016] The second report is any report in the historical report set, and the first training sample is any training sample in the first training sample set.

[0017] Furthermore, before inputting each field in the first field set into the target random forest model, the method further includes:

[0018] Determine a first number of positive samples and a first number of negative samples that include the first field in the first training sample set, determine a first total number of training samples that include the first field in the first training sample set, determine a second number of positive samples and a second number of negative samples that do not include the first field in the first training sample set, and determine a second total number of training samples that do not include the first field in the first training sample set, where the first field is any field in the third field set;

[0019] The first total number of training samples is the sum of the first number of positive samples and the first number of negative samples, and the second total number of training samples is the sum of the second number of positive samples and the second number of negative samples.

[0020] Determine a first ratio of the first number of positive samples to the first total number of training samples, determine a second ratio of the first number of negative samples to the first total number of training samples, determine a third ratio of the second number of positive samples to the second total number of training samples, and determine a fourth ratio of the second number of negative samples to the second total number of training samples;

[0021] According to the first ratio, the second ratio, the third ratio and the fourth ratio, the first Gini coefficient of the first field is determined, and according to the first Gini coefficients of each first field in the first training sample set and the third field set, a first decision tree model is constructed.

[0022] Furthermore, after constructing the first decision tree model according to the first Gini coefficient of each first field in the third field set, the method further includes:

[0023] Randomly select M fields from the third field set, and use the selected M fields to form training samples to obtain a second training sample set, where M is an integer greater than 1;

[0024] Determine the second Gini coefficient of each field in the third field set, and construct a second decision tree model based on the second training sample set and the second Gini coefficient of each field in the third field set;

[0025] The first decision tree model and the second decision tree model are combined to obtain a target random forest model.

[0026] Furthermore, before inputting the first field set into the target random forest model, the method further includes:

[0027] Determine the path from the root node to each leaf node of each decision tree model in the target random forest model to obtain multiple paths;

[0028] Determine the fields of each node of the second path among the plurality of paths to obtain a fourth field set, and obtain a third report including all fields of the fourth field set from the historical report set, wherein the second path is any one of the plurality of paths;

[0029] Determine a data processing method for the third report, the data processing method including a calculation method between data corresponding to each field in the fourth field set and a report configuration template, and store the data processing method in correspondence with the second path.

[0030] Furthermore, the report configuration template includes a chart identifier, and the first report is generated according to each field in the second field set and the data corresponding to each field, including:

[0031] Obtaining the stored reference data processing method corresponding to the first path, and calculating the data corresponding to each field in the second field set according to the reference processing method to obtain a calculation result;

[0032] Obtaining a reference chart configuration method corresponding to the chart identifier included in the reference data processing method, and generating a target chart according to the reference chart configuration method, each field in the second field set, data corresponding to each field in the second field set, and the calculation result;

[0033] The data corresponding to each field in the second field set, the calculation results and the target chart are filled into the report configuration template of the reference data processing method to obtain the first report.

[0034] Furthermore, the reference chart configuration method includes preset field items and reference chart styles, and the calculation results include data results and newly added fields corresponding to the data results;

[0035] The method of configuring the reference chart, the fields in the second field set, the data corresponding to the fields in the second field set and the calculation result are used to generate the target chart, including:

[0036] Determine data for generating the target chart according to the preset field items, and determine horizontal and vertical axis information and icon title information according to the preset field items and each field in the second field set, wherein the preset field items are used to indicate multiple fields in the second field set and the newly added fields;

[0037] An initial chart is generated according to the style of the reference chart and the data corresponding to the preset field items, and the target chart is composed according to the initial chart, the horizontal and vertical axis information and the title information.

[0038] In a second aspect, an embodiment of the present application provides a report generation device based on a random forest model, comprising:

[0039] A receiving unit, configured to receive a report generation instruction, the report generation instruction carrying a first field set, and input the first field set into a target random forest model;

[0040] a determination unit, configured to determine a path set including the first field set in the target random forest model when it is determined through the target random forest model that the fields included in the first field set can generate a report;

[0041] The receiving unit is further used to receive a selection instruction, the selection instruction carries a path identifier, the path identifier is used to indicate a first path in the path set, the first path is a path of a decision tree model in the target random forest model, and the first path includes a root node to a target leaf node of the decision tree model;

[0042] The determination unit is further configured to determine that the fields corresponding to the nodes in the first path are the second field set;

[0043] The acquisition unit is used to acquire data corresponding to each field in the second field set, and generate a first report according to each field in the second field set and the data corresponding to each field.

[0044] In addition, in this aspect, other optional implementations of the report generation device based on the random forest model can refer to the relevant content of the first aspect mentioned above, which will not be described in detail here.

[0045] In a third aspect, an embodiment of the present application provides a computer device, which includes a memory, a processor, and a transceiver; the processor is connected to the memory and the transceiver, respectively, wherein the memory stores a computer program code, and the processor and the transceiver are used to call the program code to execute the method provided by the first aspect and / or any possible implementation of the first aspect.

[0046] In a fourth aspect, an embodiment provides a computer-readable storage medium storing a computer program, which, when executed by a computer device, implements a product recommendation method based on a convolutional neural network as disclosed in any possible implementation of the first aspect.

[0047] In an embodiment of the present application, the first field set input by the user is judged by the target random forest model to determine whether the first field set can generate a report, thereby preventing the user from obtaining data of fields that are not included in the report to be generated, and improving the accuracy of the user obtaining data of fields in various businesses and massive data; and by determining the path set including the first field set in the target random forest model, each path included in the path set includes the first field set, and after the user inputs incomplete report fields, a variety of reports that can be generated can be output without the user having to search for the remaining fields, so that the user can select one or more reports, and then obtain the data corresponding to each node (i.e., field) on the corresponding path, and generate a report. Thus, the dimension of the field is accurate, the accuracy of report making is improved, and the efficiency of user report making is also improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0049] Figure 1 It is a structural diagram of a report generation system based on a random forest model provided in an embodiment of the present application;

[0050] Figure 2 It is a flowchart of a report generation method based on a random forest model provided in an embodiment of the present application;

[0051] Figure 3 This is another flowchart of a report generation method based on a random forest model provided in an embodiment of the present application;

[0052] Figure 4 It is a structural schematic diagram of a report generation device based on a random forest model provided in an embodiment of the present application;

[0053] Figure 5 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0055] The following is combined with Figure 1 -Attached Figure 3 A report generation method based on a random forest model provided in an embodiment of the present application is schematically illustrated.

[0056] A report generation method based on a random forest model provided in an embodiment of the present application can be applied to a report generation platform, which can be carried in a report generation system based on a random forest model or a report generation application based on a random forest model. In some embodiments, the above-mentioned report generation platform refers to a platform that can receive fields input by users and generate reports based on the fields. The report generation platform can be connected to the database of the enterprise, and can obtain data corresponding to each field required for generating reports, and then generate reports based on the acquired data and each field required for generating reports. Among them, the user is a user of the above-mentioned report generation platform, and the field input by the user can be a statistical indicator required for generating reports. In some embodiments, the above-mentioned report generation platform can establish a communication connection with the user's terminal device, and can also establish a communication connection with the database of the enterprise. The above-mentioned communication connection method may include but is not limited to wireless communication technology (Wireless Fidelity, WIFI), Bluetooth, near field communication (Near Field Communication, NFC), etc.

[0057] Specifically, the report generation platform can receive a report generation instruction, which carries a first field set input by a user, and inputs the field set into a target random forest model. When the target random forest model determines that the first field set can generate a report, the field input by the user is confirmed to be correct, which can prevent the user from obtaining data of the wrong field when facing a variety of different businesses and a large amount of data in the enterprise, thereby generating an incorrect report, which is conducive to obtaining the accuracy and efficiency of the report statistical indicators. The report generation platform can determine the path set including the first field set in the target random forest model, and output the fields included in the various reports that can be generated by the first field set; further, the report generation platform can receive a selection instruction carrying a path identifier input by the user, and the path identifier is used to indicate a path in the path set. The report generation platform can determine the path from the root node to the target leaf node indicated by the path identifier, and determine that the fields corresponding to each node of the path are the second field set, and then the report generation platform obtains the data corresponding to each field in the second field set from the database, and generates a report according to each field and the corresponding data. It can be seen that in this way, a report can be generated according to the fields included in the report selected by the user, which makes it more convenient for the user to generate various different reports and improves the efficiency of report generation.

[0058] The product recommendation method based on convolutional neural network proposed in the embodiment of the present application involves artificial intelligence, machine learning and other technologies, among which: Artificial Intelligence (AI) is the theory, method, technology and application system of using digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. Basic artificial intelligence technologies generally include technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology and machine learning / deep learning and other major directions. Machine learning is a multidisciplinary cross-disciplinary major that covers probability theory knowledge, statistical knowledge, approximate theoretical knowledge and complex algorithm knowledge. It uses computers as tools and is committed to simulating human learning methods in real time, and divides existing content into knowledge structures to effectively improve learning efficiency.

[0059] Based on the above description, Figure 1 A report generation system based on a random forest model provided in an embodiment of the present application is schematically described.

[0060] See also Figure 1 , Figure 1 It is a structural diagram of a report generation system based on a random forest model provided in an embodiment of the present application. The above-mentioned report generation system based on a random forest model includes: a report generation platform 101, one or more terminal devices (such as terminal device 102), one or more training devices (such as training device 103) and a database 104. Among them, the report generation platform 101 can be directly or indirectly connected to one or more terminal devices (such as terminal device 102), one or more training devices (such as training device 103) and the database 104 through wired or wireless means. Optionally, the database 104 can be an internal database system of the enterprise, and the database 104 can be directly or indirectly connected to one or more terminal devices (such as terminal device 102) through wired or wireless means.

[0061] It should be noted that Figure 1The number and form of devices shown are for example only and do not constitute a limitation on the embodiments of the present application. In practical applications, the report generation system based on the random forest model may also include one or more terminal devices, or one or more report generation platforms, or two training devices, or multiple databases. Among them, the report generation platform 101 can be used for training models, that is, the report generation platform can be the same device as the training device 103. The embodiments of the present application are explained by taking a terminal device (terminal device 102), a database 104, and the training device 103 and the report generation platform 101 as the same device as an example.

[0062] Among them, the terminal device 102 is a terminal device used by the user, which can send a report generation instruction to the report generation platform 101, and then interact with the report generation platform 101, so that the report generation platform 101 can determine the fields required for generating a report according to the user's instructions, and obtain the data corresponding to each field required for generating a report from the database 104, and the report generation platform 101 can generate a report according to the acquired data and each field. Among them, the database 104 can store the fields and the corresponding data. Optionally, if the report generation platform 101 is a platform for generating reports of various different businesses in an enterprise, the database 104 is a database in the enterprise, which can be built in the server of the enterprise, and the report generation platform 101 can be directly or indirectly connected to the server of the enterprise by wired or wireless means. Optionally, the task generation platform 101 can also be integrated in the server of the industry enterprise. Then in the report generation system based on the random forest model, the task generation platform 101 can be the same device as the training device 103 and the database 104.

[0063] Specifically, when a user wants to make a report, the report generation instruction can be input to the report generation platform 101 through the terminal device 102. The report generation instruction can carry the first field set input by the user. The first field set is the field included in a report that the user wants to make, which can be part of the fields of the report. Then, the report generation platform 101 can determine whether the fields included in the first field set can generate a report through the target random forest, thereby avoiding the user from obtaining the data corresponding to the wrong field and improving the accuracy of report production. In the case where the first field set is determined to generate a report through the target random forest model, the path set including the first field set in the target random forest model is determined. Each path of the target random forest model is a field set, corresponding to a report that can be generated. Then, after the report generation platform 101 receives the selection instruction carrying the path identifier input by the user, it can determine the root node to the target leaf node of the path. Each node on the path corresponds to a field respectively. Then, the report generation platform 101 can obtain the data corresponding to each node on the path respectively, and generate a report according to each field and the corresponding data. Thereby, it is convenient for users to make reports and improves the efficiency and accuracy of generating reports.

[0064] The target random forest model used by the report generation platform 101 to determine whether the fields included in the first field set can generate a report may be trained or constructed through the training device 103 .

[0065] The report generation platform 101, the terminal device 102, and the training device 103 can all be smart phones, tablet computers, laptop computers, desktop computers, smart speakers, smart watches, etc. Optionally, the report generation platform 101 and the training device 103 can also be servers, such as independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, etc. This application does not limit this.

[0066] The following is a detailed description of a report generation method based on a random forest model provided in an embodiment of the present application. Figure 2 , Figure 2 is a flow chart of a report generation method based on a random forest model provided in an embodiment of the present application. Figure 2 As shown, the report generation method based on the random forest model may include:

[0067] 201. Receive a report generation instruction, where the report generation instruction carries a first field set, and input the first field set into a target random forest model.

[0068] In an embodiment of the present application, when a user wants to make a report, the report generation platform can output a report generation page in the user's terminal device, and the user can select the fields of the report to be made in the report generation page through the terminal device and trigger the report generation instruction. Among them, the field can be understood as a statistical indicator for generating a report. Specifically, the report generation platform can send a display instruction to the user's terminal device, and the display instruction is used to instruct the terminal device to display the report generation page. The report generation page may include multiple fields, each field is a statistical indicator, and the user can select some or all of the fields corresponding to the report to be generated, and then generate a report generation instruction. The report generation instruction carries the fields selected by the user, that is, the first field set, and then the user's terminal device can send the report generation instruction carrying the first field set to the report generation platform.

[0069] Furthermore, after receiving the report generation instruction, the report generation platform can input the first field set carried by the report generation instruction into the target random forest model, and determine whether a report can be generated based on the first field set through the target random forest model. Among them, the first field set is the fields selected by the user. The target random forest model is a random forest model pre-trained by a training device. The so-called random forest model refers to a model composed of multiple decision tree models. The decision tree model is a classifier model, that is, a random forest is a classifier model that trains and predicts samples through multiple decision tree models, which can be used to solve classification problems. For example, in an embodiment of the present application, the target random forest model can be used to determine whether each field in the first field set can generate a report.

[0070] Among them, the target random forest model may include multiple decision tree models, and the multiple decision tree models are constructed by using fields that can generate reports as positive samples and fields that cannot generate reports as negative samples. The nodes included in the partial paths included in each decision tree model in the constructed multiple decision tree models can represent fields that can generate reports. It can be understood that the nodes included in the partial paths included in the decision tree model can also represent fields that cannot generate reports. The report generation platform can then determine whether the fields included in the first field set can generate reports through the target random forest model. This can prevent users from obtaining wrong fields to make reports from the company's numerous businesses and massive data, thereby ensuring the accuracy of report making.

[0071] 202. When it is determined through the target random forest model that the fields included in the first field set can generate a report, determine a path set in the target random forest model that includes the first field set.

[0072] In a possible implementation, the report generation platform may input each field in the first field set into the target random forest model to obtain the classification result output by the target random forest model, that is, the target random forest model may output a classification result for distinguishing whether a report can be generated or not. If the target random forest determines that a report can be generated according to the fields included in the first field set, the report generation platform may generate a report according to the first field set.

[0073] Specifically, the target random forest model includes multiple decision tree models, and the report generation platform inputs each field in the first field set into the target random forest model, that is, each field in the first field set is input into each decision tree model in the target random forest. Through each decision tree model in the target random forest model, it is classified and judged whether the first field set can generate a report.

[0074] Optionally, if the classification results output by most decision tree models in the target random forest model are all capable of generating reports, then the classification results output by the target random forest model are capable of generating reports; conversely, if the classification results output by most decision tree models in the target random forest model are all unable to generate reports, then the classification results output by the target random forest model are unable to generate reports. Optionally, different weights can be set for each decision tree model in the target random forest model, and the classification results of the target random forest model are determined by the weights of each decision tree model and the results of classification judgment.

[0075] When the classification result output by the target random forest model is that the first field set can generate a report, a path set including the first field set in the target random forest model is determined, and the path set may include at least one path, and each path included in the path set corresponds to a report template, that is, each path can generate a report. The path set may be one or more paths in a decision tree model in the target random forest model, or may be multiple paths in multiple decision trees in the target random forest model.

[0076] Furthermore, the report generation platform may output each path in the path set, and the user may browse each path in the path set and the fields corresponding to the nodes of each path through the terminal device. Then the user may select the path for which the report is to be generated through the terminal device so that the report generation platform can further process it.

[0077] Optionally, the report generation platform may perform deduplication processing on each path to remove duplicate paths in the target random forest model, and then the report generation platform may output the deduplication-processed path set in the user interface of the user's terminal device for the user to select.

[0078] 203. Receive a selection instruction, where the selection instruction carries a path identifier, and the path identifier is used to indicate a first path in the path set.

[0079] In a possible implementation, the user selects the path of the report to be generated through the terminal device. After receiving the selection instruction input by the user, the terminal device of the user generates the selection instruction according to the path identifier of the first path selected by the user and sends it to the report generation platform. Then, the report generation platform can receive the selection instruction carrying the path identifier, and then determine the first path according to the path identifier. Among them, the first path can be one path, or the first path can be multiple paths, depending on the user's selection. It can be understood that if the first path is multiple paths, the path identifier is multiple.

[0080] Among them, the first path is the path of the decision tree model in the target random forest model, which is a branch of a decision tree model in the target random forest model. The first path includes the root node to the target leaf node in the branch of the decision tree model. Each node included in the first path can correspond to a field respectively. Thereby, all the fields included in the report that the user wants to generate are obtained, and the user does not need to manually obtain the data of each field, and the user can only enter part of the fields of the multiple reports that he wants to generate, so that the fields of multiple reports can be selected at one time to generate reports, which provides convenience for users to generate reports and improves the efficiency and accuracy of report generation. In addition, if the first path is a plurality of paths, multiple reports can be generated at one time, which is convenient for users to generate reports in batches and improves the efficiency of report generation.

[0081] 204. Determine that the fields corresponding to the nodes in the first path are the second field set;

[0082] Specifically, the report generation platform determines the fields corresponding to each node in the first path, and determines the determined fields as the fields of the second field set. It can be understood that in addition to obtaining the data corresponding to each field in the first path, the report generation platform can also obtain the corresponding reference data processing method according to the first path. The reference data processing method may include the calculation method between the data corresponding to each node in the first path and the report configuration template. The reference data processing method and the first path can be stored in a database or in a report generation platform, which is not limited in this application. Optionally, the elements constituting the report may include fields, data corresponding to the fields, and generated charts. The reference data processing method may include the calculation method of the report generation platform for the data corresponding to each field originally obtained, and may also include the report configuration template required for the generated report, that is, the generation method of the chart included in the report, and the position of the field, the data corresponding to the field, and the chart in the report. The reference data processing method may also include other information, which is not limited in this application.

[0083] 205. Obtain data corresponding to each field in the second field set, and generate a first report according to each field in the second field set and the data corresponding to each field.

[0084] In a possible implementation, the report generation platform may obtain the data corresponding to each field in the second field set, and generate the first report according to the fields in the second field set, the data corresponding to each field, and the data processing method corresponding to the first path. Optionally, the data corresponding to each field in the second field set obtained by the report generation platform may include a data period, which may be set by the user when inputting the selection instruction, or may be set by the report generation platform according to the report type corresponding to the first path, or may be set by the report generation platform by default. For example, the data period may be one month. When the report type corresponding to the first path selected by the user is insurance sales statistics, the report generation platform obtains the data of each node in the first path within one month by default.

[0085] In a possible implementation, the report generation platform may obtain a reference data processing method corresponding to the first path, and the reference data processing method includes a calculation method between data corresponding to each field in the first path and a report configuration template. The report generation platform may calculate the data corresponding to each field in the acquired second field set according to the calculation method between data corresponding to each field in the first path to obtain a calculation result, wherein the calculation result includes a data calculation result between data corresponding to each field in the second field set, and the calculation result may also include a newly added field and the data calculation result of the newly added field.

[0086] In a possible implementation, in the reference data processing method, the report configuration template may include a chart identifier, and the report generation platform may obtain a reference chart configuration method according to the chart identifier. The reference chart configuration method may be used by the report generation platform to generate a target chart according to each field in the second field set and the data and calculation results corresponding to each field. The target chart is also a chart required for generating a report. Furthermore, the report generation platform may fill the data, calculation results, and target chart corresponding to each field in the second field set into the report configuration template in the reference data processing method corresponding to the first path, thereby obtaining a first report, that is, generating a complete report.

[0087] Specifically, the reference chart configuration method includes preset field items and the style of the reference chart. Among them, the preset field items can be the fields required to generate the target chart, and the preset field items can be multiple fields in the second field set and the newly added fields in the calculation results. Among them, the style of the reference chart can be the color, font, font size, etc. of the chart. The report generation platform can determine the multiple fields used to generate the target chart and the data corresponding to the multiple fields according to the preset field items. Further, the report generation platform can determine the horizontal and vertical axis information and the title information according to the preset field items and the second field set. Among them, the units corresponding to the data in the preset field items and the second field set can be used to determine the title information and the horizontal and vertical axis information counted by the chart.

[0088] Exemplarily, if the preset field item is the sales of each insurance type, and the second field set includes fields for sales of multiple insurance types, then the horizontal axis of the target chart can be the insurance type, the vertical axis can be the sales, and the title information of the chart is determined to be the sales statistics of each type of insurance in X month. In another exemplary embodiment, if the preset field item is the sales of a certain type of insurance at each time node (for example, the weekly sales of auto insurance), and the second field set includes fields for the weekly sales of auto insurance, then the horizontal axis of the target chart can be time, the vertical axis can be the sales, and the title information is the sales statistics of auto insurance in each week in X month.

[0089] Furthermore, the report generation platform can generate an initial chart based on the style of the reference chart, the data corresponding to the preset field items in the second field set, and the calculation results. The initial chart can be a chart that only includes graphics, for example, basic graphics such as pie charts, bar charts, line charts, doughnut charts, radar charts, bar charts, and various maps, bubble charts, word cloud charts, box and line charts, table lists, text boxes, breadcrumbs, and other web page interfaces. And the target chart is composed according to the initial chart, horizontal and vertical axis information, and title information, that is, the target chart is a complete chart. Furthermore, the report generation platform can fill the data corresponding to each field in the second field set, the calculation results, and the generated target chart into the report configuration template in the reference data processing method to obtain the first report.

[0090] Furthermore, the report generation platform can output a preview mode of the first report, and the report generation platform can also receive a modification instruction input by the user through the terminal device, and the modification instruction is used to modify the first report to finally obtain the first report. If the first path is multiple paths, the first report is multiple reports. Through the embodiment of the present application, reports can be generated in batches to improve the efficiency of report generation.

[0091] In an embodiment of the present application, the first field set input by the user is judged by the target random forest model to determine whether the first field set can generate a report, thereby preventing the user from obtaining data of fields that are not included in the report to be generated, and improving the accuracy of the user obtaining data of fields in various businesses and massive data; and by determining the path set including the first field set in the target random forest model, each path included in the path set includes the first field set, and after the user inputs incomplete report fields, a variety of reports that can be generated can be output without the user having to search for the remaining fields, so that the user can select one or more reports, and then obtain the data corresponding to each node (i.e., field) on the corresponding path, and generate a report. Thus, the dimension of the field is accurate, the accuracy of report making is improved, and the efficiency of user report making is also improved.

[0092] See also Figure 3 , Figure 3It is a flowchart of a report generation method based on a random forest model provided in an embodiment of the present application. It should be noted that the same or similar parts between the various embodiments in the present application can refer to each other. In the various embodiments in the present application, and the various implementation methods / implementation methods / implementation methods in each embodiment, if there is no special explanation and logical conflict, the terms and / or descriptions between different embodiments and the various implementation methods / implementation methods / implementation methods in each embodiment are consistent and can be referenced to each other. The technical features in different embodiments and the various implementation methods / implementation methods / implementation methods in each embodiment can be combined to form new embodiments, implementation methods, implementation methods, or implementation methods according to their internal logical relationships. The above-mentioned implementation methods of the present application do not constitute a limitation on the scope of protection of the present application. As Figure 3 As shown, the report generation method based on the random forest model may include:

[0093] 301. Determine a first number of positive samples and a first number of negative samples that include the first field in the first training sample set, determine a first total number of training samples that include the first field in the first training sample set, determine a second number of positive samples and a second number of negative samples that do not include the first field in the first training sample set, and determine a second total number of training samples that do not include the first field in the first training sample set.

[0094] In one embodiment, before inputting the first field set into the target random forest model and determining whether the fields included in the first field set can generate a report according to the target random forest model, it is necessary to build the target random forest model. The training device (report generation platform) can obtain training samples for building the target random forest model, and the training samples include positive samples and negative samples.

[0095] Specifically, the training device (report generation platform) can obtain the fields of each report in multiple historical report sets to obtain a third field set. Optionally, the fields of each report in the multiple historical report sets obtained can be deduplicated, and the field set obtained after deduplication is determined as the third field set. And N fields are randomly selected from the third field set multiple times, and the N fields selected each time are composed of training samples, so as to obtain a first training sample set including multiple training samples, where N is an integer greater than 1. Among them, the first training sample set is used to construct a decision tree model in the target random forest model, and subsequently M fields will be selected from the third field set multiple times, and the M fields selected each time are composed of training samples to obtain a second training sample set. The value of M and the value of N can be the same or different. This application does not limit this. It should be noted that this application takes the target random forest model as an example to include two decision tree models, and it can actually include multiple decision tree models.

[0096] In one possible implementation, the training device (report generation platform) can determine whether the second report includes N fields of the first training sample, the second report is any report in a plurality of historical report sets, and the first training sample is any training sample in the first training sample set. That is, the training device (report generation platform) divides positive samples and negative samples based on whether the fields of one or more reports in the historical report set include the N fields of the first training sample. If it is determined that the second report includes the N fields of the first training sample, the first training sample is determined to be a positive sample. If it is determined that the second report does not include the N fields of the first training sample, the first training sample is determined to be a negative sample, that is, it is determined whether the fields of the reports in the plurality of historical report sets include the fields of the first training sample. The random forest model constructed based on such positive and negative samples can be used to determine whether a report can be generated through the first field set.

[0097] Furthermore, in order to construct a decision tree model, it is necessary to determine the Gini coefficient (Gini) of each field. The so-called Gini coefficient is used to indicate the "impurity" of positive and negative samples after the division according to the field, that is, whether the sample that can generate the report is more single, so as to better classify and obtain the classification result. Therefore, the fields of each node in the decision tree model can be determined in the order of the Gini coefficient from small to large, so as to construct a decision tree model, and then different decision tree models constructed according to different training sample sets can be combined to obtain a random forest model. The construction process of the decision tree model is the process of determining the fields of each node of the decision tree model, which is also the training process of the decision tree model.

[0098] Specifically, the training device (report generation platform) can determine the number of positive samples and negative samples that include the first field in the first training sample set, and obtain the first number of positive samples and the first number of negative samples, wherein the first field is any field in the third field set, and determine the total number of training samples that include the first field in the first training sample set, and obtain the first total number of training samples. It can be understood that the first total number of training samples is the sum of the first number of positive samples and the first number of negative samples. Similarly, the training device (report generation platform) can determine the number of positive samples and negative samples that do not include the first field in the first training sample set, and obtain the second number of positive samples and the second number of negative samples, and determine the total number of training samples that do not include the first field, and obtain the second total number of training samples, that is, the second total number of training samples is the sum of the second number of positive samples and the second number of negative samples.

[0099] Optionally, the first number of positive samples, the first number of negative samples, the first total number of training samples, the second number of positive samples, the second number of negative samples, and the second total number of training samples are stored for subsequent processing.

[0100] 302. Determine a first ratio of the first number of positive samples to the first total number of training samples, determine a second ratio of the first number of negative samples to the first total number of training samples, determine a third ratio of the second number of positive samples to the second total number of training samples, and determine a fourth ratio of the second number of negative samples to the second total number of training samples.

[0101] In a possible implementation, the Gini coefficient is calculated as follows: for each field, the sum of the products of the probabilities of positive samples and negative samples corresponding to each branch can be divided. Specifically, the Gini coefficient can be calculated as shown in Formula 1:

[0102]

[0103] Among them, Gini1 represents the Gini index of a certain category in the sample type. n represents the number of sample types in the data set. For example, if a field is selected by a node in the decision tree, the field can be divided into two categories, including the field and excluding the field, then n = 2. k represents the category. If k = 1, it represents the first category in the sample type in n. pk represents the proportion of the number of samples in the kth category to the total number of samples.

[0104] Specifically, the training device (report generation platform) can determine a first ratio of the first positive sample number to the first total training sample number, determine a second ratio of the first negative sample number to the first total training sample number, determine a third ratio of the second positive sample number to the second total training sample number, and determine a fourth ratio of the second negative sample number to the second total training sample number.

[0105] Exemplarily, for field A, the field A includes two types of training samples, one is a training sample including field A, and the other is a training sample excluding field A. The number of positive samples including field A can be 2, the number of negative samples including field A can be 3, the number of positive samples excluding field A can be 4, and the number of negative samples excluding field A can be 4. Then the first ratio is 2 / 5, the second ratio is 3 / 5, the third ratio is 4 / 4, and the fourth ratio is 0 / 4. Then the Gini coefficient including the first field and the Gini coefficient excluding the first field can be calculated according to formula 1, so as to determine the Gini coefficient of the first field according to the Gini coefficient including the first field and the Gini coefficient excluding the first field.

[0106] 303. Determine the first Gini coefficient of the first field according to the first ratio, the second ratio, the third ratio and the fourth ratio, and construct a first decision tree model according to the first Gini coefficients of the first fields in the first training sample set and the third field set.

[0107] Specifically, according to the ratio of the total number of training samples including the first field to the total number of training samples and the ratio of the total number of training samples not including the first field to the total number of training samples, a specific calculation method for determining the first Gini coefficient of the first field can be shown in Formula 2:

[0108]

[0109] Among them, Gini2 represents the Gini coefficient of the sample type, and I represents the number of sample types in the data set. For example, if a field is selected by a node in the decision tree, the field can be divided into two categories, including and excluding, then I=2. Ti represents the proportion of the total number of samples under this sample type to the total number of samples. Taking the above example as an example, assuming that there are 20 samples in total, I=2, then Gini1 (including)=0.48, Gini1 (excluding)=0, and then the value of Gini2 can be calculated. Gini2=0.48×5 / 20+0×4 / 20=0.12. Then calculate the first Gini coefficient of each field respectively, sort the calculated first Gini coefficients of each field from small to large, and use the field with the smallest first Gini coefficient in the sorting result as the node of the current decision tree (for example, starting from the root node), and then calculate the Gini coefficient of the next node in the same way (for example, calculate the Gini coefficient of at least one branch node branching from the root node). Until all fields are traversed, the first decision tree model constructed is obtained.

[0110] In a possible implementation, after constructing the first decision tree model, the training device (report generation platform) randomly selects M fields from the third field set again, and the M fields selected each time form training samples to obtain a second training sample set, where M is an integer greater than 1. The value of M may be the same as or different from the value of N, and this application does not limit this.

[0111] Similarly, the training device (report generation platform) can determine the positive samples in the second training sample set and the negative samples in the second training sample set, and determine the second Gini coefficient of each field in the second training sample set according to the first ratio and the second ratio of each field in the third field set corresponding to the second training sample set; and construct a second decision tree model according to the second Gini coefficient of each field in the second training sample set. Among them, the construction method of the first decision tree model and the second decision tree model is the same, which will not be repeated here. Furthermore, the training device (report generation platform) can combine the first decision tree model and the second decision tree model to obtain the target random forest model. That is, construct a training sample set again, and construct a second decision tree model, and construct a decision tree model through different training sets. And so on, multiple decision tree models are combined to obtain a random forest model.

[0112] In a possible implementation, after determining the target random forest model, the training device (report generation platform) can determine the classification discrimination method of the target random forest model, for example, the classification discrimination results of the majority of decision tree models can be used as the classification results of the target random forest model, or different weights can be set for multiple decision tree models, and each classification result value is calculated according to the classification discrimination results and weights of multiple decision trees, so that a classification result with a larger calculated classification result value is used as the classification result of the target random forest model. The classification discrimination method of the target random forest model can also be other methods, which are not limited in this application.

[0113] Further, the training device (report generation platform) can determine the path from the root node to each leaf node of each decision tree model in the target random forest model, and obtain multiple paths, wherein each leaf node refers to the last leaf node in the branch, and determine the fields of each node of the second path to obtain a fourth field set, and the second path is any path in the multiple paths. Optionally, in the obtained multiple paths, the path whose classification result is that the report cannot be generated is screened out, and then, each node of the second path in the multiple paths after screening is determined to obtain a fourth field set.

[0114] Furthermore, the training device (report generation platform) obtains a third report including all fields of the fourth field set from the historical report set, determines a data processing method for the third report, and stores the data processing method for the third report in correspondence with the fourth field set. The data processing method for the third report may include a calculation method between data corresponding to each field in the fourth field set and a report configuration template. So that the report generation platform can obtain the stored data processing method when it is determined by the target random forest model that the field input by the user can generate a report. That is, the report corresponding to the fourth field set is found from the historical report set, and the data processing method of the corresponding report is stored in correspondence for subsequent acquisition.

[0115] In an embodiment of the present application, the first field set input by the user is judged by the target random forest model to determine whether the first field set can generate a report, thereby preventing the user from obtaining data of fields that are not included in the report to be generated, and improving the accuracy of the user obtaining data of fields in various businesses and massive data; and by determining the path set including the first field set in the target random forest model, each path included in the path set includes the first field set, and after the user inputs incomplete report fields, a variety of reports that can be generated can be output without the user having to search for the remaining fields, so that the user can select one or more reports, and then obtain the data corresponding to each node (i.e., field) on the corresponding path, and generate a report. Thus, the dimension of the field is accurate, the accuracy of report making is improved, and the efficiency of user report making is also improved.

[0116] See also Figure 4 , Figure 4 : is a structural diagram of a report generation device based on a random forest model provided in an embodiment of the present application. The report generation device 400 based on a random forest model includes:

[0117] A receiving unit 401 is used to receive a report generation instruction, the report generation instruction carries a first field set, and input the first field set into a target random forest model;

[0118] A determination unit 402 is used to determine a path set including the first field set in the target random forest model when it is determined through the target random forest model that the fields included in the first field set can generate a report;

[0119] The receiving unit 401 is further used to receive a selection instruction, the selection instruction carries a path identifier, the path identifier is used to indicate a first path in the path set, the first path is a path of a decision tree model in the target random forest model, and the first path includes a root node to a target leaf node of the decision tree model;

[0120] The determining unit 402 is further configured to determine that the fields corresponding to the nodes in the first path are the second field set;

[0121] The acquisition unit 403 is used to acquire data corresponding to each field in the second field set, and generate a first report according to each field in the second field set and the data corresponding to each field.

[0122] Furthermore, the acquisition unit 403 is further configured to acquire fields in the historical report set, and determine a third field set according to the fields in the historical report set;

[0123] A selection unit 404 is used to randomly select N fields from the third field set, and form the selected N fields into training samples to obtain a first training sample set, where N is an integer greater than 1;

[0124] The determination unit 402 is further configured to determine the first training sample as a positive sample when it is determined that the second report includes the N fields of the first training sample, and determine the first training sample as a negative sample when it is determined that the second report does not include the N fields of the first training sample;

[0125] The second report is any report in the historical report set, and the first training sample is any training sample in the first training sample set.

[0126] Furthermore, the determining unit 402 is further configured to:

[0127] Determine a first number of positive samples and a first number of negative samples that include the first field in the first training sample set, determine a first total number of training samples that include the first field in the first training sample set, determine a second number of positive samples and a second number of negative samples that do not include the first field in the first training sample set, and determine a second total number of training samples that do not include the first field in the first training sample set, where the first field is any field in the third field set;

[0128] The first total number of training samples is the sum of the first number of positive samples and the first number of negative samples, and the second total number of training samples is the sum of the second number of positive samples and the second number of negative samples.

[0129] Determine a first ratio of the first number of positive samples to the first total number of training samples, determine a second ratio of the first number of negative samples to the first total number of training samples, determine a third ratio of the second number of positive samples to the second total number of training samples, and determine a fourth ratio of the second number of negative samples to the second total number of training samples;

[0130] According to the first ratio, the second ratio, the third ratio and the fourth ratio, the first Gini coefficient of the first field is determined, and according to the first Gini coefficients of each first field in the first training sample set and the third field set, a first decision tree model is constructed.

[0131] Furthermore, the selection unit 404 is further configured to randomly select M fields from the third field set, and form the selected M fields into training samples to obtain a second training sample set, where M is an integer greater than 1;

[0132] The determination unit 402 is further configured to determine a second Gini coefficient of each field in the third field set, and construct a second decision tree model according to the second training sample set and the second Gini coefficient of each field in the third field set;

[0133] The combining unit 405 is used to combine the first decision tree model and the second decision tree model to obtain a target random forest model.

[0134] Furthermore, the determining unit 402 is further configured to:

[0135] Determine the path from the root node to each leaf node of each decision tree model in the target random forest model to obtain multiple paths;

[0136] Determine the fields of each node of the second path among the plurality of paths to obtain a fourth field set, and obtain a third report including all fields of the fourth field set from the historical report set, wherein the second path is any one of the plurality of paths;

[0137] Determine a data processing method for the third report, the data processing method including a calculation method between data corresponding to each field in the fourth field set and a report configuration template, and store the data processing method in correspondence with the second path.

[0138] Furthermore, the report configuration template includes a chart identifier, and the acquisition unit 403 is specifically used to:

[0139] Obtaining the stored reference data processing method corresponding to the first path, and calculating the data corresponding to each field in the second field set according to the reference processing method to obtain a calculation result;

[0140] Obtaining a reference chart configuration method corresponding to the chart identifier included in the reference data processing method, and generating a target chart according to the reference chart configuration method, each field in the second field set, data corresponding to each field in the second field set, and the calculation result;

[0141] The data corresponding to each field in the second field set, the calculation results and the target chart are filled into the report configuration template of the reference data processing method to obtain the first report.

[0142] Furthermore, the reference chart configuration method includes preset field items and reference chart styles, and the calculation results include data results and newly added fields corresponding to the data results;

[0143] The acquisition unit 403 is specifically used for:

[0144] Determine data for generating the target chart according to the preset field items, and determine horizontal and vertical axis information and icon title information according to the preset field items and each field in the second field set, wherein the preset field items are used to indicate multiple fields in the second field set and the newly added fields;

[0145] An initial chart is generated according to the style of the reference chart and the data corresponding to the preset field items, and the target chart is composed according to the initial chart, the horizontal and vertical axis information and the title information.

[0146] For detailed description of the receiving unit 401, the determining unit 402, the acquiring unit 403, the selecting unit 404 and the combining unit 405, please refer to the above Figures 2 to 3 The relevant description in the illustrated method embodiment is directly obtained and will not be repeated here.

[0147] In an embodiment of the present application, the first field set input by the user is judged by the target random forest model to determine whether the first field set can generate a report, thereby preventing the user from obtaining data of fields that are not included in the report to be generated, and improving the accuracy of the user obtaining data of fields in various businesses and massive data; and by determining the path set including the first field set in the target random forest model, each path included in the path set includes the first field set, and after the user inputs incomplete report fields, a variety of reports that can be generated can be output without the user having to search for the remaining fields, so that the user can select one or more reports, and then obtain the data corresponding to each node (i.e., field) on the corresponding path, and generate a report. Thus, the dimension of the field is accurate, the accuracy of report making is improved, and the efficiency of user report making is also improved.

[0148] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application, such as Figure 5 As shown, the computer device 500 in the embodiment of the present application may include:

[0149] Processor 501, transceiver 502 and memory 505. In addition, the above-mentioned computer device 500 may also include: a user interface 504, and at least one communication bus 503. The communication bus 503 is used to realize the connection and communication between these components. The user interface 504 may include a display screen (Display) and a keyboard (Keyboard). The memory 505 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 505 may optionally be at least one storage device located away from the aforementioned processor 501 and the aforementioned transceiver 502. Figure 5 As shown, the memory 505 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.

[0150] exist Figure 5 In the computer device 500 shown, the transceiver 502 can provide a network communication function so that the servers can communicate with each other; the user interface 504 is mainly used to provide an input interface for the user; and the processor 501 can be used to call the device control application stored in the memory 505 to perform the following operations:

[0151] receiving a report generation instruction, the report generation instruction carrying a first field set, and inputting the first field set into a target random forest model;

[0152] In the case where it is determined through the target random forest model that the fields included in the first field set can generate a report, determining a path set in the target random forest model that includes the first field set;

[0153] Receive a selection instruction, the selection instruction carries a path identifier, the path identifier is used to indicate a first path in the path set, the first path is a path of a decision tree model in the target random forest model, and the first path includes a root node to a target leaf node of the decision tree model;

[0154] Determine that the fields corresponding to the nodes in the first path are the second field set;

[0155] The data corresponding to each field in the second field set is obtained, and a first report is generated according to each field in the second field set and the data corresponding to each field.

[0156] In a possible implementation, before the processor 501 inputs each field in the first field set into the target random forest model, the processor 501 is further configured to perform the following operations:

[0157] Obtaining fields in a historical report set, and determining a third field set based on the fields in the historical report set;

[0158] Randomly select N fields from the third field set, and use the selected N fields to form training samples to obtain a first training sample set, where N is an integer greater than 1;

[0159] In the case where it is determined that the second report includes the N fields of the first training sample, the first training sample is determined as a positive sample; in the case where it is determined that the second report does not include the N fields of the first training sample, the first training sample is determined as a negative sample;

[0160] The second report is any report in the historical report set, and the first training sample is any training sample in the first training sample set.

[0161] In a possible implementation, before the processor 501 inputs each field in the first field set into the target random forest model, the processor 501 is further configured to perform the following operations:

[0162] Determine the number of first positive samples and first negative samples of the first field in the first training sample set, and determine the number of first positive samples and first negative samples in the first training sample set

[0163] including the first total number of training samples of the first field, determining the second number of positive samples and the second number of negative samples in the first training sample set that do not include the first field, and determining the second total number of training samples in the first training sample set that do not include the first field, wherein the first field is any field in the third field set;

[0164] The first total number of training samples is the sum of the first number of positive samples and the first number of negative samples, and the second total number of training samples is the sum of the second number of positive samples and the second number of negative samples.

[0165] Determine a first ratio of the first number of positive samples to the first total number of training samples, determine a second ratio of the first number of negative samples to the first total number of training samples, determine a third ratio of the second number of positive samples to the second total number of training samples, and determine a fourth ratio of the second number of negative samples to the second total number of training samples;

[0166] According to the first ratio, the second ratio, the third ratio and the fourth ratio, the first Gini coefficient of the first field is determined, and according to the first Gini coefficients of each first field in the first training sample set and the third field set, a first decision tree model is constructed.

[0167] In a possible implementation, after the processor 501 constructs the first decision tree model according to the first Gini coefficient of each first field in the third field set, the processor 501 is further configured to perform the following operations:

[0168] Randomly select M fields from the third field set, and use the selected M fields to form training samples to obtain a second training sample set, where M is an integer greater than 1;

[0169] Determine the second Gini coefficient of each field in the third field set, and construct a second decision tree model based on the second training sample set and the second Gini coefficient of each field in the third field set;

[0170] The first decision tree model and the second decision tree model are combined to obtain a target random forest model.

[0171] In a possible implementation, before the processor 501 inputs the first field set into the target random forest model, the processor 501 is further configured to perform the following operations:

[0172] Determine the path from the root node to each leaf node of each decision tree model in the target random forest model to obtain multiple paths;

[0173] Determine the fields of each node of the second path among the plurality of paths to obtain a fourth field set, and obtain a third report including all fields of the fourth field set from the historical report set, wherein the second path is any one of the plurality of paths;

[0174] Determine a data processing method for the third report, the data processing method including a calculation method between data corresponding to each field in the fourth field set and a report configuration template, and store the data processing method in correspondence with the second path.

[0175] In a possible implementation, the report configuration template includes a chart identifier, and the processor 501 generates a first report according to each field in the second field set and data corresponding to each field, specifically for executing:

[0176] Obtaining the stored reference data processing method corresponding to the first path, and calculating the data corresponding to each field in the second field set according to the reference processing method to obtain a calculation result;

[0177] Obtaining a reference chart configuration method corresponding to the chart identifier included in the reference data processing method, and generating a target chart according to the reference chart configuration method, each field in the second field set, data corresponding to each field in the second field set, and the calculation result;

[0178] The data corresponding to each field in the second field set, the calculation results and the target chart are filled into the report configuration template of the reference data processing method to obtain the first report.

[0179] In a possible implementation, the reference chart configuration method includes preset field items and a style of the reference chart, and the calculation result includes a data result and a newly added field corresponding to the data result;

[0180] The processor 501 generates a target chart according to the reference chart configuration method, each field in the second field set, data corresponding to each field in the second field set and the calculation result, and is specifically used to execute:

[0181] Determine data for generating the target chart according to the preset field items, and determine horizontal and vertical axis information and icon title information according to the preset field items and each field in the second field set, wherein the preset field items are used to indicate multiple fields in the second field set and the newly added fields;

[0182] An initial chart is generated according to the style of the reference chart and the data corresponding to the preset field items, and the target chart is composed according to the initial chart, the horizontal and vertical axis information and the title information.

[0183] It should be understood that in some feasible implementations, the processor 501 may be a central processing unit (CPU), and the processor 501 may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0184] The memory 505 may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory 505 may also include a nonvolatile random access memory.

[0185] In a specific implementation, the computer device 500 can execute the above-mentioned functions through its built-in functional modules. Figure 2 and Figure 3For the implementation methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.

[0186] In an embodiment of the present application, the first field set input by the user is judged by the target random forest model to determine whether the first field set can generate a report, thereby preventing the user from obtaining data of fields that are not included in the report to be generated, and improving the accuracy of the user obtaining data of fields in various businesses and massive data; and by determining the path set including the first field set in the target random forest model, each path included in the path set includes the first field set, and after the user inputs incomplete report fields, a variety of reports that can be generated can be output without the user having to search for the remaining fields, so that the user can select one or more reports, and then obtain the data corresponding to each node (i.e., field) on the corresponding path, and generate a report. Thus, the dimension of the field is accurate, the accuracy of report making is improved, and the efficiency of user report making is also improved.

[0187] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the computer device mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, the computer program can execute the above-mentioned Figure 2 or Figure 3 Therefore, the description of any method in any corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0188] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by hardware related to computer program instructions, and the above-mentioned program can be stored in a computer-readable storage medium, which, when executed, can include the processes of the embodiments of the above-mentioned methods. The above-mentioned storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0189] It should be emphasized that in order to further ensure the privacy and security of the above data, the above data can also be stored in a node of a blockchain. Among them, the blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer.

[0190] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A report generation method based on a random forest model, characterized in that: include: receiving a report generation instruction, the report generation instruction carrying a first field set, and inputting the first field set into a target random forest model; In a case where it is determined through the target random forest model that the fields included in the first field set can generate a report, determining a path set in the target random forest model that includes the first field set; Receive a selection instruction, the selection instruction carrying a path identifier, the path identifier being used to indicate a first path in the path set, the first path being a path of a decision tree model in the target random forest model, the first path including a root node to a target leaf node of the decision tree model; Determine that the fields corresponding to each node in the first path are a second field set; Acquire data corresponding to each field in the second field set, and generate a first report according to each field in the second field set and the data corresponding to each field; Before inputting the first field set into the target random forest model, the method further includes: Acquire fields in a historical report set, and determine a third field set according to the fields in the historical report set; Randomly selecting N fields from the third field set, and forming the selected N fields into training samples to obtain a first training sample set, where N is an integer greater than 1; In the case where it is determined that the second report includes the N fields of the first training sample, the first training sample is determined as a positive sample; in the case where it is determined that the second report does not include the N fields of the first training sample, the first training sample is determined as a negative sample; The second report is any report in the historical report set, and the first training sample is any training sample in the first training sample set; Before inputting the first field set into the target random forest model, the method further includes: Determine a first number of positive samples and a first number of negative samples that include a first field in the first training sample set, determine a first total number of training samples that include the first field in the first training sample set, determine a second number of positive samples and a second number of negative samples that do not include the first field in the first training sample set, and determine a second total number of training samples that do not include the first field in the first training sample set, wherein the first field is any field in the third field set; The first total number of training samples is the sum of the first number of positive samples and the first number of negative samples, and the second total number of training samples is the sum of the second number of positive samples and the second number of negative samples; Determine a first ratio of the first number of positive samples to the first total number of training samples, determine a second ratio of the first number of negative samples to the first total number of training samples, determine a third ratio of the second number of positive samples to the second total number of training samples, and determine a fourth ratio of the second number of negative samples to the second total number of training samples; According to the first ratio, the second ratio, the third ratio and the fourth ratio, the first Gini coefficient of the first field is determined, and according to the first Gini coefficients of each first field in the first training sample set and the third field set, a first decision tree model is constructed, wherein the Gini coefficient is used to represent the sum of the products of the probabilities of positive samples and negative samples corresponding to each branch after each field is divided.

2. The method according to claim 1, characterized in that: After constructing the first decision tree model according to the first Gini coefficient of each first field in the third field set, the method further includes: Randomly selecting M fields from the third field set, and forming the selected M fields into training samples to obtain a second training sample set, where M is an integer greater than 1; Determine a second Gini coefficient of each field in the third field set, and construct a second decision tree model according to the second training sample set and the second Gini coefficient of each field in the third field set; The first decision tree model and the second decision tree model are combined to obtain a target random forest model.

3. The method according to claim 2, characterized in that Before inputting the first field set into the target random forest model, the method further includes: Determine the path from the root node to each leaf node of each decision tree model in the target random forest model to obtain multiple paths; Determine the fields of each node of a second path among the multiple paths to obtain a fourth field set, and obtain a third report including all fields of the fourth field set from the historical report set, wherein the second path is any path among the multiple paths; A data processing method for the third report is determined, the data processing method including a calculation method between data corresponding to each field in the fourth field set and a report configuration template, and the data processing method is stored in correspondence with the second path.

4. The method according to claim 3, characterized in that The report configuration template includes a chart identifier, and the generating of the first report according to each field in the second field set and data corresponding to each field includes: Acquire the stored reference data processing method corresponding to the first path, and calculate the data corresponding to each field in the second field set according to the reference data processing method to obtain a calculation result; Obtaining a reference chart configuration method corresponding to the chart identifier included in the reference data processing method, and generating a target chart according to the reference chart configuration method, each field in the second field set, data corresponding to each field in the second field set, and the calculation result; The data corresponding to each field in the second field set, the calculation result and the target chart are filled into the report configuration template of the reference data processing method to obtain the first report.

5. The method according to claim 4, characterized in that The reference chart configuration method includes preset field items and the style of the reference chart, and the calculation result includes a data result and a newly added field corresponding to the data result; The generating a target chart according to the reference chart configuration method, each field in the second field set, data corresponding to each field in the second field set and the calculation result includes: Determining data for generating the target chart according to preset field items, and determining horizontal and vertical axis information and chart title information according to the preset field items and each field in the second field set, wherein the preset field items are used to indicate multiple fields in the second field set and the newly added fields; An initial chart is generated according to the style of the reference chart and the data corresponding to the preset field items, and the target chart is composed according to the initial chart, the horizontal and vertical axis information and the title information.

6. A report generation device based on a random forest model, characterized in that: For executing the method according to any one of claims 1 to 5, the device further comprises: A receiving unit, configured to receive a report generation instruction, wherein the report generation instruction carries a first field set, and input the first field set into a target random forest model; a determining unit, configured to determine a path set including the first field set in the target random forest model when it is determined through the target random forest model that the fields included in the first field set can generate a report; The receiving unit is further used to receive a selection instruction, the selection instruction carries a path identifier, the path identifier is used to indicate a first path in the path set, the first path is a path of a decision tree model in the target random forest model, and the first path includes a root node to a target leaf node of the decision tree model; The determining unit is further configured to determine that the fields corresponding to each node in the first path are a second field set; The acquisition unit is used to acquire data corresponding to each field in the second field set, and generate a first report according to each field in the second field set and the data corresponding to each field.

7. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • A method of prediction model based on random forest algorithm

    AU2020100709A4

  • Method and device for generating data perspective table row

    CN112783890A

  • Method and device for generating data perspective table value

    CN112784556A