Rule set generation method and device, equipment and storage medium

By recursively dividing the sample set to build a decision tree and generating a rule set, the problem of insufficient accuracy of rule sets in the existing technology is solved, more accurate and comprehensive classification rules are achieved, and the accuracy of classification results is improved.

CN119538105APending Publication Date: 2025-02-28TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311095741.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-28
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In the prior art, the accuracy of the rule set is insufficient, which affects the accuracy of the classification results.

Method used

By recursively dividing the sample set, a decision tree is built and a rule set containing rules for each attribute dimension division are generated.

Benefits of technology

The generated rule set is more accurate and comprehensive, and can better classify based on the division rules of each attribute dimension, improving the accuracy of classification results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119538105A_ABST
    Figure CN119538105A_ABST
Patent Text Reader

Abstract

The invention discloses a rule set generation method and device, equipment and a storage medium. The method comprises the following steps: taking a sample set as a root node, and carrying out recursive division on the sample set based on a feature value of a first attribute feature of a sample under a first attribute dimension in M attribute dimensions and a division rule to obtain a first level node; based on the characteristic value of the mth attribute characteristic of the sample under the mth attribute dimension in the remaining attribute dimensions and the division rule, performing recursive division on the sample corresponding to the (m-1) th hierarchy node to obtain the mth hierarchy node until the Mth hierarchy node is obtained; based on the characteristic values of the samples in other attribute characteristics and the division rule, performing recursive division on the samples corresponding to the Mth-level nodes until a division termination condition is met; the root node and each node obtained by recursive division form a decision tree; generating a rule set by traversing the decision tree; the rules in the rule set can comprise the division rule of the sample under each attribute dimension, so that the generated rules are more accurate and comprehensive.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for generating a rule set. Background Art

[0002] In classification tasks, the rule set summarized from the sample set can be used to predict the category of the sample to be classified. That is to say, if the sample to be classified meets the corresponding rule in the rule set, it can be classified into the category indicated by the corresponding rule. The accuracy of the rule set directly affects the accuracy of the classification result. Based on this, how to improve the accuracy of the rule set is one of the hot research issues. Summary of the invention

[0003] The embodiments of the present application provide a method, apparatus, device and storage medium for generating a rule set. The rules in the rule set may include division rules under each attribute dimension of the sample, so that the generated rules are more accurate and comprehensive.

[0004] On the one hand, an embodiment of the present application provides a method for generating a rule set, including:

[0005] Obtain a sample set, the sample set comprising a plurality of samples; one sample corresponds to one reference category, one sample comprises feature values ​​of N attribute features, N ≥ 2, and N is an integer;

[0006] The sample set is used as a root node, and a first attribute dimension is selected from the M attribute dimensions, and the sample set is recursively divided based on the feature value of the first attribute feature of the sample in the first attribute dimension and the division rule under the first attribute feature to obtain a first-level node; wherein there is at least one attribute feature under any attribute dimension, N≥M≥2, and M is an integer;

[0007] Select the mth attribute dimension from the remaining attribute dimensions, and recursively divide the samples corresponding to the m-1th level nodes based on the feature value of the mth attribute feature of the sample under the mth attribute dimension and the division rule under the mth attribute feature to obtain the mth level nodes, until the Mth level nodes are obtained, m∈[2,M];

[0008] After obtaining the M-th level node, based on the characteristic values ​​of the samples in other attribute features and the division rules under the corresponding attribute features, the samples corresponding to the M-th level node are recursively divided until the division termination condition is reached; wherein the reference categories of the samples corresponding to any leaf node obtained by the recursive division are the same, and the root node and each node obtained by the recursive division constitute a decision tree;

[0009] A rule set is generated by traversing the decision tree; a rule in the rule set includes: each partitioning rule adopted in a path from a root node to a leaf node of the decision tree.

[0010] In one aspect, an embodiment of the present application provides a device for generating a rule set, including:

[0011] An acquisition unit, used to acquire a sample set, wherein the sample set includes a plurality of samples; one sample corresponds to one reference category, and one sample includes characteristic values ​​of N attribute features, where N ≥ 2, and N is an integer;

[0012] A processing unit, configured to use the sample set as a root node, select a first attribute dimension from the M attribute dimensions, and recursively divide the sample set based on a feature value of a first attribute feature of the sample in the first attribute dimension and a division rule under the first attribute feature to obtain a first-level node; wherein there is at least one attribute feature under any attribute dimension, N≥M≥2, and M is an integer;

[0013] The processing unit is further used to select an m-th attribute dimension from the remaining attribute dimensions, and recursively divide the samples corresponding to the m-1-th level nodes based on the feature value of the m-th attribute feature of the sample under the m-th attribute dimension and the division rule under the m-th attribute feature to obtain the m-th level nodes, until the M-th level nodes are obtained, m∈[2,M];

[0014] The processing unit is further configured to, after obtaining the M-th level node, recursively divide the samples corresponding to the M-th level node based on the feature values ​​of the samples in other attribute features and the division rules under the corresponding attribute features until the division termination condition is reached; wherein the reference categories of the samples corresponding to any leaf node obtained by the recursive division are the same, and the root node and the nodes obtained by the recursive division constitute a decision tree;

[0015] The processing unit is further used to generate a rule set by traversing the decision tree; a rule in the rule set includes: each partitioning rule adopted in a path from a root node to a leaf node of the decision tree.

[0016] In one aspect, an embodiment of the present application provides a computer device, the computer device comprising an input interface and an output interface, and further comprising:

[0017] a processor adapted to implement one or more instructions; and,

[0018] A computer storage medium storing one or more instructions, wherein the one or more instructions are suitable for being loaded by the processor and executing the above-mentioned method for generating a rule set.

[0019] On the one hand, an embodiment of the present application provides a computer storage medium, in which computer program instructions are stored. When the computer program instructions are executed by a processor, they are used to execute the above-mentioned method for generating a rule set.

[0020] On the one hand, an embodiment of the present application provides a computer program product, which includes a computer program stored in a computer storage medium; a processor of a computer device reads the computer program from the computer storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned rule set generation method.

[0021] In an embodiment of the present application, a decision tree can be constructed based on the recursive partitioning of the sample set, and then a rule set is generated by traversing the decision tree. A rule in the rule set includes: each partitioning rule adopted in the path from the root node of the decision tree to a leaf node. In the process of recursively partitioning the sample set to construct a decision tree, one attribute feature can be selected from the attribute features under each attribute dimension in the M attribute dimensions, and the first M recursive partitions can be implemented based on the partitioning rules under the selected M attribute features. In the subsequent recursive partitioning process, the partitioning rules under other attribute features in the N attribute features of the sample are selected to implement the subsequent recursive partitioning. The other attribute features are selected from the attribute features other than the selected M attribute features in the N attribute features. The rules in the rule set generated based on this can include the partitioning rules under each attribute dimension of the sample, so that the generated rules are more accurate and comprehensive, and the generated rules can be fully classified based on the partitioning rules under each attribute dimension when classifying the samples to be classified, so as to improve the accuracy of the classification results. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present application 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0023] Figure 1 is a schematic diagram of a decision tree provided in an embodiment of the present application;

[0024] Figure 2 It is a flowchart of a method for generating a rule set provided in an embodiment of the present application;

[0025] Figure 3 is a schematic diagram of constructing candidate rules based on a decision tree provided in an embodiment of the present application;

[0026] Figure 4 is a schematic diagram of a generation rule set provided in an embodiment of the present application;

[0027] Figure 5 is a schematic diagram of another generation rule set provided in an embodiment of the present application;

[0028] Figure 6 It is a structural schematic diagram of a device for generating a rule set provided in an embodiment of the present application;

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

[0030] 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.

[0031] The embodiment of the present application provides a scheme for generating a rule set, which can adjust the construction method of the selected decision tree model based on the selected decision tree model, so as to construct a decision tree based on the adjusted construction method, and generate a rule set based on the constructed decision tree. The general process of the scheme is as follows:

[0032] (I) Select the decision tree model.

[0033] Among them, the decision tree model is a classification or regression model based on a tree structure. It constructs a decision tree by recursively dividing the sample set. Each leaf node in the decision tree represents a classification result or regression result. The construction method of the decision tree model (also known as the learning method of the decision tree model) generally includes the following process:

[0034] ①. Select the optimal partition attribute of the sample: For the current node to be divided, determine the partition effect when the sample corresponding to the current node to be divided is partitioned based on the various attribute features of the sample, and select the attribute feature with the best partition effect as the optimal partition attribute of the current node to be divided.

[0035] ②. Divide the sample set: Based on the division rule under the selected optimal division attribute, divide the samples corresponding to the current node to be divided into several subsets, each subset corresponds to a branch node.

