Dynamic data classification method based on rule and learning hybrid model

By introducing the rule optimization of knowledge graph inference and reinforcement learning in the data classification method, as well as the improved dual contrast learning and dual attention mechanism, the model failure problem caused by data distribution changes is solved, the adaptability and accuracy of the classification system is improved, and the human intervention and false positive rate is reduced.

CN119989051AActive Publication Date: 2025-05-13SIDIBO SOFTWARE (BEIJING) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510079051.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-17
Publication Date
2025-05-13
Estimated Expiration
2045-01-17

AI Technical Summary

Technical Problem

When the existing data classification methods face changes in data distribution, the model is prone to failure, requiring retraining or complex parameter adjustments, and rules-based methods are difficult to adapt to data pattern changes. Machine learning-based methods have a ‘black box’ problem and are difficult to explain.

Method used

A dynamic data classification method based on a mixed model of rules and learning is proposed. Combined with knowledge graph reasoning and reinforcement learning, automatic generation and optimization of classification rules, the improved dual contrast learning method is used to optimize feature representation, and dynamic weight adjustment is performed through the improved dual attention mechanism.

Benefits of technology

The adaptability and automation level of the classification system are improved, the interpretability and learning ability of the rule model are enhanced, the generalization ability and classification accuracy of the learning model are improved, and the manual intervention and false positive rates are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119989051A_ABST
    Figure CN119989051A_ABST
Patent Text Reader

Abstract

The invention discloses a dynamic data classification method based on a rule and learning hybrid model, and the method comprises the following steps: S1, collecting multi-source input data in real time, and carrying out the preprocessing of the multi-source input data; s2, constructing a rule and learning hybrid model, and inputting the preprocessed data into the rule and learning hybrid model for classification; s3, weights of the rule model and the learning model under different data distributions are adaptively adjusted based on an improved double attention mechanism, and a preliminary classification result is optimized; s4, when it is detected that data distribution changes, the rule and learning hybrid model adjusts a rule set, and a classification result is optimized; and S5, applying the rule and learning mixed model to an actual classification task, and updating the rule model and the learning model in an operation process. According to the method, reinforcement learning and improved double contrast learning are adopted, dynamic data classification of the rule and learning hybrid model is achieved, and the method has the advantages of being high in adaptability, high in generalization ability and stable in classification precision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a dynamic data classification method based on a rule and learning hybrid model. Background Art

[0002] Data classification is a core task in the field of machine learning and data mining, and is widely used in many industries such as financial risk control, medical diagnosis, intelligent recommendation, autonomous driving, and network security. Existing data classification methods can be mainly divided into rule-based methods and machine learning-based methods. Rule-based methods usually rely on domain experts to manually formulate classification rules, such as decision trees, expert systems, and reasoning models based on knowledge graphs. The advantages of this type of method are clear classification logic and strong interpretability, but the rules are fixed and difficult to adapt to changes in data distribution. When the data pattern changes, the rule system often needs to be manually adjusted, resulting in poor system flexibility and difficulty in adapting to changes in real-time data streams.

[0003] On the other hand, machine learning-based methods (such as support vector machines, random forests, and deep neural networks) rely on large-scale training data to automatically learn data patterns and build classifiers. These methods can achieve high classification accuracy when the data volume is sufficient and the distribution is stable, but when the data distribution drifts, the model is prone to failure and requires retraining or complex parameter adjustments. In addition, deep learning models often have a "black box" problem, that is, classification decisions are difficult to explain, and are difficult to directly apply in scenarios with high interpretability requirements (such as finance, medical care, etc.).

[0004] In recent years, hybrid classification models have gradually become a research hotspot, that is, classification methods that combine rule models and learning models. Hybrid models attempt to integrate the interpretability of rule models and the adaptability of learning models, so that the system can not only perform logical reasoning based on rules, but also automatically optimize classification strategies using learning models. However, existing hybrid classification methods still have many limitations. First, the rules and learning parts of most hybrid classification models lack deep fusion, and only perform simple weighted fusion in the classification decision stage, but fail to perform collaborative optimization at the levels of feature representation and classification strategy. Secondly, the maintenance and updating of rule models still require a lot of manual intervention, and automatic rule generation and adaptive adjustment cannot be achieved. In addition, most existing fusion methods rely on fixed weighting mechanisms and fail to make adaptive adjustments to dynamic changes in data distribution, which may lead to a decline in classification performance during long-term operation.

[0005] Therefore, how to provide a dynamic data classification method based on a hybrid model of rules and learning is an urgent problem that technicians in this field need to solve. Summary of the invention

[0006] One purpose of the present invention is to propose a dynamic data classification method based on a rule and learning hybrid model. The present invention designs a rule and learning hybrid model, introduces knowledge graph reasoning and reinforcement learning into the rule model, automatically generates and optimizes classification rules, and reduces dependence on manually set rules. In the learning model, improved double contrast learning is adopted to optimize feature representation through contrast loss in feature space, category space and global space, thereby improving the generalization ability of the learning model in a data changing environment.

[0007] A dynamic data classification method based on a rule-based and learning hybrid model according to an embodiment of the present invention comprises the following steps:

[0008] S1, collect multi-source input data in real time, perform preprocessing, and generate preprocessed data;

[0009] S2, constructing a rule and learning hybrid model, inputting the preprocessed data into the rule and learning hybrid model for classification, outputting the classification confidence, and generating a preliminary classification result;

[0010] S3. According to the classification confidence, based on the improved dual attention mechanism, adaptively adjust the weights of the rule model and the learning model of the rule and learning hybrid model under different data distributions, optimize the preliminary classification results, and generate the final classification results;

