Real-time data stream cleaning and monitoring system
Through the real-time data flow cleaning and monitoring system, machine learning algorithms and cleaning rules are used to solve the problem of low efficiency of the existing system in processing large-scale data flows, realize real-time cleaning and monitoring of data, and improve the accuracy and accuracy of data. processing efficiency.
Patent Information
- Application Number
- CN202411313246.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-10-29
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When the existing data cleaning system processes large-scale data flows, as the amount of data increases, the response speed and cleaning efficiency are seriously affected, and it cannot meet the real-time requirements.
A real-time data flow cleaning and monitoring system is designed, including a data capture module, a data preprocessing module, a cleaning rule application module, a machine learning cleaning module, a real-time monitoring and visualization module, a data storage module and an interface module. Through noisy data cleaning rules, exceptions Value cleaning rules and duplicate cleaning rules are combined with machine learning algorithms to clean data and support continuous optimization of the model.
It realizes real-time processing of data streams, comprehensively identifies and removes noise, outliers, and duplicates, improves the purity and accuracy of data, significantly improves data processing efficiency, and meets real-time requirements.
Smart Images

Figure CN118861024A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data stream cleaning, and in particular to a real-time data stream cleaning and monitoring system. Background Art
[0002] In the current field of real-time data stream processing, data cleaning is a crucial link. However, existing data cleaning systems often have multiple problems, which affect the efficiency and accuracy of data processing. When existing systems process large-scale data streams, as the amount of data continues to increase, the system's response speed and cleaning efficiency will be seriously affected and cannot meet real-time requirements.
[0003] Therefore, we made improvements to this and proposed a real-time data stream cleaning and monitoring system. Summary of the invention
[0004] The purpose of the present invention is to address the problem that when existing systems process large-scale data streams, as the amount of data continues to increase, the response speed and cleaning efficiency of the system will be seriously affected and cannot meet the real-time requirements.
[0005] In order to achieve the above-mentioned purpose of the invention, the present invention provides a real-time data stream cleaning and monitoring system to improve the above-mentioned problem.
[0006] The specific application is as follows: Includes the following modules: A data capture module, used to capture the data stream of a data source in real time; A data preprocessing module, connected to the data capture module, is used to perform preliminary processing on the received raw data; A cleaning rule application module, connected to the data preprocessing module, is used to automatically identify and remove noise, outliers and duplicates in the data according to predefined cleaning rules; The machine learning cleaning module is connected to the cleaning rule application module and is used to further clean the data through the machine learning algorithm; The real-time monitoring and visualization module is connected to the machine learning cleaning module to display the progress and results of data cleaning in real time and provide data comparison before and after cleaning; A data storage module, connected to the real-time monitoring and visualization module, for storing cleaned data; The interface module is connected to the data storage module and is used to provide an API interface to achieve data sharing and exchange.
[0007] As the preferred technical solution of this application, the cleaning rules include: Noise data cleaning rules, outlier cleaning rules and duplicate item cleaning rules. The noise data cleaning rules specifically include: Rule 1.1: Remove blank values and empty strings. If a data field is empty or contains only spaces, it is considered invalid data and removed. Rule 1.2: Remove non-printing characters, control characters and special symbols should be identified and removed; Rule 1.3: Format text data. For text fields, remove extra spaces, line breaks, and tabs to ensure consistent formatting of the data.
[0008] As the preferred technical solution of this application, the outlier cleaning rules specifically include: Rule 2.1: Range filtering, defining the reasonable range of the data, including the age field should be between 0 and 120, and values outside this range are considered outliers and removed; Rule 2.2: Statistical outlier detection, using the interquartile range method to identify and remove statistical outliers; Rule 2.3: Outlier detection based on business rules includes that if a field represents an email address but the data does not conform to the format of an email address, the data is considered an outlier.
[0009] As the preferred technical solution of this application, the duplicate item cleaning rules specifically include: Rule 3.1: Complete duplicates are removed. If two or more rows of data are exactly the same in all fields, they are considered duplicates and only one row is retained; Rule 3.2: Remove duplicates from key fields. Define key fields, including ID and email address. If these key fields are repeated, remove the duplicate rows and keep only one row. Rule 3.3: Near-duplicate detection and removal. For text fields, use fuzzy matching algorithms, including Levenshtein distance and Jaccard similarity, to detect near-duplicate data, and remove and merge these duplicates.
[0010] As a preferred technical solution of this application, a machine learning cleaning module is connected to the cleaning rule application module and is used to further clean the data through a machine learning algorithm, specifically including the following steps: S1. Data preparation and preprocessing: Collect and organize the data sets that need to be cleaned; Fill missing values and delete records with missing values; Encode categorical features and convert them into numerical data; Perform feature scaling to ensure that all features have the same influence in the model; S2. Data labeling: Mark the records in the data set to distinguish normal and abnormal data points. Normal data refers to data that is more than 60% identical to the data in the data set, and abnormal data refers to data that is more than 60% different from the data in the data set. S3. Divide the dataset: Divide the dataset into training, validation and test sets; S4. Training Gradient Boosting Tree Model: Train a gradient boosted tree classification model using the training set to distinguish between normal and anomalous data points; S5. Model verification and tuning: Use the validation set to validate the model and evaluate the performance of the model; Adjust model parameters based on validation results to improve model accuracy and generalization ability; S6. Outlier Detection: Apply the trained model to the test set; The model outputs a predicted probability of belonging to the normal class for each data point; S7. Set thresholds and cleaning rules: Set a prediction probability threshold, specifically 0.6. Data points with prediction probabilities lower than the threshold are considered outliers and need to be cleaned. S8. Data cleaning: According to the cleaning rules, the data points predicted to be abnormal are cleaned; The cleaning method is Delete.
[0011] As a preferred technical solution of the present application, in S4, a gradient boosting tree classification model is trained using the training set to distinguish normal and abnormal data points, specifically including the following steps: S400, Data Preparation: Load and preprocess the data set and divide the data into feature sets and label sets ; S401. Initialize model: set initial prediction value , in classification problems this is usually a log-odds , represents the initial prediction that the sample belongs to the positive class, which can be obtained by calculating the ratio of positive samples to negative samples in the training set; S402, iterative construction of gradient boosting tree: for each round of iteration From 1 to the maximum number of iterations ; S403, termination condition and output: when the maximum number of iterations is reached Stop iteration and output the final model , which is the weighted sum of the trees built in all iterations.
[0012] As a preferred technical solution of the present application, S402 specifically includes the following steps: S4020, calculate negative gradient: for each sample in the training set , according to the current model and its real label , calculate the gradient of the loss function with respect to the model prediction, and the negative gradient calculation formula is: ,in is the loss function, where Indicated in In the round of iteration, The negative gradient of samples, Indicates The feature vector of samples is represents the true label of the sample, This is the loss function About model predictions The partial derivative of represents the loss function, which measures the model prediction value With the true label The difference between Indicated in Model prediction function after round iteration; S4021. Training new trees: using calculated negative gradients As the target variable, train a new decision tree , this tree has the following characteristics: Predict the negative gradient and find a decision rule that minimizes the difference between the predicted negative gradient and the actual negative gradient; S4022, determine the leaf node weight: for the newly trained tree Each leaf node of , calculate the weights that minimize the loss function , which usually involves aggregating the samples that fall within each leaf node and using the true labels of these samples and the current model predictions to calculate the optimal weights; S4023, Update model: Add the prediction result of the new tree to the previous model prediction result and multiply it by the learning rate , to update the prediction of the entire model, the update formula is: ,in is the prediction result of the new tree.
[0013] As a preferred technical solution of the present application, it also includes a data quality detection module, which is connected to the real-time monitoring and visualization module and is used to evaluate the quality of the data set during and after data cleaning.
[0014] As a preferred technical solution of the present application, the execution order of the cleaning rules includes first executing the noise data cleaning rule, then the outlier cleaning rule, and finally the duplicate item cleaning rule.
[0015] As the preferred technical solution of this application, the machine learning cleaning module supports continuous optimization and iteration of the model. The system can automatically adjust the model parameters based on new data feedback to improve the accuracy and adaptability of the model.
[0016] Compared with the prior art, the present invention has the following beneficial effects: In the scheme of this application: 1. By setting noise data cleaning rules, outlier cleaning rules and duplicate item cleaning rules, the system can comprehensively identify and remove noise, outliers and duplicate items in the data stream, improve the purity and accuracy of the data, and use machine learning algorithms to further clean the data. It can automatically identify and clean new or complex abnormal data patterns, and enhance the intelligence and adaptability of the system; 2. The system adopts real-time capture and preprocessing technology, which can receive and process data streams in real time to ensure the timeliness and timeliness of data. By optimizing algorithms and parallel processing mechanisms, the system can significantly improve data processing efficiency, reduce system delays, and meet real-time requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A schematic diagram of the real-time data stream cleaning and monitoring system provided for this application; DETAILED DESCRIPTION
[0018] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0019] As described in the background art, when existing systems process large-scale data streams, as the amount of data continues to increase, the system's response speed and cleaning efficiency will be seriously affected and cannot meet real-time requirements.
[0020] In order to solve this technical problem, the present invention provides a real-time data stream cleaning and monitoring system, which is applied to the field of data stream cleaning.
[0021] Specifically, please refer to Figure 1 , the real-time data stream cleaning and monitoring system specifically includes: Includes the following modules: A data capture module, used to capture the data stream of a data source in real time; A data preprocessing module, connected to the data capture module, is used to perform preliminary processing on the received raw data; A cleaning rule application module, connected to the data preprocessing module, is used to automatically identify and remove noise, outliers and duplicates in the data according to predefined cleaning rules; The machine learning cleaning module is connected to the cleaning rule application module and is used to further clean the data through the machine learning algorithm; The real-time monitoring and visualization module is connected to the machine learning cleaning module to display the progress and results of data cleaning in real time and provide data comparison before and after cleaning; A data storage module, connected to the real-time monitoring and visualization module, for storing cleaned data; The interface module is connected to the data storage module and is used to provide an API interface to achieve data sharing and exchange.
[0022] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings.
[0023] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features and technical solutions in the embodiments may be combined with each other.
[0024] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0025] Example 1, real-time data stream cleaning and monitoring system, the cleaning rules include: Noise data cleaning rules, outlier cleaning rules and duplicate item cleaning rules. The noise data cleaning rules specifically include: Rule 1.1: Remove blank values and empty strings. If a data field is empty or contains only spaces, it is considered invalid data and removed. Rule 1.2: Remove non-printing characters, control characters and special symbols should be identified and removed; Rule 1.3: Format text data. For text fields, remove extra spaces, line breaks, and tabs to ensure consistent formatting of the data.
[0026] The outlier cleaning rules include: Rule 2.1: Range filtering, defining the reasonable range of the data, including the age field should be between 0 and 120, and values outside this range are considered outliers and removed; Rule 2.2: Statistical outlier detection, using the interquartile range method to identify and remove statistical outliers; Rule 2.3: Outlier detection based on business rules includes that if a field represents an email address but the data does not conform to the format of an email address, the data is considered an outlier.
[0027] The duplicate cleaning rules include: Rule 3.1: Complete duplicates are removed. If two or more rows of data are exactly the same in all fields, they are considered duplicates and only one row is retained; Rule 3.2: Remove duplicates from key fields. Define key fields, including ID and email address. If these key fields are repeated, remove the duplicate rows and keep only one row. Rule 3.3: Near-duplicate detection and removal. For text fields, use fuzzy matching algorithms, including Levenshtein distance and Jaccard similarity, to detect near-duplicate data, and remove and merge these duplicates.
[0028] Example 2 further optimizes the real-time data stream cleaning and monitoring system provided in Example 1. Specifically, the machine learning cleaning module is connected to the cleaning rule application module to further clean the data through the machine learning algorithm, which specifically includes the following steps: S1. Data preparation and preprocessing: Collect and organize the data sets that need to be cleaned; Fill missing values and delete records with missing values; Encode categorical features and convert them into numerical data; Perform feature scaling to ensure that all features have the same influence in the model; S2. Data labeling: Mark the records in the data set to distinguish normal and abnormal data points. Normal data refers to data that is more than 60% identical to the data in the data set, and abnormal data refers to data that is more than 60% different from the data in the data set. S3. Divide the dataset: Divide the dataset into training, validation and test sets; S4. Training Gradient Boosting Tree Model: Train a gradient boosted tree classification model using the training set to distinguish between normal and anomalous data points; S5. Model verification and tuning: Use the validation set to validate the model and evaluate the performance of the model; Adjust model parameters based on validation results to improve model accuracy and generalization ability; S6. Outlier Detection: Apply the trained model to the test set (or a new dataset that needs cleaning); The model outputs a predicted probability of belonging to the normal class for each data point; S7. Set thresholds and cleaning rules: Set a prediction probability threshold, specifically 0.6. Data points with prediction probabilities lower than the threshold are considered outliers and need to be cleaned. S8. Data cleaning: According to the cleaning rules, the data points predicted to be abnormal are cleaned; The cleaning method is delete; S9. Verification of cleaning results: Conduct quality checks on cleaned data to ensure data accuracy and completeness; If the cleaning effect is not satisfactory, return to S7 to adjust the threshold and cleaning rules; S10. Deployment and monitoring: Integrate the entire cleaning process and models into the data processing pipeline; Monitor the performance of the model regularly and update and retrain it based on data changes and business needs.
[0029] In S4, a gradient boosting tree classification model is trained using the training set to distinguish normal and abnormal data points, which specifically includes the following steps: S400, Data Preparation: Load and preprocess the data set and divide the data into feature sets and label sets ; S401. Initialize model: set initial prediction value , in classification problems this is usually a log-odds , represents the initial prediction that the sample belongs to the positive class, which can be obtained by calculating the ratio of positive samples to negative samples in the training set; S402, iterative construction of gradient boosting tree: for each round of iteration From 1 to the maximum number of iterations ; S403, termination condition and output: when the maximum number of iterations is reached Stop iteration and output the final model , which is the weighted sum of the trees built in all iterations.
[0030] The specific steps include: S4020, calculate negative gradient: for each sample in the training set , according to the current model and its real label , calculate the gradient of the loss function with respect to the model prediction (i.e., negative gradient or residual), the negative gradient calculation formula is: ,in is the loss function, where Indicated in In the round of iteration, The negative gradient of samples, Indicates The feature vector of samples is represents the true label of the sample, This is the loss function About model predictions The partial derivative of (which represents the slope of the loss function at the current predicted value, that is, the rate of change of the loss function when the predicted value changes slightly. This partial derivative is calculated at point (F(x_i))), represents the loss function, which measures the model prediction value With the true label The difference between Indicated in Model prediction function after round iteration; S4021. Training new trees: using calculated negative gradients As the target variable, train a new decision tree , this tree has the following characteristics: Predict the negative gradient and find a decision rule that minimizes the difference between the predicted negative gradient and the actual negative gradient; S4022, determine the leaf node weight: for the newly trained tree Each leaf node of , calculate the weights that minimize the loss function , which usually involves aggregating the samples that fall within each leaf node and using the true labels of these samples and the current model predictions to calculate the optimal weights; S4023, Update model: Add the prediction result of the new tree to the previous model prediction result and multiply it by the learning rate ( Represents the learning rate, which is a positive number between 0 and 1) to update the prediction of the entire model. The update formula is: ,in is the prediction result of the new tree.
[0031] It also includes a data quality detection module, which is connected to the real-time monitoring and visualization module and is used to evaluate the quality of the data set during and after data cleaning.
[0032] The execution order of the cleaning rules includes first executing the noise data cleaning rule, then executing the outlier cleaning rule, and finally executing the duplicate item cleaning rule.
[0033] The machine learning cleaning module supports continuous optimization and iteration of the model. The system can automatically adjust model parameters based on new data feedback to improve the accuracy and adaptability of the model.
[0034] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral one; it can be a mechanical connection, an electrical connection, or communication with each other; it can be a direct connection, or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0035] Obviously, the embodiments described above are only some embodiments of the present invention, rather than all embodiments. The preferred embodiments of the present invention are given in the accompanying drawings, but they do not limit the patent scope of the present invention. The present invention can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive. Although the present invention has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific embodiments, or to perform equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of the present invention, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present invention.
Claims
1. Real-time data stream cleaning and monitoring system, It is characterized in that Includes the following modules: A data capture module, used to capture the data stream of a data source in real time; A data preprocessing module, connected to the data capture module, is used to perform preliminary processing on the received raw data; A cleaning rule application module, connected to the data preprocessing module, is used to automatically identify and remove noise, outliers and duplicates in the data according to predefined cleaning rules; The machine learning cleaning module is connected to the cleaning rule application module and is used to further clean the data through the machine learning algorithm; The real-time monitoring and visualization module is connected to the machine learning cleaning module to display the progress and results of data cleaning in real time and provide data comparison before and after cleaning; A data storage module, connected to the real-time monitoring and visualization module, for storing cleaned data; The interface module is connected to the data storage module and is used to provide an API interface to achieve data sharing and exchange.
2. The real-time data stream cleaning and monitoring system according to claim 1, It is characterized in that Cleaning rules include: Noise data cleaning rules, outlier cleaning rules and duplicate item cleaning rules. The noise data cleaning rules specifically include: Rule 1.1: Remove blank values and empty strings. If a data field is empty or contains only spaces, it is considered invalid data and removed. Rule 1.2: Remove non-printing characters, control characters and special symbols should be identified and removed; Rule 1.3: Format text data. For text fields, remove extra spaces, line breaks, and tabs to ensure consistent formatting of the data.
3. The real-time data stream cleaning and monitoring system according to claim 2, It is characterized in that The outlier cleaning rules include: Rule 2.1: Range filtering, defining the reasonable range of the data, including the age field should be between 0 and 120, and values outside this range are considered outliers and removed; Rule 2.2: Statistical outlier detection, using the interquartile range method to identify and remove statistical outliers; Rule 2.3: Outlier detection based on business rules includes that if a field represents an email address but the data does not conform to the format of an email address, the data is considered an outlier.
4. The real-time data stream cleaning and monitoring system according to claim 3, It is characterized in that The duplicate cleaning rules include: Rule 3.1: Complete duplicates are removed. If two or more rows of data are exactly the same in all fields, they are considered duplicates and only one row is retained; Rule 3.2: Remove duplicates from key fields. Define key fields, including ID and email address. If these key fields are repeated, remove the duplicate rows and keep only one row. Rule 3.3: Near-duplicate detection and removal. For text fields, use fuzzy matching algorithms, including Levenshtein distance and Jaccard similarity, to detect near-duplicate data, and remove and merge these duplicates.
5. The real-time data stream cleaning and monitoring system according to claim 4, It is characterized in that The machine learning cleaning module is connected to the cleaning rule application module and is used to further clean the data through the machine learning algorithm. Specifically, it includes the following steps: S1. Data preparation and preprocessing: Collect and organize the data sets that need to be cleaned; Fill missing values and delete records with missing values; Encode categorical features and convert them into numerical data; Perform feature scaling to ensure that all features have the same influence in the model; S2. Data labeling: Mark the records in the data set to distinguish normal and abnormal data points. Normal data refers to data that is more than 60% identical to the data in the data set, and abnormal data refers to data that is more than 60% different from the data in the data set. S3. Divide the dataset: Divide the dataset into training, validation and test sets; S4. Training Gradient Boosting Tree Model: Train a gradient boosted tree classification model using the training set to distinguish between normal and anomalous data points; S5. Model verification and tuning: Use the validation set to validate the model and evaluate the performance of the model; Adjust model parameters based on validation results to improve model accuracy and generalization ability; S6. Outlier Detection: Apply the trained model to the test set; The model outputs a predicted probability of belonging to the normal class for each data point; S7. Set thresholds and cleaning rules: Set a prediction probability threshold, specifically 0.
6. Data points with prediction probabilities lower than the threshold are considered outliers and need to be cleaned. S8. Data cleaning: According to the cleaning rules, the data points predicted to be abnormal are cleaned; The cleaning method is Delete.
6. The real-time data stream cleaning and monitoring system according to claim 5, It is characterized in that In S4, a gradient boosting tree classification model is trained using the training set to distinguish normal and abnormal data points, which specifically includes the following steps: S400, Data Preparation: Load and preprocess the data set and divide the data into feature sets and label sets ; S401. Initialize model: set initial prediction value ; S402, iterative construction of gradient boosting tree: for each round of iteration From 1 to the maximum number of iterations ; S403, termination condition and output: when the maximum number of iterations is reached Stop iteration and output the final model , which is the weighted sum of the trees built in all iterations.
7. The real-time data stream cleaning and monitoring system according to claim 6, It is characterized in that S402 specifically includes the following steps: S4020, calculate negative gradient: for each sample in the training set , according to the current model and its real label , calculate the gradient of the loss function with respect to the model prediction, and the negative gradient calculation formula is: ,in is the loss function, where Indicated in In the round of iteration, The negative gradient of samples, Indicates The feature vector of samples is represents the true label of the sample, This is the loss function About model predictions The partial derivative of represents the loss function, which measures the model prediction value With the true label The difference between Indicated in Model prediction function after round iteration; S4021. Training new trees: using calculated negative gradients As the target variable, train a new decision tree ; S4022, determine the leaf node weight: for the newly trained tree Each leaf node of , calculate the weights that minimize the loss function ; S4023, Update model: Add the prediction result of the new tree to the previous model prediction result and multiply it by the learning rate , to update the prediction of the entire model, the update formula is: ,in is the prediction result of the new tree.
8. The real-time data stream cleaning and monitoring system according to claim 7, It is characterized in that It also includes a data quality detection module, which is connected to the real-time monitoring and visualization module and is used to evaluate the quality of the data set during and after data cleaning.
9. The real-time data stream cleaning and monitoring system according to claim 8, It is characterized in that The execution order of the cleaning rules includes first executing the noise data cleaning rule, then executing the outlier cleaning rule, and finally executing the duplicate item cleaning rule.
10. The real-time data stream cleaning and monitoring system according to claim 9, It is characterized in that The machine learning cleaning module supports continuous optimization and iteration of the model. The system can automatically adjust model parameters based on new data feedback to improve the accuracy and adaptability of the model.
Citation Information
Patent Citations
Data cleaning method and device
CN112925785A
Customer data acquisition and analysis method and device and cloud server
CN117891811A
Financial data cleaning management system and method based on big data
CN118331952A
Cited By
Self-adaptive dynamic data cleaning method for real-time streaming data
CN120045848A