[0036] ③. Recursively construct subtrees: For each branch node, repeat steps ① and ② until the partition termination condition is reached to obtain a decision tree.

[0037] Furthermore, for the constructed decision tree, the decision tree can be pruned to reduce the occurrence of overfitting, for example, cross-validation and other methods can be used for pruning.

[0038] Among them, the decision tree model can be selected according to the specific task requirements. For example, the CART decision tree model, the C4.5 decision tree model or the ID3 decision tree model can be selected from the decision tree model. For the convenience of explanation, the embodiment of this application will be explained later using the CART decision tree model as an example, wherein the CART decision tree model constructs a binary tree based on binary partitioning.

[0039] (2) Obtain a sample set.

[0040] Among them, the sample set can be used to construct a decision tree and then generate a rule set; the sample set includes multiple samples, one sample includes feature values ​​of N attribute features, N≥2, and N is an integer; one sample corresponds to a reference category, and the reference category corresponding to the sample can be selected from multiple preset reference categories. On the basis of the sample set, the rule set generated by the rule set generation scheme proposed in the embodiment of the present application can be used to classify the samples to be classified into the multiple preset reference categories. Therefore, if the rule set generated by the sample sets under different reference categories is used, it can be used to classify the samples to be classified into different reference categories.

[0041] Furthermore, the sample set and multiple preset reference categories can be designed according to specific task requirements. Under different task requirements, samples containing different attribute features can be used, or different preset reference categories can be used. For example, if a task requirement indicates that the rule set expected to be generated can be used to determine whether an account on the platform is in violation, then multiple preset reference categories can be set as: a violation category indicating that the account is in violation, and a normal category indicating that the account is not in violation. The attribute features included in the sample can be set as attribute features that can be used to determine whether the account is in violation (such as the account registration time, the account nickname, the account signature, whether the account has been complained, etc.). Based on this, the feature values ​​of the accounts on the platform under the corresponding attribute features can be used to construct samples to obtain a sample set. The rule set generated based on the sample set can be used to classify the samples to be classified into violation categories and normal categories to determine whether the accounts on the platform are in violation. The attribute features contained in the samples to be classified should be the same as the attribute features contained in the samples in the sample set, but the specific feature values ​​may be different.

[0042] For another example, if a task requirement indicates that the rule set to be generated is expected to be able to be used to determine the influence level of an account on the platform, then multiple preset reference categories can be set as reference categories indicating different influence levels, one reference category corresponding to one influence level, and the attribute features included in the sample can be set as attribute features that can be used to determine the influence level of an account (such as the number of views, likes, comments, reposts, complaints, dislikes, and other attribute features of the content posted by the account). Based on this, the feature values ​​of the accounts on the platform under the corresponding attribute features can be used to construct samples to obtain a sample set. The rule set generated based on the sample set can be used to classify the samples to be classified into reference categories indicating different influence levels to determine the influence level of the accounts on the platform. The attribute features contained in the samples to be classified should be the same as the attribute features contained in the samples in the sample set, but the specific feature values ​​may be different.

[0043] Furthermore, among the N attribute features of the sample, one attribute feature corresponds to an attribute dimension, and the attribute dimension corresponding to the attribute feature can be selected from M attribute dimensions. The N attribute features of the sample can be classified based on the M attribute dimensions. There is at least one attribute feature under any attribute dimension, so that the sample can be described from the attribute features under the M attribute dimensions, where N≥M≥2, and M is an integer. The M attribute dimensions can be designed according to specific task requirements, and the attribute dimensions under different task requirements may be different. For example, if a task requirement indicates that the rule set expected to be generated can be used to detect the influence level of an account on the platform, and the attribute features included in the sample are set to attribute features that can be used to determine the influence level of an account, including the number of views, likes, comments, reposts, complaints, and dislikes of the content published by the account, then the M attribute dimensions can be set as positive feedback dimensions and negative feedback dimensions, among which the number of views, likes, comments, and reposts in the attribute features can be classified as positive feedback dimensions, and the number of complaints and dislikes can be classified as negative feedback dimensions, so that the influence of the sample can be described from the attribute features under the positive feedback dimension and the attribute features under the negative feedback dimension.

[0044] (3) Construct a decision tree based on the sample set and the adjusted construction method corresponding to the selected decision tree model.

[0045] In the rule set generation scheme proposed in the embodiment of the present application, a decision tree is constructed based on the selected decision tree model and based on the adjusted construction method; the general principle of the adjusted construction method proposed in the present application is as follows: in the recursive division process of the sample set, first, one attribute feature is selected from the attribute features under each attribute dimension in the M attribute dimensions respectively, as the optimal division attribute during the first M recursive divisions, and in the subsequent recursive division process, other attribute features among the N attribute features are selected as the optimal division attributes, and the other attribute features are selected from the attribute features other than the selected M attribute features among the N attribute features. That is to say, the sample set can be used as the root node, and the first attribute dimension can be selected from the M attribute dimensions, and the sample set can be recursively divided based on the characteristic value of the first attribute feature of the sample under the first attribute dimension and the division rule under the first attribute feature to obtain the first-level node, wherein the first attribute feature is the optimal division attribute selected from the attribute features under the first attribute dimension; the mth attribute dimension can be selected from the remaining attribute dimensions, and the samples corresponding to the m-1th level nodes can be recursively divided based on the characteristic value of the mth attribute feature of the sample under the mth attribute dimension and the division rule under the mth attribute feature to obtain the mth level node. , until the M-th level node is obtained, where m∈[2,M], and the m-th attribute feature is the optimal partitioning attribute selected from the attribute features under the m-th attribute dimension; after obtaining the M-th level node, based on the feature values ​​of the samples in other attribute features and the partitioning rules under the corresponding attribute features, the samples corresponding to the M-th level node are recursively partitioned until the partitioning termination condition is reached; wherein, the other attribute features are selected from the attribute features other than the selected M attribute features in the N attribute features, and the reference categories of the samples corresponding to any leaf node obtained by the recursive partitioning are the same, and the root node and the nodes obtained by the recursive partitioning constitute a decision tree.

[0046] For example, assuming that the M attribute dimensions are: attribute dimension 1, attribute dimension 2, and attribute dimension 3, wherein the attribute features under attribute dimension 1 include: attribute feature 1.1, attribute feature 1.2, and attribute feature 1.3, respectively; the attribute features under attribute dimension 2 include: attribute feature 2.1 and attribute feature 2.2, respectively; the attribute features under attribute dimension 3 include: attribute feature 3.1 and attribute feature 3.2, respectively. Then, in the process of constructing a decision tree, the sample set can be used as the root node; the first attribute dimension is selected from the M attribute dimensions, and based on the feature value of the first attribute feature of the sample under the first attribute dimension and the division rule under the first attribute feature, the sample set is recursively divided to obtain first-level nodes. For example, attribute dimension 1 can be selected from the M attribute dimensions as the first attribute dimension, and attribute feature 1.1 can be selected from the attribute features under attribute dimension 1 as the first attribute feature. Then, based on the division rule under attribute feature 1.1, the sample set can be recursively divided to obtain first-level nodes. The number of first-level nodes is multiple, see Figure 1 In the schematic diagram of the exemplary decision tree shown, the first-level node may be indicated by the label 101.

[0047] The mth attribute dimension is selected from the remaining attribute dimensions, and based on the characteristic value of the mth attribute feature of the sample under the mth attribute dimension and the division rule under the mth attribute feature, the samples corresponding to the m-1th level node are recursively divided to obtain the mth level node, until the Mth level node is obtained, m∈[2,M]. For one of the multiple first-level nodes, for example, attribute dimension 3 can be selected from the remaining attribute dimensions as the second attribute dimension, and attribute feature 3.2 can be selected from the attribute features under attribute dimension 3 as the second attribute feature, and then based on the division rule under attribute feature 3.2, the samples corresponding to the corresponding first-level node (i.e., the first-level node) can be recursively divided to obtain the second-level node, and one first-level node can be divided to obtain multiple second-level nodes. For one of the multiple second-level nodes, for example, attribute dimension 2 can be selected from the remaining attribute dimensions as the third attribute dimension, and attribute feature 2.1 can be selected from the attribute features under attribute dimension 2 as the third attribute feature. Then, based on the division rule under attribute feature 2.1, the samples corresponding to the corresponding second-level node can be recursively divided to obtain a third-level node. A second-level node can be divided to obtain multiple third-level nodes, see Figure 1The schematic diagram of the decision tree shown in FIG. 1 shows, the second-level node can be shown as marked with 102, and the third-level node can be shown as marked with 103. It is worth noting that since each node is executed independently when being divided, that is, each node is not affected by its brother node when being divided, when different m-1-th level nodes are divided, the determined m-th attribute dimension and the determined m-th attribute feature may be different; for example, in the above example process, for one of the multiple first-level nodes, for example, attribute dimension 3 can be selected from the remaining attribute dimensions as the second attribute dimension, and attribute feature 3.2 can be selected from the attribute features under attribute dimension 3 as the second attribute feature, for another of the multiple first-level nodes, for example, attribute dimension 3 can be selected from the remaining attribute dimensions as the second attribute dimension, and attribute feature 3.1 can be selected from the attribute features under attribute dimension 3 as the second attribute feature, and for another of the multiple first-level nodes, for example, attribute dimension 2 can be selected from the remaining attribute dimensions as the second attribute dimension, and attribute feature 2.1 can be selected from the attribute features under attribute dimension 2 as the second attribute feature.