[0011] S4, when a change in data distribution is detected, the rule and learning hybrid model adjusts the rule set to optimize the classification results;

[0012] S5. Apply the rule and learning hybrid model to the actual classification task, and update the rule model and the learning model during operation.

[0013] Optionally, the multi-source input data includes structured data and unstructured data, supporting parallel processing of stream data and batch data, the structured data includes database records, tabular data and log files, the unstructured data includes text, images, audio and video data, and the preprocessing includes format standardization, missing value filling, outlier detection, feature extraction and normalization.

[0014] Optionally, the S2 specifically includes:

[0015] S21, constructing a rule and learning hybrid model, inputting the preprocessed data into the rule and learning hybrid model, wherein the rule and learning hybrid model includes a rule model and a learning model, wherein the rule model includes a knowledge graph and a reinforcement learning model based on policy gradient optimization, and the learning model uses improved double contrast learning for feature learning;

[0016] S22. In the rule model, rules are generated based on the knowledge graph, and the rules are dynamically updated using a reinforcement learning model based on policy gradient optimization, and the weights of the rules are adjusted to generate classification results of the rule model based on the weights;

[0017] S23. In the learning model, improved double contrast learning is used for feature learning, and the joint loss is calculated. The gradient descent method is used to optimize the parameters, minimize the joint loss, and generate the classification result of the learning model.

[0018] S24. Calculate the classification confidence of the rule model and the classification confidence of the learning model according to the classification outputs of the rule model and the learning model:

[0019]

[0020] Among them, C r represents the classification confidence of the rule model, C l Represents the classification confidence of the learning model, y ri Represents the classification output of the i-th sample of the rule model, y li represents the classification output of the i-th sample of the learning model, P(·) represents the category probability distribution, and k represents the total number of samples;

[0021] S25. Calculate the preliminary classification results:

[0022]

[0023] Among them, Y f Indicates the preliminary classification results.

[0024] Optionally, the S22 specifically includes:

[0025] S221. Build the knowledge graph G and establish the rule mapping relationship:

[0026] G=(V,E),V={v1,v2,...,v n},E={e1,e2,...,e m};

[0027] Among them, G represents the knowledge graph, V represents the entity set, and each entity v n Corresponding to the key concepts in the input data, the key concepts include category labels and attribute values. E represents the set of relationships between entities. Each relationship e m Connect two entities to indicate their association;

[0028] Each relation e in the knowledge graph G m With weight w i , indicating the importance of the relationship, is set during initialization:

[0029]

[0030] Among them, w i Represents the relationship m The weight of |E| represents the total number of relationships;

[0031] S222, generate rules and define data set D:

[0032] D={d1,d2,...,d k};

[0033] Where D represents the data set, d k represents the kth data, k represents the total number of data, and each data d k By the feature vector X k express:

[0034] X k =(x k1 ,x k2 ,...,x kn );

[0035] Among them, X i represents the eigenvector, x kn Represents data instance d k The nth eigenvalue of , where n represents the total number of features;

[0036] Define a set of rules:

[0037] R={r1,r2,...,r p};

[0038] Among them, R represents the rule set, r p represents the pth rule, p represents the total number of rules, and each rule consists of a logical condition C(r p ) and decision D(r p )composition:

[0039]

[0040] Among them, r p represents the pth rule, C(r p ) represents the premise of the rule, D(r p ) represents the decision result of the rule, wherein the decision result is the data category and the predicted output;

[0041] S223. Adopt the reinforcement learning model optimization rule based on policy gradient optimization to build a reinforcement learning model based on policy gradient optimization:

[0042] M=(S,A,P,R);

[0043] Among them, M represents the reinforcement learning model, S represents the state space, which is the matching state between the current data and the rule set, A represents the rule adjustment operation set, and P represents the change from state s to s after executing operation a. ′ The probability of, R represents the reward function, which is used to measure the accuracy of rule classification:

[0044]

[0045] Among them, R represents the reward function, y k represents the true category, f r (X k ) represents the classification result of the rule model, δ represents the indicator function, which takes 1 if the classification is correct, otherwise it takes 0, R represents the reward function, which is used to measure the accuracy of the rule classification, and k represents the total number of data:

[0046] The rule adjustment operation set A includes:

[0047] Rule merging, merging similar rules i and r j ;

[0048] Rule refinement, refine the rule prerequisites C(r i );

[0049] Rule deletion, delete low-contribution rules;

[0050] S224. Dynamically adjust the importance of rules according to changes in data distribution and update rule weights:

[0051]

[0052] Among them, w′ i represents the updated rule weight, γ represents the rule update rate, and controls the rule importance adjustment rate, w i represents the rule weight of the previous round of training, k represents the total number of data, δ(y j ,f r (X j )) represents the indicator function, y j Represents data X j The real category of

[0053] S225. Calculate the classification result of the rule model according to the updated rule weight:

[0054]

[0055] Among them, y r Represents the classification result of the rule model, r j Represents the rule, δ(r j ,x i ) represents the sample xi Does it comply with the rules? j , w′ j represents the updated rule weight, c k represents a set of candidate categories, and argmax represents the variable value with the maximum value.

[0056] Optionally, the S23 specifically includes:

[0057] S231. Construct input feature matrix:

[0058] X∈R k×n ;

[0059] Among them, X represents the input feature matrix, k represents the total number of samples, n represents the total number of features, R represents the set of real numbers, and ∈ represents "belongs to";

[0060] Each sample x i By n-dimensional feature vector X i =(x i1 ,x i2 ,...,x in )composition;

[0061] S232, using improved double contrast learning for feature learning, contrast learning in feature space, for each sample x i Generate two samples from different perspectives to form a positive sample pair P f :

[0062]

