Method and system for correcting and detecting abnormal value of time sequence
Through the time series outlier correction detection method, the median absolute deviation and absolute ratio are used for data correction, which solves the problem of poor robustness in the existing technology, achieves effective processing of large fluctuation data and improves the accuracy of detection results. .
Patent Information
- Application Number
- CN202410839396.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-09-24
AI Technical Summary
The existing technology faces the problem of poor robustness when processing analog signals, and cannot effectively handle the drastic changes in data signals caused by large changes in outliers, affecting the reliability of measurement results.
The time series outlier correction and detection method is adopted, including time series data intermediate value calculation, absolute deviation calculation, outlier judgment and data value correction module. Data search and correction are realized through bit-by-bit comparison method and Boolean logic, and the absolute deviation of the intermediate value and Absolute ratios were used for data correction and detection.
It realizes the correction of large fluctuation data, improves the data quality and the accuracy of detection results, overcomes the limitation of traditional algorithms that are difficult to process large amounts of data in small-capacity FPGA chips, and enhances the reliability of processing results.
Smart Images

Figure CN118690301A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of analog signal measurement, and in particular to a time series abnormal value correction detection method and a system thereof. Background Art
[0002] In engineering applications, analog signal-to-digital signal conversion technology (ADC) is widely used to convert physical quantity signals such as voltage and current into corresponding time series digital signals, and transmit the digital signals to the signal processing circuit. The digital signal processing circuit (central processing unit or field programmable gate array chip FPGA) in the signal processing circuit collects digital signals and further converts and processes the digital signals according to the set program. With the popularization and application of high-speed ADC technology, a large number of digital signals converted from analog signals need to be processed per unit time. In the use scenarios with complex electromagnetic environment, serious interference of various types, and small values of measured analog signals, such as temperature detection of aircraft inlet duct, the output digital signal of ADC often deviates from the normal measurement value due to interference, and the deviation value is a random value with no regularity. If these abnormal raw data signals are used directly, it will bring uncertainty to calculation and control, and make the final calculation result wrong. Therefore, before using these digital signals, the digital signal processing circuit often needs to clean the digital signals, that is, calculate the original digital signals according to a certain algorithm, filter and regenerate the digital signals with abnormal values filtered out, and then carry out the next step of digital signal processing.
[0003] In order to filter out outlier data in time series, filter algorithms are usually used. Currently, the more common filter algorithms include: limit filtering, average filtering, median filtering, first-order lag filtering, etc. Average filtering, median filtering, and first-order lag filtering generally have good filtering effects on occasional interference signals or periodic AC interference signals, and are widely used. The most prominent problem of these methods in practical applications is poor robustness. When the range of changes of outliers is small and the changes are slow, the filtering effect is better. If the outliers change significantly, causing the data signal to change drastically, the filtering effect of the above algorithms will be difficult to meet the requirements of the application. Summary of the invention
[0004] In view of the above-mentioned deficiencies in the prior art, a time series outlier correction detection method and system provided by the present invention solves the problem that the existing methods for processing time series outliers have poor robustness and are unable to handle situations where the outliers change drastically, resulting in drastic changes in data signals, and cannot meet the reliability requirements of the measurement results.
[0005] In order to achieve the above-mentioned object of the invention, the technical solution adopted by the present invention is:
[0006] A time series outlier correction detection method is provided, which comprises the following steps:
[0007] S1. Obtain time series data;
[0008] S2. Construct a time series outlier detection model; wherein the time series outlier detection model includes a time series data intermediate value calculation module, an intermediate value absolute deviation calculation module, an outlier judgment module, a data value correction module, and an outlier detection module;
[0009] S3, searching the time series data through the time series data intermediate value calculation module to obtain the corresponding time series data intermediate value data;
[0010] S4. Processing the intermediate value data and the time series data through the intermediate value absolute deviation calculation module to obtain corresponding intermediate value absolute deviation data and absolute deviation intermediate value data;
[0011] S5. Based on the median absolute deviation data and the absolute deviation median data, the time series data is judged by an abnormal value judgment module to obtain a corresponding judgment result;
[0012] S6, judging whether the judgment result corresponding to each time series data is normal; if so, obtaining normal time series data; otherwise, obtaining abnormal event series data and entering step S7;
[0013] S7, correcting the abnormal time series data through a data value correction module to obtain corrected time series data;
[0014] S8. Detect the corrected time series data through an outlier detection module to obtain a detection result.
[0015] Further, step S3 includes the following steps:
[0016] S3-1, read three time series data sequentially and take them as a data set;
[0017] S3-2, performing binary conversion on the three time series data read in step S3-1 to obtain corresponding binary data respectively;
[0018] S3-3, determine whether the highest bits of the binary data are the same; if so, proceed to step S3-4; otherwise, proceed to step S3-5;
[0019] S3-4, overwrite the high bit with the low bit of each binary data until the highest bit is overwritten by the second highest bit, update the binary data and return to step S3-3; wherein the lowest bit is overwritten with 0;
[0020] S3-5, determine whether the number of discards of each binary data is 1; if so, proceed to step S3-9; otherwise, proceed to step S3-6;
[0021] S3-6, determine whether there are two binary data whose highest bits are both 1; if so, proceed to step S3-7; otherwise, proceed to step S3-8;
[0022] S3-7, discard the binary data whose highest bit is 0, increase the discard count by 1 and return to step S3-4; wherein the initial value of the discard count is 0;
[0023] S3-8, discard the binary data whose highest bit is 1, increase the discard count by 1 and return to step S3-4;
[0024] S3-9, determine whether the binary data with the highest bit as 1 has been discarded; if so, proceed to step S3-10; otherwise, proceed to step S3-11;
[0025] S3-10, taking the binary data of step S3-2 corresponding to the binary data with the discarding times of 1 and the highest bit of 1 as the intermediate value of the time series data and inputting it into the intermediate value absolute deviation calculation module, and proceeding to step S3-12;
[0026] S3-11, taking the binary data of step S3-2 corresponding to the binary data with the discarding times of 1 and the highest bit of 0 as the intermediate value of the time series data and inputting them into the intermediate value absolute deviation calculation module respectively, and proceeding to step S3-12;
[0027] S3-12, determine whether all time series data have been processed; if so, go to step S4; otherwise, select any time series data and replace the first time series data selected in the data set, update the data set to reset the discard times, and return to step S3-2.
[0028] Further, step S4 includes the following steps:
[0029] S4-1, sequentially read a time series data;
[0030] S4-2, obtaining the intermediate value of the time series data output in step S3-10 or step S3-11 in real time;
[0031] S4-3, calculating the absolute deviation between the time series data and the middle value of the time series and inputting it into the abnormal value judgment module, and then proceeding to step S4-4;
[0032] S4-4, repeating steps S4-1 to S4-3 until the absolute deviation of the intermediate values corresponding to all time series data is obtained;
[0033] S4-4, process all the intermediate absolute deviations in the same way as step S3 to obtain the corresponding absolute deviation intermediate values, and proceed to step S5.
[0034] Further, step S5 includes the following steps:
[0035] S5-1, calculating the ratio of the absolute deviation of the intermediate value in step S4-3 to the intermediate value of the absolute deviation;
[0036] S5-2, based on the ratio, judging the time series data read in step S4-1 to obtain a corresponding judgment result; wherein the judgment result is divided into normal and abnormal;
[0037] S5-3, repeat step S5-1 until the ratio of the absolute deviation of the middle value corresponding to all time series data to the middle value of the absolute deviation is calculated;
[0038] S5-4, repeat step S5-2 until the judgment results corresponding to all time series data are obtained.
[0039] Furthermore, the specific process of step S5-2 is:
[0040] A preset threshold range is set; determining whether the judgment result is within the threshold range; if so, the judgment result is abnormal; otherwise, the judgment result is normal; wherein the threshold range is a real number interval of 2 to 50.
[0041] Further, step S7 includes the following steps:
[0042] S7-1, read an abnormal time series data and its corresponding time series data intermediate value;
[0043] S7-2, replacing the abnormal time series data with the corresponding middle value of the time series data;
[0044] S7-3, repeating step S7-1 and step S7-2 until all abnormal time series data are processed to obtain corrected time series data.
[0045] Further, step S8 includes the following steps:
[0046] S8-1. Calculate the absolute average value corresponding to the corrected time series data;
[0047] S8-2, calculate the absolute standard deviation corresponding to the corrected time series data;
[0048] S8-3, calculating the deviation between the absolute value of each corrected time series data and the absolute average value;
[0049] S8-4, calculating the absolute ratio of each deviation to the absolute standard deviation;
[0050] S8-5, calculating the average difference value of each absolute ratio;
[0051] S8-6, determine whether the average difference value is greater than a threshold; if so, determine that the corrected time series data is abnormal data, that is, the detection result; otherwise, determine that the corrected time series data is normal data, that is, the detection result.
[0052] A time series abnormal value correction and detection system is provided, which includes a reference signal generation module, a time series data intermediate value calculation module, an intermediate value absolute deviation calculation module, an abnormal value judgment module, a data value correction module, and an outlier detection module;
[0053] The signal output end of the reference signal generating module is respectively connected to the first signal input end of the original data intermediate value calculating module, the intermediate value absolute deviation calculating module, the abnormal value judging module, the data value correcting module, and the outlier checking module; the first signal output end, the second signal output end, and the third signal output end of the time series data intermediate value calculating module are respectively connected to the second signal input end of the intermediate value absolute deviation calculating module, the abnormal value judging module, and the data value correcting module; the first signal output end and the second signal output end of the intermediate value absolute deviation calculating module are respectively connected to the second signal input end of the time series data intermediate value calculating module and the third signal input end of the abnormal value judging module; the signal output end of the abnormal value judging module is connected to the third signal input end of the data value correcting module; the signal output end of the data value correcting module is connected to the outlier checking module;
[0054] in:
[0055] The reference signal generating module is used to provide the reference signal and drive each module to work in sequence by the jump edge;
[0056] The time series data intermediate value calculation module is used to search the time series data and obtain the corresponding time series data intermediate value data;
[0057] The intermediate value absolute deviation calculation module is used to process the intermediate value data of the time series data and the time series data to obtain the corresponding intermediate value absolute deviation data and absolute deviation intermediate value data;
[0058] An outlier judgment module is used to judge the time series data based on the median absolute deviation data and the absolute deviation median data to obtain the corresponding judgment result;
[0059] A data value correction module is used to correct abnormal time series data to obtain corrected time series data;
[0060] The outlier detection module is used to detect the corrected time series data and obtain the detection result.
[0061] Furthermore, the reference signal generation module uses two methods to obtain the reference signal; the first method uses the FPGA's phase-locked loop or delay-locked loop technology to generate a stable frequency measurement reference signal; the second method uses the FPGA's external high-precision frequency source signal to generate the frequency measurement reference signal required for frequency testing through a counting and frequency division method.
[0062] The module for calculating the intermediate value of time series data adopts a matrix-based bit-by-bit comparison method.
[0063] The beneficial effects of the present invention are:
[0064] 1. Achieved fast search for the middle value of a data set; used bit-by-bit comparison method to search for the middle value, using Boolean logic instead of arithmetic logic to compare the size of data; solved the problem that the existing algorithm required a large number of FPGA internal logic resources when comparing data size due to the use of arithmetic logic, making it difficult to compare the size of a large amount of data in a small-capacity FPGA chip;
[0065] 2. Correction of data with large fluctuations; using data outlier judgment and correction algorithm, the original data with large fluctuations caused by various external reasons can be corrected and detected, overcoming the problem that traditional algorithms are only suitable for correcting data with small fluctuations, and the correction effect on abnormal data with large fluctuations is poor or even impossible to correct, resulting in a large amount of data being discarded; solving the problem of unsatisfactory subsequent digital processing results due to the failure to effectively correct data anomalies; further performing outlier detection on the corrected data improves data quality, eliminates the interference of outliers, and improves the accuracy of detection results. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 is a method flow chart;
[0067] Figure 2 It is a schematic diagram of the system structure;
[0068] Figure 3 is a scatter plot of the original measurement data values without random interference signals in Example 1;
[0069] Figure 4 This is a scatter plot of the measured data values after adding a random interference signal in Example 1;
[0070] Figure 5 is the scatter point of the measured data value after being processed by the method in Example 1;
[0071] Figure 6 is a scatter plot of the original measurement data values without random interference signals in Example 2;
[0072] Figure 7 This is a scatter plot of the measured data values after adding a random interference signal in Example 2;
[0073] Figure 8 1 is the scatter point of the measured data value after being processed by this method in Example 2. DETAILED DESCRIPTION
[0074] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.
[0075] like Figure 1 As shown, a time series outlier correction detection method comprises the following steps:
[0076] S1. Obtain time series data;
[0077] S2. Construct a time series outlier detection model; wherein the time series outlier detection model includes a time series data intermediate value calculation module, an intermediate value absolute deviation calculation module, an outlier judgment module, a data value correction module, and an outlier detection module;
[0078] S3. Perform data search on the time series data through the time series data intermediate value calculation module to obtain the corresponding time series data intermediate value data; wherein the intermediate value refers to a data existing in a specified data set, and the number of data larger than this data value is exactly equal to the number of data smaller than this data value, then this data is called the intermediate value of the data set.
[0079] Step S3 includes the following steps:
[0080] S3-1, read three time series data sequentially and take them as a data set;
[0081] S3-2, performing binary conversion on the three time series data read in step S3-1 to obtain corresponding binary data respectively;
[0082] S3-3, determine whether the highest bits of the binary data are the same; if so, proceed to step S3-4; otherwise, proceed to step S3-5;
[0083] S3-4, starting from the lowest bit, overwrite the high bit with the low bit of each binary data until the highest bit is overwritten by the second highest bit, update the binary data and return to step S3-3; wherein the lowest bit is overwritten with 0;
[0084] S3-5, determine whether the number of discards of each binary data is 1; if so, proceed to step S3-9; otherwise, proceed to step S3-6;
[0085] S3-6, determine whether there are two binary data whose highest bits are both 1; if so, proceed to step S3-7; otherwise, proceed to step S3-8;
[0086] S3-7, discard the binary data whose highest bit is 0, increase the discard count by 1 and return to step S3-4; wherein the initial value of the discard count is 0;
[0087] S3-8, discard the binary data whose highest bit is 1, increase the discard count by 1 and return to step S3-4;
[0088] S3-9, determine whether the binary data with the highest bit as 1 has been discarded; if so, proceed to step S3-10; otherwise, proceed to step S3-11;
[0089] S3-10, taking the binary data of step S3-2 corresponding to the binary data with the discarding times of 1 and the highest bit of 1 as the intermediate value of the time series data and inputting it into the intermediate value absolute deviation calculation module, and proceeding to step S3-12;
[0090] S3-11, taking the binary data of step S3-2 corresponding to the binary data with the discarding times of 1 and the highest bit of 0 as the intermediate value of the time series data and inputting them into the intermediate value absolute deviation calculation module respectively, and proceeding to step S3-12;
[0091] S3-12, determine whether all time series data have been processed; if so, go to step S4; otherwise, select any time series data and replace the first time series data selected in the data set, update the data set to reset the discard times, and return to step S3-2.
[0092] Each time the time series data intermediate value calculation module completes the operation of calculating and outputting the intermediate value, it uses a newly collected time series data to replace the earliest data in the data set and recycles the intermediate value calculation. Among them, the steps involving numerical value comparison use Boolean logic operations.
[0093] S4. Processing the intermediate value data of the time series data and the time series data through the intermediate value absolute deviation calculation module to obtain corresponding intermediate value absolute deviation data and absolute deviation intermediate value data; the symbol of the intermediate value absolute deviation is MAD;
[0094] Step S4 includes the following steps:
[0095] S4-1, sequentially read a time series data;
[0096] S4-2, obtaining the intermediate value of the time series data output in step S3-10 or step S3-11 in real time;
[0097] S4-3, calculating the absolute deviation between the time series data and the middle value of the time series and inputting it into the abnormal value judgment module, and then proceeding to step S4-4;
[0098] S4-4. Repeat steps S4-1 to S4-3 until the intermediate absolute deviation corresponding to all time series data is obtained; each time the intermediate absolute deviation calculation is completed and the result is output, a newly received time series data and intermediate value are used to replace the earliest data, and the intermediate absolute deviation is calculated again in a cycle.
[0099] S4-4, process all the intermediate absolute deviations in the same way as step S3 to obtain the corresponding absolute deviation intermediate values, and proceed to step S5.
[0100] S5. Based on the median absolute deviation data and the absolute deviation median data, the time series data is judged by an abnormal value judgment module to obtain a corresponding judgment result;
[0101] Step S5 includes the following steps:
[0102] S5-1, calculating the ratio of the absolute deviation of the intermediate value in step S4-3 to the intermediate value of the absolute deviation;
[0103] S5-2, based on the ratio, judging the time series data read in step S4-1 to obtain a corresponding judgment result; wherein the judgment result is divided into normal and abnormal;
[0104] The specific process of step S5-2 is:
[0105] A preset threshold range is set; determining whether the judgment result is within the threshold range; if so, the judgment result is abnormal; otherwise, the judgment result is normal; wherein the threshold range is a real number interval of 2 to 50.
[0106] S5-3, repeat step S5-1 until the ratio of the absolute deviation of the middle value corresponding to all time series data to the middle value of the absolute deviation is calculated;
[0107] S5-4, repeat step S5-2 until the judgment results corresponding to all time series data are obtained.
[0108] S6, judging whether the judgment result corresponding to each time series data is normal; if so, obtaining normal time series data; otherwise, obtaining abnormal event series data and entering step S7;
[0109] S7, correcting the abnormal time series data through a data value correction module to obtain corrected time series data;
[0110] Step S7 includes the following steps:
[0111] S7-1, read an abnormal time series data and its corresponding time series data intermediate value;
[0112] S7-2, replacing the abnormal time series data with the corresponding middle value of the time series data;
[0113] S7-3, repeating step S7-1 and step S7-2 until all abnormal time series data are processed to obtain corrected time series data.
[0114] S8. Detect the corrected time series data through an outlier detection module to obtain a detection result.
[0115] Step S8 includes the following steps:
[0116] S8-1. Calculate the absolute average value corresponding to the corrected time series data; wherein the absolute average value is the absolute value of the average value;
[0117] S8-2. Calculate the absolute standard deviation corresponding to the corrected time series data; wherein the absolute standard deviation is the absolute value of the standard deviation;
[0118] S8-3, calculating the deviation between the absolute value of each corrected time series data and the absolute average value;
[0119] S8-4, calculating the absolute ratio of each deviation to the absolute standard deviation; wherein the absolute ratio is the absolute value of the ratio;
[0120] S8-5, calculating the average difference value of each absolute ratio;
[0121] S8-6, determine whether the average difference value is greater than a threshold; if so, determine that the corrected time series data is abnormal data, that is, the detection result; otherwise, determine that the corrected time series data is normal data, that is, the detection result.
[0122] like Figure 2 As shown, a time series abnormal value correction detection system includes a reference signal generation module, a time series data intermediate value calculation module, an intermediate value absolute deviation calculation module, an abnormal value judgment module, a data value correction module, and an outlier detection module;
[0123] The signal output end of the reference signal generating module is respectively connected to the first signal input end of the original data intermediate value calculating module, the intermediate value absolute deviation calculating module, the abnormal value judging module, the data value correcting module, and the outlier checking module; the first signal output end, the second signal output end, and the third signal output end of the time series data intermediate value calculating module are respectively connected to the second signal input end of the intermediate value absolute deviation calculating module, the abnormal value judging module, and the data value correcting module; the first signal output end and the second signal output end of the intermediate value absolute deviation calculating module are respectively connected to the second signal input end of the time series data intermediate value calculating module and the third signal input end of the abnormal value judging module; the signal output end of the abnormal value judging module is connected to the third signal input end of the data value correcting module; the signal output end of the data value correcting module is connected to the outlier checking module;
[0124] in:
[0125] The reference signal generating module is used to provide the reference signal and drive each module to work in sequence by the jump edge;
[0126] The time series data intermediate value calculation module is used to search the time series data and obtain the corresponding time series data intermediate value data;
[0127] The intermediate value absolute deviation calculation module is used to process the intermediate value data of the time series data and the time series data to obtain the corresponding intermediate value absolute deviation data and absolute deviation intermediate value data;
[0128] An outlier judgment module is used to judge the time series data based on the median absolute deviation data and the absolute deviation median data to obtain the corresponding judgment result;
[0129] A data value correction module is used to correct abnormal time series data to obtain corrected time series data;
[0130] The outlier detection module is used to detect the corrected time series data and obtain the detection results. Identifying the corrected outliers helps the subsequent data processing module to remove the data values that are still significantly deviated from the normal range after correction, thereby improving the robustness of the data processing function. The outlier detection module calculates the deviation of each data from the mean and calculates it with the standard deviation to obtain the data deviation in units of standard deviation. Data values with a data deviation less than the threshold are considered outliers.
[0131] The reference signal generation module uses two methods to obtain the reference signal; the first method uses the FPGA's phase-locked loop or delay-locked loop technology to generate a stable frequency measurement reference signal; the second method uses the FPGA's external high-precision frequency source signal to generate the frequency measurement reference signal required for frequency testing through the counting and frequency division method.
[0132] The module for calculating the intermediate value of time series data adopts a matrix-based bit-by-bit comparison method.
[0133] The voltage acquisition chip acquires 108 voltage measurement data. Under normal circumstances, the voltage measurement data meets the sinusoidal variation law. If the input clock of the FPGA is 40MHz, the clock frequency division is not performed, and the input clock is directly used as the reference signal of the FPGA internal module and provided to other modules as the operation drive clock.
[0134] The time series data intermediate value calculation module first continuously reads the three data collected by the voltage acquisition chip. When searching for the intermediate value of the time series data, the three time series data read are converted into binary format, compared bit by bit, and the intermediate value of the time series data is checked. For example, in the three binary data (1001, 0010, 1110) arranged in chronological order, the highest bits of the three data are compared in the first round. Since the highest bits of two data (1001, 1110) are 1, the data (0010) with the highest bit of 0 is discarded. Before the second round of comparison, (1001, 1110) is shifted left by one bit to become data (0010, 1100). During the comparison, because the data has been discarded in the first round of comparison, and the highest bit of the discarded data (0010) is 0, the data before the shift (1001) corresponding to the data (0010) with the highest bit of 0 in the data (0010, 1100) is taken as the intermediate value of the time series voltage data. original Output to the intermediate value absolute deviation calculation module. Then read a new time series voltage data collected by the voltage acquisition chip to replace the first data (1001) read out of the three original data, and start the next round of time series data intermediate value search.
[0135] The median absolute deviation calculation module receives the median value of the time series voltage data original Then, read a time series voltage data Data sequentially original , and using the formula:
[0136] MAD=|Data original -Median original |
[0137] Calculate the median absolute deviation MAD;
[0138] Then the intermediate value absolute deviation calculation module receives the next time series voltage data intermediate value Median original , and repeat the calculation until the median value of all time series voltage data is obtained originalAnd return to the time series data intermediate value calculation module to calculate the absolute deviation intermediate value. The calculation process of the absolute deviation intermediate value by the time series data intermediate value calculation module is the same as the process of obtaining the time series data intermediate value, the difference is that the calculation result is the absolute deviation intermediate value MAD Median Output to the outlier judgment module.
[0139] The outlier judgment module calls the division function to calculate MAD and MAD Median The corresponding formula is:
[0140]
[0141] And according to the formula:
[0142]
[0143] Data valid =0, Ration∈Threshold
[0144] Determining the validity of time series data valid , when Data valid When it is 1, the corresponding time series data is normal time series data; otherwise, when Data valid When it is 0, the corresponding time series data is abnormal time series data; where Threshold is the preset threshold range, that is, a real number interval from 2 to 50.
[0145] The data value correction module corrects abnormal time series data. The corresponding formula is:
[0146] Data fix(i) =Data original(i) ,Data valid =1
[0147] Data fix(i) =Median original(i) ,Data valid =0
[0148] Among them, Data fix(i) Represents the time series data after correction of the i-th time series, Data original(i) Represents the i-th time series data, Median original(i) Represents the middle value of the i-th time series voltage data.
[0149] The formula for the outlier detection module is:
[0150]
[0151] Where n represents the number of corrected time series data, ∑(·) represents the sum function, |·| represents the absolute value function, and MeanData fix Indicates the absolute average, StdData fix Indicates the absolute standard deviation, ScoreData (i) Indicates the absolute ratio, ZScore (i) Represents the mean difference value.
[0152] Embodiment 1:
[0153] The original measurement data value range is -10 to +10. When there is no random interference signal, the scatter plot of the original measurement data is as follows: Figure 3 As shown. The square marks are normal data.
[0154] After the original measurement data is superimposed with random interference signals, five abnormal data are generated, such as Figure 4 As shown. Figure 4 In the figure, squares are normal data and dots are abnormal data.
[0155] The measured data after adding random interference signals are processed by this method, and the obtained data are as follows Figure 5 As shown in the figure, four corrected data are basically in the curve formed by the original measurement data, and only one corrected data deviates from the curve formed by the original measurement data. Except for the data points with a slightly larger fluctuation range, the outlier range of all data points is 0.009-0.794, and the threshold can be selected as 0.9. The outlier of the data point with a slightly larger fluctuation range is 1.0207, which can be identified as abnormal data by the subsequent data processing module. Figure 5 In the figure, square marks represent normal data, triangle marks represent corrected data, and dots represent abnormal data whose fluctuations are still slightly larger after correction.
[0156] Embodiment 2:
[0157] The original measurement data value range is 0 to +20. When there is no random interference signal, the scatter plot of the original measurement data is as follows: Figure 6 As shown. The square marks are normal data.
[0158] After the random interference signal is superimposed on the original measurement data, 8 abnormal data are generated, such as Figure 7 As shown. Figure 7 In the figure, squares are normal data and dots are abnormal data.
[0159] The measured data after adding random interference signals are processed by this method, and the obtained data are as follows Figure 8As shown in the figure, it can be seen that the fluctuation range of all abnormal data has been greatly reduced. The outlier range of all data points is 0.007 to 0.335, and the subsequent data processing module can assume that there is no abnormal data. Figure 8 In the figure, square marks represent normal data, and triangle marks represent corrected data.
[0160] In summary, the present invention realizes a fast search for the middle value of a data set; uses a bit-by-bit comparison method to realize the search for the middle value, and compares the size of data through Boolean logic rather than arithmetic logic; solves the problem that the existing algorithm, when comparing the size of data, requires a large number of internal logic resources of FPGA due to the use of arithmetic logic, resulting in difficulty in comparing the size of a large amount of data in a small-capacity FPGA chip; realizes the correction of data with large fluctuations; utilizes a data outlier judgment and correction algorithm to correct and detect original data with large fluctuations caused by various external reasons, overcoming the problem that traditional algorithms are only suitable for correcting data with small fluctuations, and have poor correction effect on abnormal data with large fluctuations or even cannot correct it, resulting in a large amount of data being discarded; solves the problem that the subsequent digital processing results are not ideal due to the inability to effectively correct data anomalies; further performs outlier detection on the corrected data, improves data quality, eliminates the interference of outliers, and improves the accuracy of detection results.
Claims
1. A time series outlier correction detection method, characterized in that: The following steps are involved: S1. Obtain time series data; S2. Construct a time series outlier detection model; wherein the time series outlier detection model includes a time series data intermediate value calculation module, an intermediate value absolute deviation calculation module, an outlier judgment module, a data value correction module, and an outlier detection module; S3, searching the time series data through the time series data intermediate value calculation module to obtain the corresponding time series data intermediate value data; S4. Processing the intermediate value data and the time series data through the intermediate value absolute deviation calculation module to obtain corresponding intermediate value absolute deviation data and absolute deviation intermediate value data; S5. Based on the median absolute deviation data and the absolute deviation median data, the time series data is judged by an abnormal value judgment module to obtain a corresponding judgment result; S6, judging whether the judgment result corresponding to each time series data is normal; if so, obtaining normal time series data; otherwise, obtaining abnormal event series data and entering step S7; S7, correcting the abnormal time series data through a data value correction module to obtain corrected time series data; S8. Detect the corrected time series data through an outlier detection module to obtain a detection result.
2. The time series outlier correction detection method according to claim 1, characterized in that: The step S3 comprises the following steps: S3-1, read three time series data sequentially and take them as a data set; S3-2, performing binary conversion on the three time series data read in step S3-1 to obtain corresponding binary data respectively; S3-3, determine whether the highest bits of the binary data are the same; if so, proceed to step S3-4; otherwise, proceed to step S3-5; S3-4, overwrite the high bit with the low bit of each binary data until the highest bit is overwritten by the second highest bit, update the binary data and return to step S3-3; wherein the lowest bit is overwritten with 0; S3-5, determine whether the number of discards of each binary data is 1; if so, proceed to step S3-9; otherwise, proceed to step S3-6; S3-6, determine whether there are two binary data whose highest bits are both 1; if so, proceed to step S3-7; otherwise, proceed to step S3-8; S3-7, discard the binary data whose highest bit is 0, increase the discard count by 1 and return to step S3-4; wherein the initial value of the discard count is 0; S3-8, discard the binary data whose highest bit is 1, increase the discard count by 1 and return to step S3-4; S3-9, determine whether the binary data with the highest bit as 1 has been discarded; if so, proceed to step S3-10; otherwise, proceed to step S3-11; S3-10, taking the binary data of step S3-2 corresponding to the binary data with the discarding times of 1 and the highest bit of 1 as the intermediate value of the time series data and inputting it into the intermediate value absolute deviation calculation module, and proceeding to step S3-12; S3-11, taking the binary data of step S3-2 corresponding to the binary data with the discarding times of 1 and the highest bit of 0 as the intermediate value of the time series data and inputting them into the intermediate value absolute deviation calculation module respectively, and proceeding to step S3-12; S3-12, determine whether all time series data have been processed; if so, go to step S4; otherwise, select any time series data and replace the first time series data selected in the data set, update the data set to reset the discard times, and return to step S3-2.
3. The time series outlier correction detection method according to claim 2, characterized in that: The step S4 comprises the following steps: S4-1, sequentially read a time series data; S4-2, obtaining the intermediate value of the time series data output in step S3-10 or step S3-11 in real time; S4-3, calculating the absolute deviation between the time series data and the middle value of the time series and inputting it into the abnormal value judgment module, and then proceeding to step S4-4; S4-4, repeating steps S4-1 to S4-3 until the absolute deviation of the intermediate values corresponding to all time series data is obtained; S4-4, process all the intermediate absolute deviations in the same way as step S3 to obtain the corresponding intermediate absolute deviations, and proceed to step S5.
4. The time series outlier correction detection method according to claim 3, characterized in that: The step S5 comprises the following steps: S5-1, calculating the ratio of the absolute deviation of the intermediate value in step S4-3 to the intermediate value of the absolute deviation; S5-2, based on the ratio, judging the time series data read in step S4-1 to obtain a corresponding judgment result; wherein the judgment result is divided into normal and abnormal; S5-3, repeat step S5-1 until the ratio of the absolute deviation of the middle value corresponding to all time series data to the middle value of the absolute deviation is calculated; S5-4, repeat step S5-2 until the judgment results corresponding to all time series data are obtained.
5. The time series outlier correction detection method according to claim 4, characterized in that: The specific process of step S5-2 is as follows: A preset threshold range is defined; determining whether the judgment result is within the threshold range; if so, the judgment result is abnormal; otherwise, the judgment result is normal; wherein the threshold range is a real number interval between 2 and 50.
6. The time series outlier correction detection method according to claim 1, characterized in that: The step S7 comprises the following steps: S7-1, read an abnormal time series data and its corresponding time series data intermediate value; S7-2, replacing the abnormal time series data with the corresponding middle value of the time series data; S7-3, repeating step S7-1 and step S7-2 until all abnormal time series data are processed to obtain corrected time series data.
7. The time series outlier correction detection method according to claim 1, characterized in that: The step S8 comprises the following steps: S8-1. Calculate the absolute average value corresponding to the corrected time series data; S8-2, calculate the absolute standard deviation corresponding to the corrected time series data; S8-3, calculating the deviation between the absolute value of each corrected time series data and the absolute average value; S8-4, calculating the absolute ratio of each deviation to the absolute standard deviation; S8-5, calculating the average difference value of each absolute ratio; S8-6, determine whether the average difference value is greater than a threshold; if so, determine that the corrected time series data is abnormal data, that is, the detection result; otherwise, determine that the corrected time series data is normal data, that is, the detection result.
8. A correction detection system based on the time series outlier correction detection method according to any one of claims 1 to 7, characterized in that: It includes a reference signal generation module, a time series data intermediate value calculation module, an intermediate value absolute deviation calculation module, an abnormal value judgment module, a data value correction module, and an outlier detection module; The signal output end of the reference signal generating module is respectively connected to the first signal input end of the original data intermediate value calculating module, the intermediate value absolute deviation calculating module, the abnormal value judging module, the data value correcting module, and the outlier checking module; the first signal output end, the second signal output end, and the third signal output end of the time series data intermediate value calculating module are respectively connected to the second signal input end of the intermediate value absolute deviation calculating module, the abnormal value judging module, and the data value correcting module; the first signal output end and the second signal output end of the intermediate value absolute deviation calculating module are respectively connected to the second signal input end of the time series data intermediate value calculating module and the third signal input end of the abnormal value judging module; the signal output end of the abnormal value judging module is connected to the third signal input end of the data value correcting module; the signal output end of the data value correcting module is connected to the outlier checking module; in: The reference signal generating module is used to provide the reference signal and drive each module to work in sequence by the jump edge; The time series data intermediate value calculation module is used to search the time series data and obtain the corresponding time series data intermediate value data; The intermediate value absolute deviation calculation module is used to process the intermediate value data of the time series data and the time series data to obtain the corresponding intermediate value absolute deviation data and absolute deviation intermediate value data; An outlier judgment module is used to judge the time series data based on the median absolute deviation data and the absolute deviation median data to obtain the corresponding judgment result; A data value correction module is used to correct abnormal time series data to obtain corrected time series data; The outlier detection module is used to detect the corrected time series data and obtain the detection result.
9. The time series outlier correction detection system according to claim 8, characterized in that: The reference signal generation module uses two methods to obtain the reference signal; the first method uses the phase-locked loop or delay-locked loop technology of the FPGA to generate a stable frequency measurement reference signal; the second method uses the external high-precision frequency source signal of the FPGA to generate the frequency measurement reference signal required for the frequency test through the counting and frequency division method; The time series data intermediate value calculation module adopts a matrix-type bit-by-bit comparison method.
Citation Information
Cited By
Pressure abnormal point detection and repair method of aviation pressure sensor
CN120947905A