[0048] After obtaining the M-th level node, based on the feature values ​​of the samples in other attribute features and the division rules under the corresponding attribute features, the samples corresponding to the M-th level node are recursively divided until the division termination condition is reached, wherein the reference categories of the samples corresponding to any leaf node obtained by the recursive division are the same, and the root node and each node obtained by the recursive division constitute a decision tree; after obtaining the M-th level node, there are still NM attribute features remaining in the N attribute features that have not been used for recursive division, so in the recursive division process after obtaining the M-th level node, attribute features are directly selected from the remaining NM attribute features (that is, the optimal division attribute is selected) for recursive division each time the recursive division is performed; further optionally, in the recursive division process after obtaining the M-th level node, the subtree after the M-level node can be constructed in the same construction method as the construction method of the selected decision tree model, and in the process of constructing the subtree after the M-level node, the optimal division attribute is selected from the remaining NM attribute features to divide the samples corresponding to the node. For one of the multiple third-level nodes, the remaining NM attribute features include: attribute feature 1.2, attribute feature 1.3, attribute feature 2.2, and attribute feature 3.1. For example, attribute feature 1.2 (i.e., other attribute features) can be selected from the remaining NM attribute features, and based on the division rule under attribute feature 1.2, the samples corresponding to the corresponding third-level node are recursively divided to obtain a fourth-level node; for one of the multiple fourth-level nodes, for example, attribute feature 2.2 (i.e., other attribute features) can be selected from the remaining NM attribute features, and based on the division rule under attribute feature 2.2, the samples corresponding to the corresponding fourth-level node are recursively divided to obtain a fifth-level node; and so on, until the division termination condition is reached, see Figure 1 In the schematic diagram of the decision tree shown, the 4th level node may be indicated by 104, and the 5th level node may be indicated by 105. It is worth noting that when different nodes of the same level are divided, the attribute features determined for division may be different; in the process of recursively dividing the nodes before the Mth level node, the division termination condition may also be reached, and the division may be stopped when the division termination condition is reached.

[0049] (iv) Generate a rule set based on the constructed decision tree.

[0050] In this process, a rule set can be generated by traversing the decision tree; a rule in the rule set includes: each partitioning rule used in the path from the root node to a leaf node of the decision tree.

[0051] In a specific implementation, the above-mentioned generation scheme of the rule set can be executed by a computer device, which can be a terminal or a server, that is, the above-mentioned generation scheme of the rule set can be executed by the terminal or the server. Alternatively, the above-mentioned generation scheme of the rule set can also be executed by the terminal and the server together. For example: the terminal obtains a sample set, and sends the sample set to the server, and the server executes the relevant processes of building a decision tree and executing the relevant processes of generating the rule set. For the sake of ease of explanation, the embodiments of the present application are subsequently described by taking the generation scheme of the rule set proposed by the present application executed by a computer device as an example.

[0052] Among them, the terminals mentioned above can be smart phones, computers (such as tablet computers, laptops, desktop computers, etc.), smart wearable devices (such as smart watches, smart glasses), smart voice interaction devices, smart home appliances (such as smart TVs), vehicle terminals or aircraft, etc. In addition, the servers mentioned above can be independent physical servers, or 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, CDN (Content Delivery Network), and big data and artificial intelligence platforms, etc. Further, the terminal and server can be located inside or outside the blockchain network, without limitation; further, the terminal and server can also upload any data stored inside to the blockchain network for storage to prevent the data stored inside from being tampered with and improve data security.

[0053] The collection and processing of relevant data (such as sample sets, etc.) in this application should be strictly in accordance with the requirements of laws and regulations when applied in examples, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.

[0054] Based on the above rule set generation scheme, the present application embodiment provides a rule set generation method. Figure 2 , which is a flow chart of a method for generating a rule set provided in an embodiment of the present application. Figure 2 The method for generating the rule set shown is explained by taking execution by a computer device as an example. Figure 2 The method for generating the rule set shown may include the following steps:

[0055] S201, obtaining a sample set, the sample set includes multiple samples; one sample corresponds to one reference category, and one sample includes feature values ​​of N attribute features.

[0056] In which, the sample set includes multiple samples, one sample includes feature values ​​of N attribute features, N≥2, and N is an integer; one sample corresponds to a reference category, and the reference category corresponding to the sample can be selected from multiple preset reference categories. Based on the sample set, the rule set generated by the rule set generation method proposed in the embodiment of the present application can be used to classify the samples to be classified into the multiple preset reference categories; further, the sample set and the multiple preset reference categories can be designed according to specific task requirements. Under different task requirements, samples containing different attribute features can be used, or different preset reference categories can be used; further, among the N attribute features of the sample, one attribute feature corresponds to an attribute dimension, and the attribute dimension corresponding to the attribute feature can be selected from M attribute dimensions. Based on the M attribute dimensions, the N attribute features of the sample can be classified, and there is at least one attribute feature under any attribute dimension, so that the sample can be described from the attribute features under the M attribute dimensions, wherein N≥M≥2, and M is an integer, and the M attribute dimensions can be designed according to specific task requirements, and the attribute dimensions under different task requirements may be different.

[0057] For example, if a task requirement indicates that the rule set to be generated is expected to be able to be used to determine whether an account on the platform has violated a rule, then the samples in the sample set may include violation samples (i.e., negative samples) used to indicate that the account has violated a rule, and normal samples (i.e., positive samples) used to indicate that the account has not violated a rule; the reference category corresponding to a violation sample is a violation category used to indicate that the account has violated a rule (for example, a violation caused by fraud), and the reference category corresponding to a normal sample is a normal category used to indicate that the account has not violated a rule; the M attribute dimensions include at least 2 of the following: an account dimension, a behavior dimension, a content dimension, and a negative feedback dimension, wherein the attribute features under the account dimension can be used to indicate: the attributes of the account, the attribute features under the behavior dimension can be used to indicate: the behavior features of the object behavior generated by the account, the attribute features under the content dimension can be used to indicate: the content features of the content published by the account, and the attribute features under the negative feedback dimension can be used to indicate: the situation where a negative feedback operation is performed on the account. The N attribute features of the sample can be designed according to the corresponding task requirements. For example, the attribute features under the account dimension may include: the registration time of the account, the registration address of the account, the IP address (i.e., Internet Protocol Address) of the account, etc.; the attribute features under the behavior dimension may include: whether the account generates various abnormal behaviors, for example, one abnormal behavior may indicate: the account sends messages to a group exceeding the first quantity threshold within a first specified time period (wherein the first specified time period and the first quantity threshold can be set according to specific requirements, for example, the first specified time period is set to 10 minutes and the first quantity threshold is set to 30), another abnormal behavior may indicate: the account sends friend adding requests to other accounts exceeding the second quantity threshold within a second specified time period (wherein the second specified time period and the second quantity threshold can be set according to specific requirements, for example, the second specified time period is set to 30 minutes and the second quantity threshold is set to 50), etc.; the attribute features under the content dimension may include: the nickname of the account, the account signature, the comments posted by the account, etc.; the attribute features under the negative feedback dimension may include: whether the account has been complained, whether the account has been blacklisted by other accounts, etc.

[0058] S202, taking the sample set as the root node, and selecting the first attribute dimension from the M attribute dimensions, and recursively dividing the sample set based on the feature value of the first attribute feature of the sample under the first attribute dimension and the division rule under the first attribute feature to obtain the first-level nodes.