[0063] Among them, P f represents a positive sample pair, and Represents positive samples from two different perspectives;

[0064] Select sample x j As negative samples, generate two samples from different perspectives to form a negative sample pair N f :

[0065]

[0066] Among them, N f represents a negative sample pair, and Represents negative samples from two different perspectives;

[0067] Calculate the feature similarity between positive sample pairs and negative sample pairs:

[0068]

[0069] Among them, S f (xi ,x j ) represents the feature similarity between the positive sample pair and the negative sample pair, h f (x i ) represents the feature embedding function, ∥∥ represents the norm, W2, W1, b1 and b2 represent the training parameters, σ represents the ReLU activation function, W p represents the projection matrix;

[0070] S233. Perform contrastive learning in the category space, construct a category label set, and generate positive and negative sample pairs:

[0071] P c ={(x i ,x j )|y i =y j};

[0072] N c ={(x i ,x j )|y i ≠y j};

[0073] Among them, P f represents a positive sample pair, N c represents a negative sample pair, y i and j Represents a category label set element;

[0074] Calculate the feature similarity between positive and negative sample pairs:

[0075]

[0076] Among them, S c (y i ,y j ) represents the feature similarity between positive and negative sample pairs, h c represents a category embedding function, wherein the category embedding function is mapped using a nonlinear transformation layer;

[0077] S234. Perform contrastive learning in the global space and calculate the global feature center:

[0078]

[0079] Among them, g represents the global feature center, h g Represents the graph neural network embedding function;

[0080] Calculate sample x i Similarity with the global feature center g:

[0081]

[0082] Among them, S g (x i ,g) represents the sample x i Similarity with the global feature center g, h g (x i ) represents the graph neural network embedding function;

[0083] S235. Calculate feature space contrast loss:

[0084]

[0085] Among them, L f represents the feature space contrast loss, τ f It represents the temperature parameter of feature contrast learning, which controls the distribution range of contrast loss. exp represents the natural exponential function.

[0086] Compute the class space contrast loss:

[0087]

[0088] Among them, L c represents the category space contrast loss, τ c represents the temperature parameter for class contrastive learning;

[0089] Calculate the global spatial contrast loss:

[0090]

[0091] Among them, L g represents the global spatial contrast loss, τ g represents the temperature parameter of global contrastive learning, P g Represents the positive sample pair between the sample and the global center, N g Represents the negative sample pair between the sample and the global center;

[0092] Calculate the joint loss:

[0093] L=αL f +βL c +γL g ;

[0094] Among them, L represents the joint loss, α, β and γ represent weighting coefficients;

[0095] S236, use the gradient descent method to optimize the parameters, minimize the joint loss, and finally generate the classification results of the learning model:

[0096]

[0097] Among them, y lrepresents the classification result of the learning model, f θ (·) indicates improved double contrastive learning, c k represents the candidate category set, θ represents the parameter for improving double contrast learning, and x i Represents a sample.

[0098] Optionally, the S3 specifically includes:

[0099] S31. Define the uncertainty of the rule model and use information entropy to measure classification stability:

[0100] P r = {P(y r1 ),P(y r2 ),...,P(y rk )};

[0101]

[0102] Among them, P r represents the predicted category distribution of the rule model, σ r represents the uncertainty of the rule model, P(y rk ) and P(y ri ) represents the category probability distribution of the rule model;

[0103] S32. Define the uncertainty of the learning model and use information entropy to measure classification stability:

[0104] P l = {P(y l1 ),P(y l2 ),...,P(y lk )};

[0105]

[0106] Among them, P l represents the predicted category distribution of the learning model, σ l represents the uncertainty of the learning model, P(y lk ) and P(y li ) represents the category probability distribution of the rule model;

[0107] S33. Define adaptive weights:

[0108]

[0109] Among them, λ a represents adaptive weight;

[0110] S34. Using an improved dual attention mechanism, calculating a feature attention matrix, and weighting and adjusting the feature attention matrix to obtain a feature classification result, wherein the improved dual attention mechanism includes feature attention and category attention:

[0111]

[0112] Y′ f =A f ·Y f ;

[0113] Among them, A f represents the feature attention matrix, softmax represents normalization, Q and K represent the query vector of the input feature matrix and the output vector of the rule and learning model, d represents the feature dimension, T represents the transposition operation, and Y f represents the preliminary classification result, Y′ f Indicates the feature classification result;

[0114] S35. Calculate the category attention matrix, and adjust the category attention matrix based on the classification confidence and adaptive weight:

[0115]

[0116] Y′ c =A c ·Y′ f ;

[0117] Among them, A c represents the category attention matrix, softmax represents normalization, Q c and K c They represent the query vector of the category label and the category output vector of the rule and learning model, respectively. c represents the category label dimension, T represents the transposition operation, and C r represents the classification confidence of the rule model, C l represents the classification confidence of the learning model, λ a represents the adaptive weight, Y′ f Represents the feature classification result, Y′ c Indicates the final classification result.

[0118] The beneficial effects of the present invention are:

[0119] First, this method introduces knowledge graph reasoning and reinforcement learning into the rule model, which can dynamically generate and optimize rules according to the characteristics of new data, so that the rule model no longer relies on fixed expert knowledge, but can automatically learn data patterns through inductive logic reasoning, and dynamically update and adjust the weights of the rules in combination with reinforcement learning based on policy gradient optimization. This method not only enhances the adaptability of the rule model, enabling it to remain effective when the data distribution changes, but also reduces the reliance on manually set rules and improves the automation level of the classification system. In addition, the rule reasoning mechanism based on the knowledge graph can mine high-order feature relationships in complex data environments, making the reasoning ability of the rule model more robust, thereby improving the scalability and learning ability of the rule model.