[0059] In an optional implementation, when selecting the first attribute dimension from M attribute dimensions, an attribute dimension can be randomly selected from the M attribute dimensions as the first attribute dimension; or other selection methods can be used to select according to specific needs. In another optional implementation, the first attribute dimension can be selected according to the priority of the attribute dimension, and the priority of the first attribute dimension is higher than the priority of the remaining attribute dimensions, that is, when selecting the first attribute dimension from M attribute dimensions, the priority of each attribute dimension in the M attribute dimensions can be obtained, and then the attribute dimension with the highest priority in the M attribute dimensions is selected as the first attribute dimension; further, the priority of the attribute dimension can be used to indicate the importance of the attribute dimension, and the higher the priority of the attribute dimension, the higher the importance; the priority of the attribute dimension can be configured for the corresponding attribute dimension when setting the attribute dimension. For example, if a task requirement indicates: it is expected that the generated rule set can be used to determine whether the account in the platform is in violation, and the M attribute dimensions are arranged in descending order of priority as: account dimension, behavior dimension, content dimension, negative feedback dimension, then the first attribute dimension selected from the M attribute dimensions is the account dimension.

[0060] In one embodiment, the first attribute feature is the optimal partitioning attribute selected from the attribute features under the first attribute dimension. When the computer device determines the first attribute feature under the first attribute dimension, the following process may be included: respectively determining the partitioning evaluation index when recursively partitioning the sample set based on each attribute feature under the first attribute dimension; the partitioning evaluation index corresponding to the attribute feature is used to indicate: the partitioning effect when recursively partitioning the sample set based on the corresponding attribute feature; and taking the attribute feature corresponding to the optimal partitioning effect as the first attribute feature. Taking the determination of the partitioning evaluation index when recursively partitioning the sample set based on an attribute feature under the first attribute dimension as an example, the partitioning evaluation index when recursively partitioning the sample set based on each partitioning rule under the attribute feature under the first attribute dimension may be determined, and the partitioning evaluation index corresponding to the optimal partitioning effect among the partitioning evaluation indicators corresponding to each partitioning rule may be taken as the partitioning evaluation index corresponding to the attribute feature. Accordingly, the partitioning rule corresponding to the optimal partitioning effect may be referred to as the optimal partitioning rule under the attribute feature. Further, if the attribute feature is taken as the first attribute feature, the optimal partitioning rule under the attribute feature is the partitioning rule adopted in the process of recursively partitioning the sample set.

[0061] Among them, a partition rule under the attribute feature is composed of multiple partition sub-rules. Multiple first-level nodes can be obtained by partitioning the sample set using a partition rule under the attribute feature. One partition sub-rule corresponds to a first-level node. That is to say, the samples in the sample set that meet the corresponding partition sub-rule in the partition rule under the attribute feature are divided together to obtain a first-level node. For example, assuming that the feature values ​​under the attribute feature include: feature value 1, feature value 2 and feature value 3, if the selected decision tree model is a CART decision tree model, then the attribute feature includes 3 partition rules, each of which is composed of multiple partition sub-rules, and one of the partition rules indicates: samples whose feature value under the attribute feature is feature value 1 are divided together (that is, one partition sub-rule is: the feature value under the attribute feature is feature value 1) , the samples with the characteristic value of characteristic value 2 or characteristic value 3 are divided together (that is, another division sub-rule is: the characteristic value under this attribute feature is characteristic value 2 or characteristic value 3), another division rule indicates: the samples with the characteristic value of characteristic value 2 are divided together, the samples with the characteristic value of characteristic value 1 or characteristic value 3 are divided together, and another division rule indicates: the samples with the characteristic value of characteristic value 3 are divided together, and the samples with the characteristic value of characteristic value 1 or characteristic value 2 are divided together. It can be known that when the selected decision tree model is different, there may be different division rules for the same attribute feature. For example, based on another selected decision tree model, there is a division rule for the attribute characteristic value, indicating that the samples with the characteristic value of characteristic value 1 are divided together, the samples with the characteristic value of characteristic value 2 are divided together, and the samples with the characteristic value of characteristic value 3 are divided together. Further optionally, the division rules under any attribute feature can also be configured according to specific needs, for example, they can be manually configured according to specific needs.

[0062] Optionally, the partitioning evaluation index can be determined based on information gain or Gini index and other indicators used in the decision tree algorithm. For ease of explanation, the embodiments of the present application are described later using the Gini index as an example. The Gini index is an indicator for measuring unequal distribution and is often used to evaluate the performance of classification models. In classification problems, the Gini index is used to measure the purity of the classification results, that is, the probability that a random sample is classified into the correct category. The smaller the Gini index corresponding to a node, the purer the reference category of the sample corresponding to the node. The Gini index corresponding to a node can be shown as the following formula 1:

[0063]

[0064] Among them, p represents a node, J represents the number of reference categories, j is the independent variable, and p jIt represents the proportion of samples whose reference category is the jth reference category among the multiple samples corresponding to node p.

[0065] Furthermore, a partitioning evaluation index for recursively partitioning a sample set based on a partitioning rule under an attribute feature under the first attribute dimension can be obtained by integrating the Gini indexes corresponding to the first-level sub-nodes obtained by recursively partitioning the sample set based on the partitioning rule under the attribute feature. For example, the Gini indexes corresponding to the first-level sub-nodes obtained by the partition can be weighted summed to achieve the integration of the corresponding Gini indexes, wherein the weight of the weighted sum corresponding to any first-level sub-node obtained by the partition is the proportion of the first-level sub-node in the sample set; when the partitioning evaluation index is determined based on the Gini index, the smaller the partitioning evaluation index is, the better the partitioning effect is. Therefore, after respectively determining the partitioning evaluation indexes corresponding to the attribute features based on the first attribute dimension, the attribute feature corresponding to the minimum partitioning evaluation index can be used as the first attribute feature.

[0066] Further, the computer device may recursively partition the sample set based on the characteristic value of the first attribute feature of the sample under the first attribute dimension and the partitioning rule under the first attribute feature to obtain first-level nodes. That is, the samples in the sample set whose characteristic value of the first attribute feature satisfies the same partitioning sub-rule in the partitioning rule may be partitioned together. For example, if the partitioning rule under the first attribute feature for partitioning the sample set indicates: partitioning samples whose characteristic value under the attribute feature is characteristic value 1 together, and partitioning samples whose characteristic value is characteristic value 2 or characteristic value 3 together, then partitioning the sample set will obtain two first-level nodes, and the sample corresponding to one first-level node is partitioned by The samples corresponding to another first-level node are obtained by dividing the samples whose characteristic value of the first attribute feature in the sample set is characteristic value 1, and the samples corresponding to another first-level node are obtained by dividing the samples whose characteristic value of the first attribute feature in the sample set is characteristic value 2 or characteristic value 3; if the sample set includes 10 samples, the characteristic value of the first attribute feature from the 1st sample to the 6th sample is characteristic value 1, the characteristic value of the first attribute feature from the 7th sample is characteristic value 2, and the characteristic value of the first attribute feature from the 8th sample to the 10th sample is characteristic value 3, then the samples corresponding to one first-level node include: the 1st sample to the 6th sample, and the samples corresponding to another first-level node include: the 7th sample to the 10th sample.

[0067] S203, select the mth attribute dimension from the remaining attribute dimensions, and recursively divide the samples corresponding to the m-1th level nodes based on the characteristic value of the mth attribute feature of the sample in the mth attribute dimension and the division rule under the mth attribute feature to obtain the mth level nodes, until the Mth level nodes are obtained.

[0068] Wherein, m∈[2,M]; in an optional implementation, an attribute dimension may be randomly selected from the remaining attribute dimensions as the mth attribute dimension, or other selection methods may be used for selection according to specific needs; in another optional implementation, the mth attribute dimension may be selected according to the priority of the attribute dimension, and the priority of the m-1th attribute dimension is higher than the priority of the mth attribute dimension, that is, when selecting the mth attribute dimension from the remaining attribute dimensions, the priority of each attribute dimension in the M attribute dimensions may be obtained, and then the attribute dimension with the highest priority among the M attribute dimensions whose priority is smaller than that of the m-1th attribute dimension is selected as the mth attribute dimension; that is, when selecting the first attribute dimension to the Mth attribute dimension, they will be selected in descending order based on the priorities of the M attribute dimensions. For example, if M attribute dimensions include: attribute dimension 1, attribute dimension 2, attribute dimension 3 and attribute dimension 4, and the M attribute dimensions are arranged in descending order of priority as: attribute dimension 2, attribute dimension 3, attribute dimension 1 and attribute dimension 4, then the first attribute dimension is attribute dimension 2, the second attribute dimension is attribute dimension 3, the third attribute dimension is attribute dimension 1, and the fourth attribute dimension is attribute dimension 4; for another example, when the task requirement indicates: it is expected that the generated rule set can be used to determine whether an account on the platform is in violation of the rules, the M attribute dimensions are arranged in descending order of priority as: account dimension, behavior dimension, content dimension, negative feedback dimension, then the first attribute dimension selected from the M attribute dimensions is the account dimension, the second attribute dimension is the behavior dimension, the third attribute dimension is the content dimension, and the fourth attribute dimension is the negative feedback dimension.