[0120] Secondly, in the learning model, an improved dual contrastive learning method is adopted to perform contrastive learning in feature space, category space and global space respectively, so that the learning model can more fully extract data patterns and improve classification accuracy. Contrastive learning in feature space enhances the discrimination of sample features, contrastive learning in category space optimizes intra-class aggregation and inter-class separation, and contrastive learning in global space ensures the stability of the overall feature distribution. Through this multi-level optimization strategy, the learning model can still maintain a high generalization ability in the face of data distribution drift, so that it can stably adapt to new data during long-term operation and improve the accuracy and reliability of data classification.

[0121] Finally, this method improves the dual attention mechanism and establishes a dynamic weight adjustment strategy between the rule model and the learning model. Different from the traditional fixed weighted fusion method, the adaptive fusion strategy of the present invention can calculate the weights of the rule model and the learning model based on the classification confidence, and adjust their contribution ratios under different data distributions, thereby ensuring the optimality of the classification decision. Combined with the uncertainty measurement method of information entropy, the present invention can adjust the classification strategy according to the real-time changes in data distribution, so that the classification system can operate stably for a long time and avoid the model degradation problem caused by data distribution drift. BRIEF DESCRIPTION OF THE DRAWINGS

[0122] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0123] Figure 1 A flow chart of a dynamic data classification method based on a rule-based and learning hybrid model proposed by the present invention;

[0124] Figure 2 This is a flow chart for constructing a rule and learning hybrid model for a dynamic data classification method based on a rule and learning hybrid model proposed by the present invention. DETAILED DESCRIPTION

[0125] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.

[0126] refer to Figure 1 and Figure 2 , a dynamic data classification method based on rule and learning hybrid model, comprising the following steps:

[0127] S1, collect multi-source input data in real time, perform preprocessing, and generate preprocessed data;

[0128] S2, constructing a rule and learning hybrid model, inputting the preprocessed data into the rule and learning hybrid model for classification, outputting the classification confidence, and generating a preliminary classification result;

[0129] S3. According to the classification confidence, based on the improved dual attention mechanism, adaptively adjust the weights of the rule model and the learning model of the rule and learning hybrid model under different data distributions, optimize the preliminary classification results, and generate the final classification results;

[0130] S4, when a change in data distribution is detected, the rule and learning hybrid model adjusts the rule set to optimize the classification results;

[0131] S5. Apply the rule and learning hybrid model to the actual classification task, and update the rule model and the learning model during operation.

[0132] In this embodiment, the multi-source input data includes structured data and unstructured data, and supports parallel processing of stream data and batch data. The structured data includes database records, tabular data and log files, and the unstructured data includes text, images, audio and video data. The preprocessing includes format standardization, missing value filling, outlier detection, feature extraction and normalization.

[0133] In this implementation, S2 specifically includes:

[0134] S21, constructing a rule and learning hybrid model, inputting the preprocessed data into the rule and learning hybrid model, wherein the rule and learning hybrid model includes a rule model and a learning model, wherein the rule model includes a knowledge graph and a reinforcement learning model based on policy gradient optimization, and the learning model uses improved double contrast learning for feature learning;

[0135] S22. In the rule model, rules are generated based on the knowledge graph, and the rules are dynamically updated using a reinforcement learning model based on policy gradient optimization, and the weights of the rules are adjusted to generate classification results of the rule model based on the weights;

[0136] S23. In the learning model, improved double contrast learning is used for feature learning, and the joint loss is calculated. The gradient descent method is used to optimize the parameters, minimize the joint loss, and generate the classification result of the learning model.

[0137] S24. Calculate the classification confidence of the rule model and the classification confidence of the learning model according to the classification outputs of the rule model and the learning model:

[0138]

[0139] Among them, C r represents the classification confidence of the rule model, C l Represents the classification confidence of the learning model, y ri Represents the classification output of the i-th sample of the rule model, y li represents the classification output of the i-th sample of the learning model, P(·) represents the category probability distribution, and k represents the total number of samples;

[0140] S25. Calculate the preliminary classification results:

[0141]

[0142] Among them, Y f Indicates the preliminary classification results.

[0143] In this implementation manner, the S22 specifically includes:

[0144] S221. Build the knowledge graph G and establish the rule mapping relationship:

[0145] G=(V,E),V={v1,v2,...,v n},E={e1,e2,...,e m};

[0146] Among them, G represents the knowledge graph, V represents the entity set, and each entity v n Corresponding to the key concepts in the input data, the key concepts include category labels and attribute values. E represents the set of relationships between entities. Each relationship e m Connect two entities to indicate their association;

[0147] Each relation e in the knowledge graph G m With weight w i , indicating the importance of the relationship, is set during initialization:

[0148]

[0149] Among them, w i Represents the relationship mThe weight of |E| represents the total number of relationships;

[0150] S222, generate rules and define data set D:

[0151] D={d1,d2,...,d k};

[0152] Where D represents the data set, d k represents the kth data, k represents the total number of data, and each data d k By the feature vector X k express:

[0153] X k =(x k1 ,x k2 ,...,x kn );

[0154] Among them, X i represents the eigenvector, x kn Represents data instance d k The nth eigenvalue of , where n represents the total number of features;

[0155] Define a set of rules:

[0156] R={r1,r2,...,r p};

[0157] Among them, R represents the rule set, r p represents the pth rule, p represents the total number of rules, and each rule consists of a logical condition C(r p ) and decision D(r p )composition:

[0158]

[0159] Among them, r p represents the pth rule, C(r p ) represents the premise of the rule, D(r p ) represents the decision result of the rule, wherein the decision result is the data category and the predicted output;

[0160] S223. Adopt the reinforcement learning model optimization rule based on policy gradient optimization to build a reinforcement learning model based on policy gradient optimization:

[0161] M=(S,A,P,R);

[0162] Among them, M represents the reinforcement learning model, S represents the state space, which is the matching state between the current data and the rule set, A represents the rule adjustment operation set, and P represents the change from state s to s after executing operation a. ′The probability of, R represents the reward function, which is used to measure the accuracy of rule classification:

[0163]

[0164] Among them, R represents the reward function, y k represents the true category, f r (X k ) represents the classification result of the rule model, δ represents the indicator function, which takes 1 if the classification is correct, otherwise it takes 0, R represents the reward function, which is used to measure the accuracy of the rule classification, and k represents the total number of data:

[0165] The rule adjustment operation set A includes:

[0166] Rule merging, merging similar rules i and r j ;

[0167] Rule refinement, refine the rule prerequisites C(r i );

[0168] Rule deletion, delete low-contribution rules;

[0169] S224. Dynamically adjust the importance of rules according to changes in data distribution and update rule weights:

[0170]

[0171] Among them, w′ i represents the updated rule weight, γ represents the rule update rate, and controls the rule importance adjustment rate, w i represents the rule weight of the previous round of training, k represents the total number of data, δ(y j ,f r (X j )) represents the indicator function, y j Represents data X j The real category of

[0172] S225. Calculate the classification result of the rule model according to the updated rule weight:

[0173]

[0174] Among them, y r Represents the classification result of the rule model, r j Represents the rule, δ(r j ,x i ) represents the sample x i Does it comply with the rules? j , w′ j represents the updated rule weight, c krepresents a set of candidate categories, and argmax represents the variable value with the maximum value.

[0175] In this implementation manner, the S23 specifically includes:

[0176] S231. Construct input feature matrix:

[0177] X∈R k×n ;

[0178] Among them, X represents the input feature matrix, k represents the total number of samples, n represents the total number of features, R represents the set of real numbers, and ∈ represents "belongs to";

[0179] Each sample x i By n-dimensional feature vector X i =(x i1 ,x i2 ,...,x in )composition;

[0180] S232, using improved double contrast learning for feature learning, contrast learning in feature space, for each sample x i Generate two samples from different perspectives to form a positive sample pair P f :

[0181]

[0182] Among them, P f represents a positive sample pair, and Represents positive samples from two different perspectives;

[0183] Select sample x j As negative samples, generate two samples from different perspectives to form a negative sample pair N f :

[0184]

[0185] Among them, N f represents a negative sample pair, and Represents negative samples from two different perspectives;

[0186] Calculate the feature similarity between positive sample pairs and negative sample pairs:

[0187]

[0188] Among them, S f (x i ,x j ) represents the feature similarity between the positive sample pair and the negative sample pair, h f (x i) represents the feature embedding function, ∥∥ represents the norm, W2, W1, b1 and b2 represent the training parameters, σ represents the ReLU activation function, W p represents the projection matrix;

[0189] S233. Perform contrastive learning in the category space, construct a category label set, and generate positive and negative sample pairs:

[0190] P c ={(x i ,x j )|y i =y j};

[0191] N c ={(x i ,x j )|y i ≠y j};

[0192] Among them, P f represents a positive sample pair, N c represents a negative sample pair, y i and j Represents a category label set element;

[0193] Calculate the feature similarity between positive and negative sample pairs:

[0194]

[0195] Among them, S c (y i ,y j ) represents the feature similarity between positive and negative sample pairs, h c represents a category embedding function, wherein the category embedding function is mapped using a nonlinear transformation layer;

[0196] S234. Perform contrastive learning in the global space and calculate the global feature center:

[0197]

[0198] Among them, g represents the global feature center, h g Represents the graph neural network embedding function;

[0199] Calculate sample x i Similarity with the global feature center g:

[0200]

[0201] Among them, S g (x i ,g) represents the sample x iSimilarity with the global feature center g, h g (x i ) represents the graph neural network embedding function;

[0202] S235. Calculate feature space contrast loss:

[0203]

[0204] Among them, L f represents the feature space contrast loss, τ f It represents the temperature parameter of feature contrast learning, which controls the distribution range of contrast loss. exp represents the natural exponential function.

[0205] Compute the class space contrast loss:

[0206]

[0207] Among them, L c represents the category space contrast loss, τ c represents the temperature parameter for class contrastive learning;

[0208] Calculate the global spatial contrast loss:

[0209]

[0210] Among them, L g represents the global spatial contrast loss, τ g represents the temperature parameter of global contrastive learning, P g Represents the positive sample pair between the sample and the global center, N g Represents the negative sample pair between the sample and the global center;

[0211] Calculate the joint loss:

[0212] L=αL f +βL c +γL g ;

[0213] Among them, L represents the joint loss, α, β and γ represent weighting coefficients;

[0214] S236, use the gradient descent method to optimize the parameters, minimize the joint loss, and finally generate the classification results of the learning model:

[0215]

[0216] Among them, y l represents the classification result of the learning model, f θ (·) indicates improved double contrastive learning, c k represents the candidate category set, θ represents the parameter for improving double contrast learning, and xi Represents a sample.

[0217] In this implementation, S3 specifically includes:

[0218] S31. Define the uncertainty of the rule model and use information entropy to measure classification stability:

[0219] P r = {P(y r1 ),P(y r2 ),...,P(y rk )};

[0220]

[0221] Among them, P r represents the predicted category distribution of the rule model, σ r represents the uncertainty of the rule model, P(y rk ) and P(y ri ) represents the category probability distribution of the rule model;