[0069] Among them, the computer device determines the relevant process of the mth attribute feature under the mth attribute dimension, which is similar to the relevant process of determining the first attribute feature under the first attribute dimension, that is, the process of selecting the optimal partitioning attribute from the attribute features under the mth attribute dimension, that is, the process of selecting the attribute feature corresponding to the optimal partitioning effect from the attribute features under the mth attribute dimension according to the partitioning evaluation index corresponding to each attribute feature. The computer device recursively divides the sample corresponding to the m-1th level node based on the characteristic value of the mth attribute feature of the sample under the mth attribute dimension and the partitioning rule under the mth attribute feature to obtain the relevant process of the mth level node, which is similar to the above-mentioned process of recursively dividing the sample set based on the characteristic value of the first attribute feature of the sample under the first attribute dimension and the partitioning rule under the first attribute feature to obtain the relevant process of the first level node, and will not be repeated here.

[0070] S204, after obtaining the M-th level node, recursively divide the sample corresponding to the M-th level node based on the feature values ​​of the sample in other attribute features and the division rules under the corresponding attribute features until the division termination condition is reached.

[0071] Among them, the reference categories of samples corresponding to any leaf node obtained by recursive partitioning are the same, and the root node and each node obtained by recursive partitioning constitute a decision tree. After obtaining the M-th level node, the relevant process of recursively partitioning the samples corresponding to the M-th level node based on the characteristic values ​​of the samples in other attribute features and the partitioning rules under the corresponding attribute features is similar to the relevant process of recursively partitioning the sample set based on the characteristic values ​​of the first attribute features of the samples under the first attribute dimension and the partitioning rules under the first attribute features, which will not be repeated here; for any M-th level node, the other attribute features used for recursively partitioning the corresponding M-th level node are selected from NM attribute features (that is, selected from N attribute features, except for the M attribute features used in the previous M recursive partitionings), and the relevant process of selecting the attribute features used for recursive partitioning from the NM attribute features is similar to the relevant process of determining the first attribute feature from the attribute features under the first attribute dimension, which will not be repeated here.

[0072] Furthermore, the termination condition of the division includes at least: the path depth of the path from the root node to the current node to be divided reaches a depth threshold; or, the reference categories of the samples corresponding to the current node to be divided are the same; wherein the depth threshold can be set according to specific needs. Optionally, the termination condition of the division can also include: the number of samples corresponding to the current node to be divided is less than the quantity threshold, or, for the current node to be divided, on the path from the root node to the current node to be divided, there are no attribute features that are not used for division among the N attribute features, wherein the quantity threshold can be set according to specific needs; of course, the termination condition of the division can also be set according to specific business needs.

[0073] S205, generating a rule set by traversing the decision tree.

[0074] A rule in the rule set includes: each partitioning rule adopted in a path from a root node to a leaf node of the decision tree.

[0075] In one embodiment, when a computer device generates a rule set by traversing a decision tree, it can traverse the decision tree, and for the currently traversed leaf node, use each partitioning rule used in the path from the root node of the decision tree to the corresponding leaf node to construct a candidate rule until the traversal of the decision tree is completed and multiple candidate rules are obtained; wherein the candidate rules correspond one-to-one to the leaf nodes in the decision tree; determine the number of nodes included in the path corresponding to each candidate rule; filter out the candidate rules corresponding to the path with a node number greater than M from the multiple candidate rules, and construct a rule set based on the filtered candidate rules.

[0076] Among them, for the currently traversed leaf node, when the computer device uses each division rule used in the path from the root node of the decision tree to the corresponding leaf node to construct the candidate rule, each division sub-rule used in the path from the root node of the decision tree to the corresponding leaf node can be used to construct the candidate rule. For example, see Figure 3 , is a schematic diagram of constructing candidate rules based on a decision tree provided in an embodiment of the present application. If the decision tree is as shown in 301, the leaf node currently traversed in the decision tree is as shown in 302, and the path from the root node of the decision tree to the leaf node can be as shown in 303; if two first-level nodes are obtained by dividing based on the division rule under the first attribute feature, as shown in 304 and 305 respectively, if the first-level node as shown in 304 is obtained based on the division sub-rule 1 in the division rule under the first attribute feature (for example, the characteristic value of the first attribute feature is greater than the value 5), and the first-level node as shown in 305 is obtained based on the division sub-rule 2 in the division rule under the first attribute feature (for example, the characteristic value of the first attribute feature is less than or equal to the value 5), then the division sub-rule (division sub-rule 2) adopted in the path from the root node of the decision tree to the currently traversed leaf node can be used to construct the candidate rule. Based on this, each division sub-rule adopted in the path from the root node of the decision tree to the currently traversed leaf node constitutes a candidate rule corresponding to the leaf node.

[0077] Furthermore, the computer device can determine the number of nodes included in the path corresponding to each candidate rule, filter out candidate rules corresponding to the path with a number of nodes greater than M from multiple candidate rules, and construct a rule set based on the filtered candidate rules; wherein, the rule set is constructed by filtering out candidate rules corresponding to the path with a number of nodes greater than M from multiple candidate rules, so that the rules in the constructed rule set can include the division rules under each attribute dimension of the sample, thereby making the generated rules more accurate and comprehensive, and enabling the generated rules to comprehensively classify the samples to be classified based on the division rules under each attribute dimension, so as to improve the accuracy of the classification results.

[0078] Furthermore, after obtaining the screened candidate rules, the candidate rules whose path depth is greater than a depth threshold may be further screened out to construct a rule set based on the retained candidate rules.

[0079] After the rule set is constructed, the rules in the rule set can be used to classify the samples to be classified. The samples to be classified should have the same format as the samples in the sample set, that is, they include the characteristic values ​​of N attribute features. In other words, based on the various rules in the rule set and the characteristic values ​​of the samples to be classified in each attribute feature, the samples to be classified can be classified and predicted to obtain the predicted category of the samples to be classified. The process of classifying and predicting the samples to be classified based on the various rules in the rule set and the characteristic values ​​of the samples to be classified in each attribute feature to obtain the predicted category of the samples to be classified is that when the characteristic values ​​of the samples to be classified in each attribute feature meet a certain rule in the rule set, the reference category indicated by the rule is determined as the predicted category of the samples to be classified based on the rule, wherein the reference category indicated by any rule, that is, the reference category corresponding to the leaf node of the decision tree corresponding to the corresponding rule.

[0080] In one embodiment, after generating a rule set by traversing the decision tree, the rule set can be further adjusted; the process can include: obtaining multiple test samples; one test sample corresponds to a reference category, and one test sample includes characteristic values ​​of N attribute features; based on each rule in the rule set and the characteristic values ​​of each attribute feature of the test sample, multiple test samples are classified and predicted to obtain a predicted category for each test sample; the rule set is traversed, and for the currently traversed rule, the test sample of the predicted category is determined based on the currently traversed rule prediction, and the prediction accuracy of the currently traversed rule is determined based on the predicted categories of each test sample and the difference between the reference category; based on the prediction accuracy of each rule in the rule set, the rule set is screened to obtain a screened rule set; the prediction accuracy of any rule in the screened rule set is greater than or equal to the prediction accuracy of the rule screened out from the rule set. Among them, the test samples and the samples in the sample set should have the same format; based on the various rules in the rule set and the characteristic values ​​of the test samples in each attribute feature, the multiple test samples are classified and predicted to obtain the relevant process of the predicted category of each test sample, which is similar to the above-mentioned process of classifying and predicting the samples to be classified based on the various rules in the rule set and the characteristic values ​​of the various attribute features of the samples to be classified to obtain the predicted category of the samples to be classified, and will not be repeated here.