[0222] S32. Define the uncertainty of the learning model and use information entropy to measure classification stability:

[0223] P l = {P(y l1 ),P(y l2 ),...,P(y lk )};

[0224]

[0225] Among them, P l represents the predicted category distribution of the learning model, σ l represents the uncertainty of the learning model, P(y lk ) and P(y li ) represents the category probability distribution of the rule model;

[0226] S33. Define adaptive weights:

[0227]

[0228] Among them, λ a represents adaptive weight;

[0229] S34. Using an improved dual attention mechanism, calculating a feature attention matrix, and weighting and adjusting the feature attention matrix to obtain a feature classification result, wherein the improved dual attention mechanism includes feature attention and category attention:

[0230]

[0231] Y′ f =A f ·Y f ;

[0232] Among them, A f represents the feature attention matrix, softmax represents normalization, Q and K represent the query vector of the input feature matrix and the output vector of the rule and learning model, d represents the feature dimension, T represents the transposition operation, and Y f represents the preliminary classification result, Y′ f Indicates the feature classification result;

[0233] S35. Calculate the category attention matrix, and adjust the category attention matrix based on the classification confidence and adaptive weight:

[0234]

[0235] Y′ c =A c ·Y′ f ;

[0236] Among them, A c represents the category attention matrix, softmax represents normalization, Q c and K c They represent the query vector of the category label and the category output vector of the rule and learning model, respectively. c represents the category label dimension, T represents the transposition operation, and C r represents the classification confidence of the rule model, C l represents the classification confidence of the learning model, λ a represents the adaptive weight, Y′ f Represents the feature classification result, Y′ c Indicates the final classification result.

[0237] Embodiment 1:

[0238] In order to verify the feasibility of the present invention in implementation, the present invention is applied to the real-time transaction anti-fraud system of a large commercial bank. The bank processes more than 20 million credit card transactions every day, of which fraudulent transactions account for about 1.2%, that is, about 240,000 fraudulent transactions need to be accurately identified every day. Traditional rule-based methods are prone to failure when facing new fraud methods because they rely on manually set rules. Although deep learning-based methods can automatically learn transaction patterns, they often have weak generalization capabilities when fraudulent transactions change, resulting in high false positive rates or increased false negative rates.

[0239] In the method of the present invention, the transaction data is first preprocessed, including format standardization, outlier detection and feature extraction, and then input into the rule and learning hybrid model. The rule model uses knowledge graph reasoning to generate rules based on historical fraudulent transaction patterns, and combines reinforcement learning based on policy gradient optimization to optimize the rules to ensure that the rules can be adaptively adjusted. The learning model uses improved dual contrast learning to perform contrast learning in feature space, category space and global space respectively to improve the model's ability to extract fraudulent transaction patterns. After the two are combined, they are fused through an improved dual attention mechanism to dynamically adjust the classification decision to ensure the accuracy of the classification results.

[0240] In order to objectively evaluate the classification performance of different methods, comparisons were made on five indicators: recall rate, precision rate, F1-Score, and false alarm rate calculation delay.

[0241] Table 1 Experimental data comparison table

[0242] Indicators\Methods Rule-based Based on deep learning Based on the present invention Recall 82.3% 88.7% 94.5% Accuracy 74.5% 80.1% 91.2% F1-Score 78.2% 84.2% 92.8% False Positive Rate 4.3% 3.1% 1.6% Calculation delay (ms) 32.5 48.7 39.1

[0243] This experiment compares the performance of traditional rule-based methods, deep learning methods, and the rule and learning hybrid model of the present invention in fraudulent transaction detection tasks, and analyzes five core indicators, including recall rate, precision rate, F1-Score, false alarm rate, and computational latency, to evaluate the advantages and disadvantages of different methods in practical applications.

[0244] In terms of recall rate, the traditional rule-based method can capture a certain proportion of fraudulent transactions with a recall rate of 82.3%, while the deep learning method can automatically learn data patterns, and the recall rate is increased to 88.7%. The present invention adopts a hybrid model of rules and learning, combines the rule optimization mechanism of knowledge graph reasoning and reinforcement learning, and improves the feature representation by improving the double contrast learning method, so that the recall rate reaches 94.5%, which is significantly higher than the traditional method. This shows that the present method can detect more fraudulent transactions, reduce missed reports, and improve risk identification capabilities.

[0245] In terms of accuracy, the traditional rule-based method relies on fixed rules, so it has a high false alarm rate when dealing with new fraud methods, resulting in an accuracy rate of only 74.5%. The deep learning method reduces false alarms to a certain extent and improves the accuracy rate to 80.1%. The method of the present invention combines the interpretability of the rule model and the generalization ability of the learning model, and optimizes the classification weights through an improved dual attention mechanism, so that the accuracy rate is increased to 91.2%, significantly reducing the false positive rate. This shows that the present method can not only identify more fraudulent transactions, but also reduce false alarms and avoid interference with normal transaction users.

[0246] In terms of F1-Score, the F1-Score of the traditional rule-based method is 78.2%, the deep learning method is improved to 84.2%, and the method of the present invention reaches 92.8%, which shows that the present method can maintain a high recall rate while still ensuring a high precision rate, making the overall classification performance more balanced.

[0247] In terms of false alarm rate, the traditional rule-based method has a high false alarm rate of 4.3%, which means that about 4.3 normal transactions out of every 100 transactions are misjudged as fraudulent transactions. The deep learning method reduces the false alarm rate to 3.1%, but there are still some misjudgments. The present invention adopts a rule optimization method based on knowledge graph and reinforcement learning, combined with a dynamic weighted fusion strategy based on classification confidence, to reduce the false alarm rate to 1.6%, which is much lower than the traditional method. This shows that the method of the present invention greatly reduces misjudgments and improves user experience while ensuring the identification of fraudulent transactions.

[0248] In terms of computing delay, the traditional rule-based method is faster, with an average delay of 32.5ms, while the deep learning method has a longer computing delay of 48.7ms due to the complex neural network calculation involved. While ensuring high classification accuracy, the method of the present invention optimizes computing efficiency, keeping the computing delay at 39.1ms, which is close to the traditional rule-based method and significantly lower than the deep learning method, ensuring the real-time performance of the system in a high-concurrency trading environment.

[0249] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A dynamic data classification method based on a rule-based and learning hybrid model, characterized in that: The steps include: S1, collect multi-source input data in real time, perform preprocessing, and generate preprocessed data; S2, constructing a rule and learning hybrid model, inputting the preprocessed data into the rule and learning hybrid model for classification, outputting the classification confidence, and generating a preliminary classification result; S3. According to the classification confidence, based on the improved dual attention mechanism, adaptively adjust the weights of the rule model and the learning model of the rule and learning hybrid model under different data distributions, optimize the preliminary classification results, and generate the final classification results; S4, when a change in data distribution is detected, the rule and learning hybrid model adjusts the rule set to optimize the classification results; S5. Apply the rule and learning hybrid model to the actual classification task, and update the rule model and the learning model during operation.

2. A dynamic data classification method based on a rule-based and learning hybrid model according to claim 1, characterized in that: The multi-source input data includes structured data and unstructured data, and supports parallel processing of stream data and batch data. The structured data includes database records, tabular data and log files, and the unstructured data includes text, image, audio and video data. The preprocessing includes format standardization, missing value filling, outlier detection, feature extraction and normalization.

3. A dynamic data classification method based on rule and learning hybrid model according to claim 1, characterized in that: The S2 specifically includes: S21, constructing a rule and learning hybrid model, inputting the preprocessed data into the rule and learning hybrid model, wherein the rule and learning hybrid model includes a rule model and a learning model, wherein the rule model includes a knowledge graph and a reinforcement learning model based on policy gradient optimization, and the learning model uses improved double contrast learning for feature learning; S22. In the rule model, rules are generated based on the knowledge graph, and the rules are dynamically updated using a reinforcement learning model based on policy gradient optimization, and the weights of the rules are adjusted to generate classification results of the rule model based on the weights; S23. In the learning model, improved double contrast learning is used for feature learning, and the joint loss is calculated. The gradient descent method is used to optimize the parameters, minimize the joint loss, and generate the classification result of the learning model. S24. Calculate the classification confidence of the rule model and the classification confidence of the learning model according to the classification outputs of the rule model and the learning model: Among them, C r represents the classification confidence of the rule model, C l Represents the classification confidence of the learning model, y ri Represents the classification output of the i-th sample of the rule model, y li represents the classification output of the i-th sample of the learning model, P(·) represents the category probability distribution, and k represents the total number of samples; S25. Calculate the preliminary classification results: Among them, Y f Indicates the preliminary classification results.

4. A dynamic data classification method based on rule and learning hybrid model according to claim 1, characterized in that: The S22 specifically includes: S221. Build the knowledge graph G and establish the rule mapping relationship: G=(V,E),V={v1,v2,...,v n },E={e1,e2,...,e m }; Among them, G represents the knowledge graph, V represents the entity set, and each entity v n Corresponding to the key concepts in the input data, the key concepts include category labels and attribute values. E represents the set of relationships between entities. Each relationship e m Connect two entities to indicate their association; Each relation e in the knowledge graph G m With weight w i , indicating the importance of the relationship, is set during initialization: Among them, w i Represents the relationship m The weight of |E| represents the total number of relationships; S222, generate rules and define data set D: D={d1,d2,...,d k }; Where D represents the data set, d k represents the kth data, k represents the total number of data, and each data d k By the feature vector X k express: X k =(x k1 ,x k2 ,...,x kn ); Among them, X i represents the eigenvector, x kn Represents data instance d k The nth eigenvalue of , where n represents the total number of features; Define a set of rules: R={r1,r2,...,r p}; Among them, R represents the rule set, r p represents the pth rule, p represents the total number of rules, and each rule consists of a logical condition C(r p ) and decision D(r p )composition: Among them, r p represents the pth rule, C(r p ) represents the premise of the rule, D(r p ) represents the decision result of the rule, wherein the decision result is the data category and the predicted output; S223. Adopt the reinforcement learning model optimization rule based on policy gradient optimization to build a reinforcement learning model based on policy gradient optimization: M=(S,A,P,R); Among them, M represents the reinforcement learning model, S represents the state space, which is the matching state between the current data and the rule set, A represents the rule adjustment operation set, and P represents the change from state s to s after executing operation a. ′ The probability of, R represents the reward function, which is used to measure the accuracy of rule classification: Among them, R represents the reward function, y k represents the true category, f r (X k ) represents the classification result of the rule model, δ represents the indicator function, which takes 1 if the classification is correct, otherwise it takes 0, R represents the reward function, which is used to measure the accuracy of the rule classification, and k represents the total number of data: The rule adjustment operation set A includes: Rule merging, merging similar rules i and r j ; Rule refinement, refine the rule prerequisites C(r i ); Rule deletion, delete low-contribution rules; S224. Dynamically adjust the importance of rules according to changes in data distribution and update rule weights: Among them, w′ i represents the updated rule weight, γ represents the rule update rate, and controls the rule importance adjustment rate, w i represents the rule weight of the previous round of training, k represents the total number of data, δ(y j ,f r (X j )) represents the indicator function, y j Represents data X j The real category of S225. Calculate the classification result of the rule model according to the updated rule weight: Among them, y r Represents the classification result of the rule model, r j Represents the rule, δ(r j ,x i ) represents the sample x i Does it comply with the rules? j , w′ j represents the updated rule weight, c k represents a set of candidate categories, and argmax represents the variable value with the maximum value.