[0081] After obtaining the predicted category of each test sample, by traversing the rule set, for the currently traversed rule, the test sample whose predicted category is predicted based on the currently traversed rule (referred to as the test sample corresponding to the currently traversed rule) can be determined, and then the prediction accuracy of the currently traversed rule can be determined based on the predicted category of each determined test sample (i.e., each test sample corresponding to the currently traversed rule) and the difference between the reference category; wherein the prediction accuracy of the currently traversed rule can be: the proportion of accurately predicted samples in each determined test sample, wherein accurately predicted samples refer to samples whose predicted category is the same as the reference category, that is, the prediction accuracy of the currently traversed rule can be: the proportion of samples whose predicted category is the same as the reference category in each determined test sample. After the traversal is completed, the test samples corresponding to each rule in the rule set and the prediction accuracy of each rule can be obtained; then, based on the prediction accuracy of each rule in the rule set, the rule set can be screened to obtain a filtered rule set; wherein, the prediction accuracy of any rule in the filtered rule set is greater than or equal to the prediction accuracy of the rule filtered out from the rule set; in an optional implementation, the rule set is screened to obtain the filtered rule set, and the rules in the rule set that are arranged in the first specified position (Top k) when the rules are arranged in descending order according to the prediction accuracy can be retained to obtain the filtered rule set; in another optional implementation, the rule set is screened to obtain the filtered rule set, and the rules whose prediction accuracy is greater than the accuracy threshold can be retained to obtain the filtered rule set, and the accuracy threshold can be set according to specific needs, for example, it can be set to 95%. Further optionally, the test sample can be the current network traffic, that is, the sample generated in a specific business scenario. For example, when the business scenario is an account violation judgment scenario, that is, the task requirement in this scenario indicates: it is expected that the generated rule set can be used to judge whether the account in the platform is in violation, then the test sample can be selected from the sample generated by the account in the corresponding platform; the filtered rule set can be put online to the current network to classify the samples to be classified. In this process, the process from obtaining the test sample to obtaining the prediction accuracy of each rule is the test process of the rule set. Based on the prediction accuracy of each rule in the rule set, the rule set is screened and processed to obtain the filtered rule set, that is, the verification process of the rule set. For example, only when it is verified that the prediction accuracy of the rule is greater than the accuracy threshold can it be retained, otherwise it will be screened out.

[0082] See also Figure 4, is a schematic diagram of generating a rule set provided by an embodiment of the present application. The computer device can obtain a sample set, use the adjusted construction method proposed in the embodiment of the present application to construct a decision tree, and generate a rule set by traversing the decision tree; further, the computer device can also test and verify the rule set to obtain a filtered rule set. Figure 5 , is a schematic diagram of another generation rule set provided by an embodiment of the present application, and the process of generating the rule set is described by taking the Gini index as an example; the computer device can obtain a sample set, wherein the sample set includes multiple samples, one sample corresponds to a reference category, and one sample includes characteristic values ​​of N attribute features; the N attribute features of the sample are classified into M attribute dimensions. Further, the computer device can construct a decision tree using the adjusted construction method proposed in the embodiment of the present application. In this process, the current node to be divided can be determined. For the current node to be divided, the division rule adopted in the path from the root node to the current node to be divided is detected. Whether the division rule under the first attribute dimension is adopted, if not adopted, the division rule under the attribute feature corresponding to the optimal division effect is selected from the attribute feature under the first attribute dimension for division. Otherwise, the division rule adopted in the path from the root node to the current node to be divided is detected. Whether the division rule under the second attribute dimension is adopted, if not adopted, the division rule under the attribute feature corresponding to the optimal division effect is selected from the attribute feature under the second attribute dimension for division. Otherwise, it is detected whether the division rule under the third attribute dimension is used in the division rule adopted in the path from the root node to the current node to be divided. If not, the division rule under the attribute feature corresponding to the optimal division effect is selected from the attribute features under the third attribute dimension for division; and so on, until it is detected that the division rule under the Mth attribute dimension is used in the division rule adopted in the path from the root node to the current node to be divided, the division rule under other attribute features that have not been used in the path from the root node to the current node to be divided is selected for division until the division termination condition is reached; wherein, the root node and each node obtained by recursive division constitute a decision tree. Due to space limitations, Figure 5 The judgments on the first attribute dimension, the second attribute dimension and the third attribute dimension are given only as examples.

[0083] Traverse the decision tree to generate multiple candidate rules; filter out candidate rules corresponding to paths with a number of nodes greater than M from the multiple candidate rules. After obtaining the filtered candidate rules, filter out candidate rules whose path depth is greater than the depth threshold to build a rule set based on the retained candidate rules. Test and verify the rule set to obtain the filtered rule set; in the process of verifying the rule set, traverse the rules in the rule set. If the prediction accuracy of the currently traversed rule is greater than the accuracy threshold, retain it, otherwise filter it out. After the verification of the rules in the rule set is completed, put the filtered rule set obtained based on the verification of the rule set online on the existing network.

[0084] In the embodiment of the present application, a decision tree can be constructed based on the recursive partitioning of the sample set, and then a rule set is generated by traversing the decision tree. A rule in the rule set includes: each partitioning rule adopted in the path from the root node of the decision tree to a leaf node. In the process of recursively partitioning the sample set to construct a decision tree, one attribute feature can be selected from the attribute features under each attribute dimension in the M attribute dimensions, and the first M recursive partitions can be implemented based on the partitioning rules under the selected M attribute features. In the subsequent recursive partitioning process, the partitioning rules under other attribute features in the N attribute features of the sample are selected to implement the subsequent recursive partitioning. The other attribute features are selected from the attribute features other than the selected M attribute features in the N attribute features. Based on the rules in the rule set generated, the partitioning rules under each attribute dimension of the sample can be included, so that the generated rules are more accurate and comprehensive, and the generated rules can be fully classified based on the partitioning rules under each attribute dimension when classifying the samples to be classified, so as to improve the accuracy of the classification results. In addition, the time and manpower cost of manually analyzing data and summarizing rules can also be reduced.

[0085] Furthermore, in different business scenarios, attribute dimensions that are suitable for the scenarios can be selected. The division rules under the attribute characteristics in different attribute dimensions can be selected from the M attribute dimensions in descending order of priority to achieve the first M recursive divisions. The growth path of the tree can be precisely controlled in a fine-grained manner, making the generated rule set easier to understand (highly interpretable) and use, and more in line with business needs. Furthermore, the prediction accuracy of each rule in the rule set can be determined based on the test sample, and then the rule set can be screened, retaining the rules with high prediction accuracy for classification prediction, which can further ensure the prediction accuracy of the rules in the screened rule set.

[0086] Based on the above embodiments related to the method for generating a rule set, the present application embodiment provides a device for generating a rule set. Figure 6, is a structural diagram of a rule set generation device provided in an embodiment of the present application. The rule set generation device may include an acquisition unit 601 and a processing unit 602. Figure 6 The rule set generation device shown can be used to perform the following operations:

[0087] The acquisition unit 601 is used to acquire a sample set, where the sample set includes multiple samples; one sample corresponds to one reference category, and one sample includes feature values ​​of N attribute features, where N≥2, and N is an integer;

[0088] The processing unit 602 is configured to use the sample set as a root node, select a first attribute dimension from the M attribute dimensions, and recursively divide the sample set based on the feature value of the first attribute feature of the sample in the first attribute dimension and the division rule under the first attribute feature to obtain a first-level node; wherein there is at least one attribute feature under any attribute dimension, N≥M≥2, and M is an integer;

[0089] The processing unit 602 is further configured to select an mth attribute dimension from the remaining attribute dimensions, and recursively divide the sample corresponding to the m-1th level node based on the feature value of the mth attribute feature of the sample under the mth attribute dimension and the division rule under the mth attribute feature to obtain the mth level node, until the Mth level node is obtained, m∈[2,M];

[0090] The processing unit 602 is further configured to, after obtaining the M-th level node, recursively divide the samples corresponding to the M-th level node based on the feature values ​​of the samples in other attribute features and the division rules under the corresponding attribute features until the division termination condition is reached; wherein the reference categories of the samples corresponding to any leaf node obtained by the recursive division are the same, and the root node and the nodes obtained by the recursive division constitute a decision tree;

[0091] The processing unit 602 is further configured to generate a rule set by traversing the decision tree; a rule in the rule set includes: each partitioning rule used in a path from a root node to a leaf node of the decision tree.

[0092] In one embodiment, the first attribute dimension and the mth attribute dimension are selected according to the priority of the attribute dimensions; the priority of the first attribute dimension is higher than the priority of the remaining attribute dimensions, and the priority of the m-1th attribute dimension is higher than the priority of the mth attribute dimension.

[0093] In one embodiment, the processing unit 602 is configured to perform the following steps when generating a rule set by traversing the decision tree:

[0094] Traversing the decision tree, for the currently traversed leaf node, using each partitioning rule used in the path from the root node of the decision tree to the corresponding leaf node to construct a candidate rule, until the traversal of the decision tree is completed to obtain a plurality of candidate rules; wherein the candidate rules correspond one to one with the leaf nodes in the decision tree;

[0095] Determine the number of nodes included in the path corresponding to each candidate rule;

[0096] Candidate rules corresponding to paths with a number of nodes greater than M are screened out from the multiple candidate rules, and the rule set is constructed based on the screened candidate rules.