5. The method for dynamic data classification based on a rule-based and learning hybrid model according to claim 1, characterized in that: The S23 specifically includes: S231. Construct input feature matrix: X∈R k×n ; Among them, X represents the input feature matrix, k represents the total number of samples, n represents the total number of features, R represents the set of real numbers, and ∈ represents "belongs to"; Each sample x i By n-dimensional feature vector X i =(x i1 ,x i2 ,...,x in )composition; S232, using improved double contrast learning for feature learning, contrast learning in feature space, for each sample x i Generate two samples from different perspectives to form a positive sample pair P f : Among them, P f represents a positive sample pair, and Represents positive samples from two different perspectives; Select sample x j As negative samples, generate two samples from different perspectives to form a negative sample pair N f : Among them, N f represents a negative sample pair, and Represents negative samples from two different perspectives; Calculate the feature similarity between positive sample pairs and negative sample pairs: Among them, S f (x i ,x j ) represents the feature similarity between the positive sample pair and the negative sample pair, h f (x i ) represents the feature embedding function, ∥∥ represents the norm, W2, W1, b1 and b2 represent the training parameters, σ represents the ReLU activation function, W p represents the projection matrix; S233. Perform contrastive learning in the category space, construct a category label set, and generate positive and negative sample pairs: P c ={(x i ,x j )|and i =and j }; N c ={(x i ,x j )|y i ≠y j }; Among them, P f represents a positive sample pair, N c represents a negative sample pair, y i and j Represents a category label set element; Calculate the feature similarity between positive and negative sample pairs: Among them, S c (y i ,y j ) represents the feature similarity between positive and negative sample pairs, h c represents a category embedding function, wherein the category embedding function is mapped using a nonlinear transformation layer; S234. Perform contrastive learning in the global space and calculate the global feature center: Among them, g represents the global feature center, h g Represents the graph neural network embedding function; Calculate sample x i Similarity with the global feature center g: Among them, S g (x i ,g) represents the sample x i Similarity with the global feature center g, h g (x i ) represents the graph neural network embedding function; S235. Calculate feature space contrast loss: Among them, L f represents the feature space contrast loss, τ f It represents the temperature parameter of feature contrast learning, which controls the distribution range of contrast loss. exp represents the natural exponential function. Compute the class space contrast loss: Among them, L c represents the category space contrast loss, τ c represents the temperature parameter for class contrastive learning; Calculate the global spatial contrast loss: Among them, L g represents the global spatial contrast loss, τ g represents the temperature parameter of global contrastive learning, P g Represents the positive sample pair between the sample and the global center, N g Represents the negative sample pair between the sample and the global center; Calculate the joint loss: L=αL f +βL c +γL g ; Among them, L represents the joint loss, α, β and γ represent weighting coefficients; S236, use the gradient descent method to optimize the parameters, minimize the joint loss, and finally generate the classification results of the learning model: Among them, y l represents the classification result of the learning model, f θ (·) indicates improved double contrastive learning, c k represents the candidate category set, θ represents the parameter for improving double contrast learning, and x i Represents a sample.

6. A dynamic data classification method based on rule and learning hybrid model according to claim 1, characterized in that: The S3 specifically includes: S31. Define the uncertainty of the rule model and use information entropy to measure classification stability: P r ={P(y r1 ),P(y r2 ),...,P(y rk )}; Among them, P r represents the predicted category distribution of the rule model, σ r represents the uncertainty of the rule model, P(y rk ) and P(y ri ) represents the category probability distribution of the rule model; S32. Define the uncertainty of the learning model and use information entropy to measure classification stability: P l ={P(y l1 ),P(y l2 ),...,P(y lk )}; Among them, P l represents the predicted category distribution of the learning model, σ l represents the uncertainty of the learning model, P(y lk ) and P(y li ) represents the category probability distribution of the rule model; S33. Define adaptive weights: Among them, λ a represents adaptive weight; S34. Using an improved dual attention mechanism, calculating a feature attention matrix, and weighting and adjusting the feature attention matrix to obtain a feature classification result, wherein the improved dual attention mechanism includes feature attention and category attention: AND' f =A f ·AND f ; Among them, A f represents the feature attention matrix, softmax represents normalization, Q and K represent the query vector of the input feature matrix and the output vector of the rule and learning model, d represents the feature dimension, T represents the transposition operation, and Y f represents the preliminary classification result, Y′ f Indicates the feature classification result; S35. Calculate the category attention matrix, and adjust the category attention matrix based on the classification confidence and adaptive weight: AND' c =A c ·AND' f ; Among them, A c represents the category attention matrix, softmax represents normalization, Q c and K c They represent the query vector of the category label and the category output vector of the rule and learning model, respectively. c represents the category label dimension, T represents the transposition operation, and C r represents the classification confidence of the rule model, C l represents the classification confidence of the learning model, λ a represents the adaptive weight, Y′ f Represents the feature classification result, Y′ c Indicates the final classification result.

Citation Information

Patent Citations

  • Junk mail classification method based on sample difficulty

    CN111582365A

  • Underwater target identification method based on multi-deep learning model joint judgment system

    CN113673323A

  • Multi-granularity attribute forgetting method for sensitive data classification

    CN118245882A

  • Extraction of Anomaly Related Rules Using Data Mining and Machine Learning

    US20200242417A1

  • Learning method, learning program, learning device, and learning system

    WO2019022136A1