[0097] In one embodiment, the processing unit 602 is further configured to:

[0098] Acquire multiple test samples; one test sample corresponds to one reference category, and one test sample includes feature values ​​of the N attribute features;

[0099] Based on each rule in the rule set and the characteristic value of each attribute feature of the test sample, the multiple test samples are classified and predicted to obtain a predicted category for each test sample;

[0100] Traversing the rule set, for the currently traversed rule, determining a test sample of a predicted category predicted based on the currently traversed rule, and determining the prediction accuracy of the currently traversed rule according to the predicted category of each test sample determined and the difference between the reference category;

[0101] Based on the prediction accuracy of each rule in the rule set, the rule set is screened to obtain a screened rule set; the prediction accuracy of any rule in the screened rule set is greater than or equal to the prediction accuracy of the rule screened out from the rule set.

[0102] In one embodiment, when the processing unit 602 is used to determine the first attribute feature under the first attribute dimension, it can be used to perform the following steps:

[0103] Determine respectively the partition evaluation index when recursively partitioning the sample set based on each attribute feature under the first attribute dimension; the partition evaluation index corresponding to the attribute feature is used to indicate: the partition effect when recursively partitioning the sample set based on the corresponding attribute feature;

[0104] The attribute feature corresponding to the optimal segmentation effect is used as the first attribute feature.

[0105] In one embodiment, the partition termination condition at least includes:

[0106] The path depth from the root node to the current node to be divided reaches a depth threshold;

[0107] Alternatively, the reference categories of the samples corresponding to the current nodes to be divided are the same.

[0108] In one embodiment, the samples in the sample set include violation samples for indicating that the account has violated the rules, and normal samples for indicating that the account has not violated the rules; the reference category corresponding to a violation sample is the violation category for indicating that the account has violated the rules, and the reference category corresponding to a normal sample is the normal category for indicating that the account has not violated the rules;

[0109] The M attribute dimensions include at least two of the following: an account dimension, a behavior dimension, a content dimension, and a negative feedback dimension, wherein the attribute characteristics under the account dimension are used to indicate: the attributes possessed by the account, the attribute characteristics under the behavior dimension are used to indicate: the behavior characteristics of the object behavior generated by the account, the attribute characteristics under the content dimension are used to indicate: the content characteristics of the content published by the account, and the attribute characteristics under the negative feedback dimension are used to indicate: the situation in which a negative feedback operation is performed on the account.

[0110] According to one embodiment of the present application, Figure 2 The various steps involved in the method for generating the rule set shown can be performed by Figure 6 The rule set generation device shown is executed by each unit in the device. For example, Figure 2 Step S201 shown can be performed by Figure 6 The acquisition unit 601 in the generation device of the rule set shown is executed, Figure 2 Steps S202 to S205 shown in FIG. Figure 6 The rule set generation device shown is executed by the processing unit 602.

[0111] According to another embodiment of the present application, Figure 6 The various units in the generation device of the rule set shown can be separately or completely combined into one or several other units to constitute, or one (some) of the units can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. For example, the functions implemented by the above-mentioned various units can be implemented by a processing unit. In other embodiments of the present application, the generation device of the rule set based on logical function division can also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.

[0112] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 2 A computer program (including program code) for each step involved in the corresponding method shown in FIG. Figure 6 The rule set generation device shown in the embodiment of the present application is used to implement the rule set generation method of the present application. The computer program can be recorded on a computer-readable storage medium, for example, and loaded into the above-mentioned computing device through the computer-readable storage medium and run therein.

[0113] In an embodiment of the present application, a decision tree can be constructed based on the recursive partitioning of the sample set, and then a rule set is generated by traversing the decision tree. A rule in the rule set includes: each partitioning rule adopted in the path from the root node of the decision tree to a leaf node. In the process of recursively partitioning the sample set to construct a decision tree, one attribute feature can be selected from the attribute features under each attribute dimension in the M attribute dimensions, and the first M recursive partitions can be implemented based on the partitioning rules under the selected M attribute features. In the subsequent recursive partitioning process, the partitioning rules under other attribute features in the N attribute features of the sample are selected to implement the subsequent recursive partitioning. The other attribute features are selected from the attribute features other than the selected M attribute features in the N attribute features. The rules in the rule set generated based on this can include the partitioning rules under each attribute dimension of the sample, so that the generated rules are more accurate and comprehensive, and the generated rules can be fully classified based on the partitioning rules under each attribute dimension when classifying the samples to be classified, so as to improve the accuracy of the classification results.

[0114] Based on the above-mentioned related embodiments of the method for generating a rule set and the embodiment of the device for generating a rule set, the present application also provides a computer device. Figure 7 , is a structural diagram of a computer device provided in an embodiment of the present application. Figure 7 The computer device shown may include at least a processor 701, an input interface 702, an output interface 703, and a computer storage medium 704. The processor 701, the input interface 702, the output interface 703, and the computer storage medium 704 may be connected via a bus or other means.

[0115] The computer storage medium 704 can be stored in the memory of the computer device. The computer storage medium 704 is used to store a computer program. The computer program includes program instructions. The processor 701 is used to execute the program instructions stored in the computer storage medium 704. The processor 701 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the above-mentioned rule set generation method process or corresponding functions.

[0116] The embodiment of the present application also provides a computer storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer storage medium here can include both the built-in storage medium in the terminal and the extended storage medium supported by the terminal. The computer storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor 701 are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed random access memory (RAM) memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage; optionally, it can also be at least one computer storage medium located away from the aforementioned processor.

[0117] In one embodiment, the processor 701 may load and execute one or more instructions stored in a computer storage medium to implement the above-mentioned Figure 2 In the corresponding steps of the method in the embodiment of the method for generating a rule set, in a specific implementation, one or more instructions in the computer storage medium are loaded by the processor 701 and execute the following steps:

[0118] Obtain a sample set, the sample set comprising a plurality of samples; one sample corresponds to one reference category, one sample comprises feature values ​​of N attribute features, N ≥ 2, and N is an integer;

[0119] The sample set is used as a root node, and a first attribute dimension is selected from the M attribute dimensions, and the sample set is recursively divided based on the feature value of the first attribute feature of the sample in the first attribute dimension and the division rule under the first attribute feature to obtain a first-level node; wherein there is at least one attribute feature under any attribute dimension, N≥M≥2, and M is an integer;

[0120] Select the mth attribute dimension from the remaining attribute dimensions, and recursively divide the samples corresponding to the m-1th level nodes based on the feature value of the mth attribute feature of the sample under the mth attribute dimension and the division rule under the mth attribute feature to obtain the mth level nodes, until the Mth level nodes are obtained, m∈[2,M];

[0121] After obtaining the M-th level node, based on the characteristic values ​​of the samples in other attribute features and the division rules under the corresponding attribute features, the samples corresponding to the M-th level node are recursively divided until the division termination condition is reached; wherein the reference categories of the samples corresponding to any leaf node obtained by the recursive division are the same, and the root node and each node obtained by the recursive division constitute a decision tree;

[0122] A rule set is generated by traversing the decision tree; a rule in the rule set includes: each partitioning rule adopted in a path from a root node to a leaf node of the decision tree.

[0123] In one embodiment, the first attribute dimension and the mth attribute dimension are selected according to the priority of the attribute dimensions; the priority of the first attribute dimension is higher than the priority of the remaining attribute dimensions, and the priority of the m-1th attribute dimension is higher than the priority of the mth attribute dimension.

[0124] In one embodiment, the processor 701 is configured to perform the following steps when generating a rule set by traversing the decision tree:

[0125] Traversing the decision tree, for the currently traversed leaf node, using each partitioning rule used in the path from the root node of the decision tree to the corresponding leaf node to construct a candidate rule, until the traversal of the decision tree is completed to obtain a plurality of candidate rules; wherein the candidate rules correspond one to one with the leaf nodes in the decision tree;

[0126] Determine the number of nodes included in the path corresponding to each candidate rule;

[0127] Candidate rules corresponding to paths with a number of nodes greater than M are screened out from the multiple candidate rules, and the rule set is constructed based on the screened candidate rules.

[0128] In one embodiment, the processor 701 is further configured to:

[0129] Acquire multiple test samples; one test sample corresponds to one reference category, and one test sample includes feature values ​​of the N attribute features;

[0130] Based on each rule in the rule set and the characteristic value of each attribute feature of the test sample, the multiple test samples are classified and predicted to obtain a predicted category for each test sample;

[0131] Traversing the rule set, for the currently traversed rule, determining a test sample of a predicted category predicted based on the currently traversed rule, and determining the prediction accuracy of the currently traversed rule according to the predicted category of each test sample determined and the difference between the reference category;

[0132] Based on the prediction accuracy of each rule in the rule set, the rule set is screened to obtain a screened rule set; the prediction accuracy of any rule in the screened rule set is greater than or equal to the prediction accuracy of the rule screened out from the rule set.

[0133] In one embodiment, when the processor 701 is used to determine the first attribute feature under the first attribute dimension, it can be used to perform the following steps:

[0134] Determine respectively the partition evaluation index when recursively partitioning the sample set based on each attribute feature under the first attribute dimension; the partition evaluation index corresponding to the attribute feature is used to indicate: the partition effect when recursively partitioning the sample set based on the corresponding attribute feature;

[0135] The attribute feature corresponding to the optimal segmentation effect is used as the first attribute feature.

[0136] In one embodiment, the partition termination condition at least includes:

[0137] The path depth from the root node to the current node to be divided reaches a depth threshold;

[0138] Alternatively, the reference categories of the samples corresponding to the current nodes to be divided are the same.

[0139] In one embodiment, the samples in the sample set include violation samples for indicating that the account has violated the rules, and normal samples for indicating that the account has not violated the rules; the reference category corresponding to a violation sample is the violation category for indicating that the account has violated the rules, and the reference category corresponding to a normal sample is the normal category for indicating that the account has not violated the rules;

[0140] The M attribute dimensions include at least two of the following: an account dimension, a behavior dimension, a content dimension, and a negative feedback dimension, wherein the attribute characteristics under the account dimension are used to indicate: the attributes possessed by the account, the attribute characteristics under the behavior dimension are used to indicate: the behavior characteristics of the object behavior generated by the account, the attribute characteristics under the content dimension are used to indicate: the content characteristics of the content published by the account, and the attribute characteristics under the negative feedback dimension are used to indicate: the situation in which a negative feedback operation is performed on the account.

[0141] The present application provides a computer program product, which includes a computer program stored in a computer storage medium; a processor of a computer device reads the computer program from the computer storage medium, and the processor executes the computer program, so that the computer device performs the above-mentioned Figure 2 , Figure 3 as well as Figure 5 The method embodiment shown in the figure. The computer-readable storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).

[0142] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for generating a rule set, characterized in that: include: Obtain a sample set, the sample set comprising a plurality of samples; one sample corresponds to one reference category, one sample comprises feature values ​​of N attribute features, N ≥ 2, and N is an integer; The sample set is used as a root node, and a first attribute dimension is selected from the M attribute dimensions, and the sample set is recursively divided based on the feature value of the first attribute feature of the sample in the first attribute dimension and the division rule under the first attribute feature to obtain a first-level node; wherein there is at least one attribute feature under any attribute dimension, N≥M≥2, and M is an integer; Select the mth attribute dimension from the remaining attribute dimensions, and recursively divide the samples corresponding to the m-1th level nodes based on the feature value of the mth attribute feature of the sample under the mth attribute dimension and the division rule under the mth attribute feature to obtain the mth level nodes, until the Mth level nodes are obtained, m∈[2,M]; After obtaining the M-th level node, based on the characteristic values ​​of the samples in other attribute features and the division rules under the corresponding attribute features, the samples corresponding to the M-th level node are recursively divided until the division termination condition is reached; wherein the reference categories of the samples corresponding to any leaf node obtained by the recursive division are the same, and the root node and each node obtained by the recursive division constitute a decision tree; A rule set is generated by traversing the decision tree; a rule in the rule set includes: each partitioning rule adopted in a path from a root node to a leaf node of the decision tree.

2. The method according to claim 1, characterized in that The first attribute dimension and the mth attribute dimension are selected according to the priority of the attribute dimensions; the priority of the first attribute dimension is higher than the priority of the remaining attribute dimensions, and the priority of the m-1th attribute dimension is higher than the priority of the mth attribute dimension.

3. The method according to claim 1, characterized in that The step of traversing the decision tree to generate a rule set includes: Traversing the decision tree, for the currently traversed leaf node, using each partitioning rule used in the path from the root node of the decision tree to the corresponding leaf node to construct a candidate rule, until the traversal of the decision tree is completed to obtain a plurality of candidate rules; wherein the candidate rules correspond one to one with the leaf nodes in the decision tree; Determine the number of nodes included in the path corresponding to each candidate rule; Candidate rules corresponding to paths with a number of nodes greater than M are screened out from the multiple candidate rules, and the rule set is constructed based on the screened candidate rules.

4. The method according to claim 1, characterized in that The method further comprises: Acquire multiple test samples; one test sample corresponds to one reference category, and one test sample includes feature values ​​of the N attribute features; Based on each rule in the rule set and the characteristic value of each attribute feature of the test sample, the multiple test samples are classified and predicted to obtain a predicted category for each test sample; Traversing the rule set, for the currently traversed rule, determining a test sample of a predicted category predicted based on the currently traversed rule, and determining the prediction accuracy of the currently traversed rule according to the predicted category of each test sample determined and the difference between the reference category; Based on the prediction accuracy of each rule in the rule set, the rule set is screened to obtain a screened rule set; the prediction accuracy of any rule in the screened rule set is greater than or equal to the prediction accuracy of the rule screened out from the rule set.

5. The method according to claim 1, characterized in that The method for determining the first attribute feature under the first attribute dimension includes: Determine respectively the partition evaluation index when recursively partitioning the sample set based on each attribute feature under the first attribute dimension; the partition evaluation index corresponding to the attribute feature is used to indicate: the partition effect when recursively partitioning the sample set based on the corresponding attribute feature; The attribute feature corresponding to the optimal segmentation effect is used as the first attribute feature.

6. The method according to claim 1, characterized in that The partition termination conditions at least include: The path depth from the root node to the current node to be divided reaches a depth threshold; Alternatively, the reference categories of the samples corresponding to the current nodes to be divided are the same.

7. The method according to claim 1, characterized in that The samples in the sample set include violation samples for indicating that the account has violated the rules, and normal samples for indicating that the account has not violated the rules; the reference category corresponding to a violation sample is the violation category for indicating that the account has violated the rules, and the reference category corresponding to a normal sample is the normal category for indicating that the account has not violated the rules; The M attribute dimensions include at least two of the following: an account dimension, a behavior dimension, a content dimension, and a negative feedback dimension, wherein the attribute characteristics under the account dimension are used to indicate: the attributes possessed by the account, the attribute characteristics under the behavior dimension are used to indicate: the behavior characteristics of the object behavior generated by the account, the attribute characteristics under the content dimension are used to indicate: the content characteristics of the content published by the account, and the attribute characteristics under the negative feedback dimension are used to indicate: the situation in which a negative feedback operation is performed on the account.

8. A device for generating a rule set, characterized in that: include: An acquisition unit, used to acquire a sample set, wherein the sample set includes a plurality of samples; one sample corresponds to one reference category, and one sample includes characteristic values ​​of N attribute features, where N ≥ 2, and N is an integer; A processing unit, configured to use the sample set as a root node, select a first attribute dimension from the M attribute dimensions, and recursively divide the sample set based on a feature value of a first attribute feature of the sample in the first attribute dimension and a division rule under the first attribute feature to obtain a first-level node; wherein there is at least one attribute feature under any attribute dimension, N≥M≥2, and M is an integer; The processing unit is further used to select an m-th attribute dimension from the remaining attribute dimensions, and recursively divide the samples corresponding to the m-1-th level nodes based on the feature value of the m-th attribute feature of the sample under the m-th attribute dimension and the division rule under the m-th attribute feature to obtain the m-th level nodes, until the M-th level nodes are obtained, m∈[2,M]; The processing unit is further configured to, after obtaining the M-th level node, recursively divide the samples corresponding to the M-th level node based on the feature values ​​of the samples in other attribute features and the division rules under the corresponding attribute features until the division termination condition is reached; wherein the reference categories of the samples corresponding to any leaf node obtained by the recursive division are the same, and the root node and the nodes obtained by the recursive division constitute a decision tree; The processing unit is further used to generate a rule set by traversing the decision tree; a rule in the rule set includes: each partitioning rule adopted in a path from a root node to a leaf node of the decision tree.

9. A computer device, characterized in that: The computer device includes an input interface and an output interface, and also includes: a processor adapted to implement one or more instructions; and, A computer storage medium storing one or more instructions, wherein the one or more instructions are suitable for being loaded by the processor and executing the method for generating a rule set according to any one of claims 1 to 7.

10. A computer storage medium, characterized in that: The computer storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, they are used to execute the method for generating a rule set according to any one of claims 1 to 7.