Self-adaptive smoothing filtering method and device for one-dimensional sequence data and medium
By adaptively selecting the smoothing coefficient value in one-dimensional sequence data, using exponential filtering and comprehensive weight evaluation, the problems of data smoothing processing time and parameter setting in the prior art are solved, and efficient noise and field value removal are achieved. Retain data characteristics.
Patent Information
- Application Number
- CN202411103546.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-11-15
AI Technical Summary
When selecting data smoothing processing methods in the prior art, it is necessary to select appropriate filtering methods and filtering parameters according to the data characteristics, resulting in increased time consumption. Improper filtering parameters may lead to excessive smoothing and loss of the original features and details of the data.
Provide a one-dimensional sequence data adaptive smoothing filtering method, through uniform sampling within the value range of the smoothing coefficient, processing the data based on exponential filtering, counting the maximum value and minimum value, and calculating the smoothness and error indexes. Construct a comprehensive weight and automatically select the optimal smoothing coefficient value for filtering.
Frequent debugging is avoided, data processing efficiency is improved, noise and field values are effectively eliminated in the data, main trends and characteristics of the data are retained, and the credibility of data analysis is improved.
Smart Images

Figure CN118971838A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of digital processing technology, and in particular to a one-dimensional sequence data adaptive smoothing filtering method, device and medium. Background Art
[0002] Data smoothing helps improve the quality of data analysis and the credibility of the results. Data smoothing can reduce random noise in the data, make the signal outline clearer, make it easier to identify the main trends and periodic characteristics in the data, simplify the complexity of the data model, and facilitate the establishment and understanding of the relationship between the data. In time series analysis, smoothing can also be used to predict future values or interpolate missing data.
[0003] When selecting a data smoothing method, it is necessary to select appropriate filtering methods and filtering parameters according to the characteristics of the data, which often takes a lot of time and increases the workload of users. Improper setting of filtering parameters may lead to over-smoothing and loss of the original characteristics and details of the data. Summary of the invention
[0004] In view of this, the present disclosure hopes to provide a one-dimensional sequence data adaptive smoothing filtering method, device and medium; it is able to adaptively select filtering parameters to remove and smooth outliers and noise in the data without relying on the characteristics of the original data, thus avoiding frequent debugging and improving data processing efficiency.
[0005] The technical solution of the present disclosure is achieved as follows:
[0006] In a first aspect, the present disclosure provides a one-dimensional sequence data adaptive smoothing filtering method, the method comprising:
[0007] For the smoothing coefficient representing the current data weight in the exponential filter, multiple smoothing coefficient values are uniformly sampled within its value range;
[0008] Processing the one-dimensional data sequence based on exponential filtering to obtain a plurality of filtered data sequences corresponding to the plurality of smoothing coefficient values, wherein each smoothing coefficient value corresponds to a filtered data sequence;
[0009] For each filtered data sequence, the number of maximum values and minimum values is counted to obtain a smoothness index corresponding to each filtered data sequence;
[0010] Obtaining an error index corresponding to each filtered data sequence according to the degree of deviation of each filtered data sequence relative to the one-dimensional data sequence;
[0011] Constructing a comprehensive weight matching the filtering performance of each smoothing coefficient value through the smoothness index and the error index;
[0012] An optimal smoothing coefficient value is obtained according to the comprehensive weight, so as to obtain an optimal filtering result by processing the one-dimensional data sequence according to the optimal smoothing coefficient value.
[0013] In a second aspect, the present disclosure provides a one-dimensional sequence data adaptive smoothing filtering device, the device comprising a parameter sampling part, a processing part, a first evaluation part, a second evaluation part, a third evaluation part, and a determination part, wherein:
[0014] The parameter sampling part is configured to: uniformly sample the smoothing coefficient representing the current data weight in the exponential filter within its value range to obtain multiple smoothing coefficient values;
[0015] The processing part is configured to: process the one-dimensional data sequence based on exponential filtering to obtain a plurality of filtered data sequences corresponding to the plurality of smoothing coefficient values, wherein each smoothing coefficient value corresponds to a filtered data sequence;
[0016] The first evaluation part is configured to: count the number of maximum values and minimum values for each filtered data sequence to obtain a smoothness index corresponding to each filtered data sequence;
[0017] The second evaluation part is configured to: obtain an error index corresponding to each filtered data sequence according to the degree of deviation of each filtered data sequence relative to the one-dimensional data sequence;
[0018] The third evaluation part is configured to: construct a comprehensive weight matching the filtering performance of each smoothing coefficient value through the smoothness index and the error index;
[0019] The determination part is configured to obtain an optimal smoothing coefficient value according to the comprehensive weight, so as to obtain an optimal filtering result by processing the one-dimensional data sequence according to the optimal smoothing coefficient value.
[0020] In a third aspect, the present disclosure provides a computer-readable storage medium storing at least one instruction, wherein the at least one instruction is used to be executed by a processor to implement the one-dimensional sequence data adaptive smoothing filtering method as described in the first aspect.
[0021] The present invention discloses a one-dimensional sequence data adaptive smoothing filtering method, device and medium; by uniformly sampling within the value range of the smoothing coefficient, the filtered data is comprehensively weighted evaluated through the smoothness index and the error index, the smoothing coefficient suitable for the original data is selected, the noise and wild values in the original data are smoothed and eliminated, frequent debugging is avoided, and the data processing efficiency is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A flow chart of a one-dimensional sequence data adaptive smoothing filtering method provided by the present disclosure;
[0023] Figure 2 A schematic diagram of a nonlinear data sequence filtering result provided by the present disclosure;
[0024] Figure 3 A schematic diagram of filtering results of a periodic data sequence provided by the present disclosure;
[0025] Figure 4 A schematic diagram of the composition of a one-dimensional sequence data adaptive smoothing filter device provided by the present invention;
[0026] Figure 5 A schematic diagram of the structure of a computing device provided by the present disclosure. DETAILED DESCRIPTION
[0027] The technical solutions in the present disclosure will be described clearly and completely below in conjunction with the accompanying drawings in the present disclosure.
[0028] One-dimensional sequence data generally includes a set of data points arranged in time or space, where each data point is an element in the sequence. For example, data recorded in time order, such as stock prices, temperature records, sales, etc., event log data recorded in time order generated by systems, applications or user activities, such as continuous measurements from sensors such as temperature, pressure, position, etc., such as audio data, etc.
[0029] The present disclosure provides a one-dimensional sequence data adaptive smoothing filtering method, which includes steps S101 to S106.
[0030] S101: For a smoothing coefficient representing the current data weight in an exponential filter, uniformly sample within its value range to obtain a plurality of smoothing coefficient values.
[0031] Exponential filtering, also known as exponential weighted moving average (EWMA) or exponential smoothing, is a smoothing technique in time series analysis. It gives more weight to the most recent data, while the weight of the earlier historical data gradually decreases. The weight is distributed in an exponential decay manner. Its general expression is shown as follows:
[0032] y t =λx t +(1-λ)y t-1
[0033] In the formula, y tis the filtered data at time t, x t is the observed data at time t, λ is the smoothing coefficient that represents the weight of the data at time t, ranging from 0 to 1, and is usually called the weight coefficient or smoothing coefficient; historical data y t-1 The weight of is 1-λ.
[0034] From the above formula, we can know that λ is the weight of the current data, and 1-λ is the weight of the historical data. Through continuous iteration, the weighted average of the historical data is taken. The weight of the recent data is greater than that of the past data, and as the historical data is farther away from the current moment, its weight decreases exponentially. When λ=1, the filtered data y t is the current observation value x t , when λ = 0, the filtered data is completely independent of the current observation value, and only historical data is used. In practical applications, appropriate parameters can be selected based on experience according to the characteristics of the data, and sometimes it is necessary to repeatedly adjust according to the results of the output data to obtain the optimal smoothing coefficient value.
[0035] In the range of the smoothing coefficient λ [0, 1], multiple smoothing coefficient values are obtained by uniform sampling. For example, 10 smoothing coefficient values are set to be sampled, the 0th smoothing coefficient value is λ0=0.98, the i-th smoothing coefficient value is λ i =λ0-0.1*i, 0≤i≤9.
[0036] S102: Processing the one-dimensional data sequence based on exponential filtering to obtain multiple filtered data sequences corresponding to the multiple smoothing coefficient values, wherein each smoothing coefficient value corresponds to a filtered data sequence.
[0037] Based on the exponential filtering, the one-dimensional data sequence is processed to obtain multiple filtered data sequences corresponding to the multiple smoothing coefficient values. For the above example, for the i-th smoothing coefficient λ i , the one-dimensional data sequence x can be filtered by exponential filtering t Processing, obtain the corresponding filtered data y t,i , each smoothing coefficient λ i Corresponding to a set of filtered data sequence y t,i .
[0038] In some examples, the processing of the one-dimensional data sequence based on exponential filtering to obtain multiple filtered data sequences corresponding to the multiple smoothing coefficient values includes:
[0039] The one-dimensional data sequence is processed by bidirectional exponential filtering to obtain multiple filtered data sequences corresponding to the multiple smoothing coefficient values.
[0040] Bidirectional exponential filtering includes the following steps:
[0041] Perform forward exponential filtering on a one-dimensional data sequence. In some examples, for a given time series {x t}, its forward exponential filtering formula is:
[0042] s t =λx t +(1-λ)s t-1
[0043] Where λ is the smoothing coefficient, 0<λ<1, s t is the value after forward filtering.
[0044] Perform backward exponential filtering on a one-dimensional data series. In the above example, for a given time series {x t}, and its backward exponential filtering formula is:
[0045] r t =λx t +(1-λ)r t+1
[0046] Among them, r t is the value after back filtering.
[0047] The bidirectional exponential filtering result is obtained by weighted averaging the forward exponential filtering result and the backward exponential filtering result:
[0048]
[0049] Bidirectional exponential filtering is a filtering method used to smooth time series data. Unlike traditional one-way exponential smoothing, bidirectional exponential filtering considers both forward and backward information, which can better handle noise in time series and retain the main trends and change characteristics of the data. It can respond to data changes in a timely manner, and has higher accuracy and sensitivity than forward-only or backward-only filtering methods, and can achieve a good balance between reducing noise and retaining trends.
[0050] In some examples, processing a one-dimensional data sequence by bidirectional exponential filtering to obtain a plurality of filtered data sequences corresponding to the plurality of smoothing coefficient values includes:
[0051] For each smoothing coefficient value, the one-dimensional data sequence is processed by bidirectional exponential filtering to obtain a first filtering sequence;
[0052] Performing outlier elimination processing on the first filter sequence to obtain a second filter sequence;
[0053] The second filtering sequence is again subjected to bidirectional exponential filtering according to each of the smoothing coefficient values to obtain a filtering data sequence corresponding to each of the smoothing coefficient values.
[0054] Outliers refer to values in the data that are significantly different from other data, usually far away from the central trend of the data. These values may be caused by measurement errors, entry errors, or other variations. The presence of outliers may have a significant impact on the results of data analysis, including distorting statistical models and affecting the accuracy of fitting or prediction. Outlier removal includes at least one of the following operations: identifying, investigating, correcting, deleting, transforming, and retaining outliers. By removing outliers, data quality can be improved, the credibility of data analysis results can be enhanced, overfitting can be avoided, and model accuracy can be improved, so that analysts can better understand data structures and patterns.
[0055] Two rounds of bidirectional exponential filtering are performed on the time series to further enhance the data smoothing effect and trend capture ability.
[0056] Specifically, for the data sequence y after the first bidirectional filtering, t The second filtered sequence y′ obtained by removing outliers t Perform the second bidirectional filtering:
[0057] s′ t =λy′ t +(1-λ)s′ t-1
[0058] r′ t =λy′ t +(1-λ)r′ t+1
[0059]
[0060] By using two-way filtering, the noise in the time series can be reduced more effectively. Two-way filtering combines forward and backward information to capture the trend of the time series more accurately. It can respond to data changes in a timely manner, and has higher accuracy and sensitivity than single two-way filtering. It is not only suitable for time series with linear trends, but also can handle more complex trends and fluctuations, and is more suitable for application scenarios with high real-time requirements. Two-way exponential filtering provides higher smoothness and is suitable for situations that require extremely high data smoothness. Two-way exponential filtering has obvious advantages in noise processing, trend capture, response speed and data smoothness, and is suitable for more complex and changeable time series data analysis and processing.
[0061] S103: Counting the number of maximum and minimum values for each filtered data sequence to obtain a smoothness index corresponding to each filtered data sequence.
[0062] In some examples, the step of counting the number of maximum values and minimum values for each filtered data sequence to obtain a smoothness index corresponding to each filtered data sequence includes:
[0063] Calculate the number of maximum and minimum values of each filtered data sequence to obtain a smoothness parameter corresponding to each filtered data sequence;
[0064] The difference between the smoothness parameter and the initial smoothness parameter is the smoothness index corresponding to each filtered data sequence, wherein the initial smoothness parameter is the smoothness parameter of the filtered data sequence corresponding to the maximum value among the multiple smoothing coefficient values.
[0065] Specifically, the smoothness index I of the i-th filtered data sequence corresponding to the i-th smoothing coefficient value is ni The expression is as follows:
[0066]
[0067] Where Δn=n i -n0,n i represents the smoothness parameter of the i-th filtered data sequence, and n0 is the smoothness parameter of the filtered data sequence corresponding to the maximum value among the multiple smoothing coefficient values.
[0068] The maximum and minimum values in the data sequence include those caused by jump errors and periodic changes of the data itself. The number of maximum and minimum values can reflect the volatility, change trend and potential abnormalities of the data. The larger the smoothing coefficient value, the faster the filter data sequence responds to new data, the lower the smoothing degree, and the more it can capture recent changes in the data. Correspondingly, the larger the smoothing parameter. The smaller the smoothing coefficient value, the slower the filter data sequence responds to new data, the higher the smoothing degree, and the better the smoothing effect on long-term trends. Correspondingly, the smaller the smoothing parameter. The smoothness index represents the change of the smoothness parameter corresponding to different smoothing coefficient values relative to the smoothness parameter corresponding to the maximum smoothing coefficient value. The smoothness index is a function of the smoothness parameter, which can be a linear function or other function forms according to the specific situation. The smoothness index is a measure of the smoothness of the filtered data, which can generally be characterized by the difference in the number of extreme values of the data before and after filtering. The smaller the smoothness index, the smoother the filtered data.
[0069] S104: Obtaining an error index corresponding to each filtered data sequence according to the degree of deviation of each filtered data sequence relative to the one-dimensional data sequence.
[0070] The error index characterizes the degree of deviation of the filtered data from the original data and can be used to evaluate the performance of the filter. Error indexes can be used in methods including mean square error, mean absolute error, mean absolute percentage error, R square, etc.
[0071] In some examples, obtaining the error index corresponding to each filtered data sequence according to the degree of deviation of each filtered data sequence relative to the one-dimensional data sequence includes:
[0072] For each filtered data sequence, the mean of the absolute values of the errors with the one-dimensional data sequence is calculated to obtain the error index corresponding to each filtered data sequence.
[0073] The error index represents the average degree of difference between the filtered data sequence and the original one-dimensional data sequence, reflecting the difference between the data before and after filtering. If the index is too small, it means that the difference between the data before and after filtering is not large. If the index is too large, it means that the difference between the data before and after filtering is large.
[0074] S105: Constructing a comprehensive weight matching the filtering performance of each smoothing coefficient value through the smoothness index and the error index.
[0075] In some examples, constructing a comprehensive weight matching the filtering performance of each smoothing coefficient value by using the smoothness index and the error index includes:
[0076] Obtaining a smoothness index weight corresponding to each smoothing coefficient value according to the fluctuation of the smoothness index;
[0077] Obtaining an error index weight corresponding to each smoothing coefficient value according to the error index;
[0078] The comprehensive weight corresponding to each smoothing coefficient value is obtained by multiplying the smoothness index weight by the error index weight.
[0079] Each smoothing coefficient value corresponds to a filtered data sequence, and each filtered data sequence corresponds to a smoothness index. Therefore, each smoothing coefficient value corresponds to a smoothness index. Through the change of the smoothness index, the influence of the filtering process corresponding to each smoothing coefficient value on the smoothness of the original one-dimensional data sequence can be analyzed. Noise data is irregular, and the sudden change of noise data causes its frequency to be relatively high. Generally, the selection of the smoothing coefficient value is expected to smooth out the noise data in the one-dimensional data sequence by filtering without affecting the change law of the data itself, so as to evaluate the performance of the smoothness index. Therefore, the appropriate smoothing coefficient value can be selected according to the fluctuation of the smoothness index. The fluctuation of the smoothness index is characterized by the change amplitude, change direction, change trend and other characteristics of the smoothness index value relative to a certain reference value or reference range. Setting the corresponding smoothness index weight for each smoothness index is equivalent to setting the weight for the corresponding smoothing coefficient value according to the smoothness index. The better the performance of the smoothness index, the larger the corresponding smoothness index weight value. The smoothness index weight can be used as a reference parameter for selecting the smoothing coefficient value.
[0080] The error index is another indicator for evaluating filtering performance, and the smoothing coefficient value can also be selected by analyzing its changing rules. Setting the error index weight by analyzing the error index is equivalent to setting the weight for the corresponding smoothing coefficient value according to the error index. The better the error index performance, the larger the corresponding error index weight value. The error index weight can be used as another reference parameter for selecting the smoothing coefficient value.
[0081] The comprehensive weight of the smoothing coefficient value is determined by multiplying the smoothness index weight and the error index weight, which serves as an indicator to characterize the comprehensive performance of the smoothing coefficient value.
[0082] In some examples, obtaining a smoothness indicator weight corresponding to each smoothing coefficient value according to the fluctuation of the smoothness indicator includes:
[0083] According to the fluctuation of each smoothness indicator relative to the maximum value of all smoothness parameters, a first weight parameter corresponding to each smoothness indicator is obtained;
[0084] Obtaining a second weight parameter corresponding to each smoothness indicator according to the fluctuation of each smoothness indicator relative to a first difference between a maximum value and a minimum value among all smoothness parameters;
[0085] The smoothness indicator weight corresponding to each smoothness indicator is constructed by using the first weight parameter and the second weight parameter.
[0086] The fluctuation of smoothness indicators is evaluated by the ratio of each smoothness indicator to the maximum value of all smoothness parameters, and the relative fluctuation of smoothness indicators is evaluated based on the fluctuation range of smoothness parameters.
[0087] In some examples, obtaining a first weight parameter corresponding to each smoothness indicator according to the fluctuation of each smoothness indicator relative to a maximum value among all smoothness parameters includes:
[0088] When the initial smoothness parameter is less than or equal to 5, the first weight parameter corresponding to each smoothness index is 1 / 5 of each smoothness index;
[0089] When the initial smoothness parameter is greater than 5, the first weight parameter corresponding to each smoothness index is the ratio of each smoothness index to the initial smoothness parameter.
[0090] Specifically, for the smoothness index I corresponding to the i-th smoothing coefficient value ni , the corresponding first weight parameter c 1i It can be expressed as follows:
[0091]
[0092] Among them, n0 is the initial smoothness parameter, that is, the smoothness parameter of the filtered data sequence corresponding to the maximum value among the multiple smoothing coefficient values.
[0093] The first weight parameter c 1i This can avoid large relative values when n0 is small.
[0094] In some examples, obtaining a second weight parameter corresponding to each smoothness indicator according to the fluctuation of each smoothness indicator relative to a first difference between a maximum value and a minimum value of all smoothness parameters includes:
[0095] Calculate the difference between the maximum and minimum values of all smoothness parameters as the first difference;
[0096] When the first difference is less than or equal to 5, the second weight parameter corresponding to each smoothness index is 1 / 5 of each smoothness index;
[0097] When the first difference is greater than 5, the second weight parameter corresponding to each smoothness indicator is the ratio of each smoothness indicator to the first difference.
[0098] Specifically, for the smoothness index I corresponding to the i-th smoothing coefficient value ni , and its corresponding second weight parameter c 2i It can be expressed as follows:
[0099]
[0100] Among them, I ni is the smoothness index corresponding to the i-th smoothing coefficient value, Δn max It is the first difference between the maximum and minimum values of all smoothness parameters.
[0101] In some examples, constructing the smoothness indicator weight corresponding to each smoothness indicator by using the first weight parameter and the second weight parameter includes:
[0102] The smoothness indicator weight corresponding to each of the smoothness indicators is obtained by taking a weighted average of the exponent of the first weight parameter and the exponent of the second weight parameter.
[0103] Specifically, the smoothness index weight w of the i-th smoothness index is ni It can be expressed as:
[0104]
[0105] Among them, i represents the sampling number of the smoothing coefficient value, c 1iIt is represented as the first weight parameter corresponding to the i-th smoothness index, c 2i Represented as the second weight parameter corresponding to the i-th smoothness index.
[0106] Each smoothing coefficient value corresponds to a filter data sequence, and each filter data sequence corresponds to an error index. The error index is another index for evaluating filter performance, and the error index weight can be set for the corresponding smoothing coefficient value according to the size of the error index.
[0107] In some examples, obtaining the error index weight corresponding to each smoothing coefficient value according to the error index includes:
[0108] For each error indicator, the error indicator weight corresponding to each smoothing coefficient value is determined according to the fluctuation of each error indicator relative to the second difference between the maximum value and the minimum value of the error indicator.
[0109] Specifically, the error index weight w ej It can be expressed as:
[0110]
[0111] in,
[0112] The comprehensive weight w corresponding to the i-th smoothing coefficient value i Through the smoothness index weight w ni and the error index weight w ei The product of can be expressed as:
[0113] w i =w ni × ei .
[0114] The smoothness index and the error index are contradictory indexes. The present invention automatically adjusts the weight between the two through an adaptive method to achieve the best filtering effect.
[0115] S106: Obtain an optimal smoothing coefficient value according to the comprehensive weight, and process the one-dimensional data sequence according to the optimal smoothing coefficient value to obtain an optimal filtering result.
[0116] In some examples, obtaining an optimal smoothing coefficient value according to the comprehensive weight includes:
[0117] An optimal smoothing coefficient value is obtained by bilinear interpolation according to the first smoothing coefficient value and the second smoothing coefficient value adjacent to the smoothing coefficient value with the largest comprehensive weight.
[0118] Specifically, assuming that the largest comprehensive weight is wj , and its corresponding smoothing coefficient value is λ j , and λ j The adjacent first smoothing coefficient value is λ j-1 , and λ j The adjacent second smoothing coefficient value is λ j+1 , the optimal smoothing coefficient value λ is obtained by bilinear interpolation according to the first smoothing coefficient value and the second smoothing coefficient value, and the expression is as follows:
[0119] λ=a1λ j-1 +a2λ j+1
[0120] Among them, parameters a1 and a2 are expressed by the corresponding comprehensive weights w j+1 and w j-1 Obtained, as shown below:
[0121]
[0122] in,
[0123] Δw=2w j +w j-1 -w j+1
[0124] Δw1=w j -w j+1
[0125] Δw2=w j -w j-1 .
[0126] In the formula, the first smoothing coefficient value λ j-1 The corresponding first comprehensive weight is w j-1 , the second smoothing coefficient value λ j+1 The corresponding second comprehensive weight is w j+1 .
[0127] The optimal smoothing coefficient value is obtained by bilinear interpolation, which solves the problem that the optimal smoothing coefficient cannot be selected due to the large smoothing coefficient sampling interval, so that the selection of the optimal smoothing coefficient value is not limited by the smoothing coefficient sampling granularity. First, based on the smoothing coefficient sampling interval, such as 0.1 in the above example, multiple smoothing coefficient values are obtained, and the optimal smoothing coefficient value is further calculated between the two adjacent smoothing coefficients according to the smoothing coefficient value corresponding to the maximum value of the comprehensive weight, which reduces the amount of calculation.
[0128] Through the above technical scheme, by uniformly sampling within the range of the smoothing coefficient, the filtered data is comprehensively weighted evaluated through the smoothness index and the error index, the smoothing coefficient value suitable for the original data is selected, the noise and outliers in the original data are smoothed and eliminated, frequent debugging is avoided, and the data processing efficiency is improved.
[0129] The present invention selects two groups of data sequences, the first group is a quadratic nonlinear sequence data X1 with noise and wild values, and the second group is a periodic data sequence X2 with noise and wild values. The above method is used to process them, and the smoothing coefficient value λ0 is set to 0.98, λ i =λ0-0.1*i, 0≤i≤9.
[0130] The above two sets of data are based on the smoothing coefficient value λ i Perform bidirectional filtering, remove outliers, and then perform bidirectional exponential filtering to obtain 9 groups of filtered data sequences. The smoothness index parameters calculated for each filtered data sequence are:
[0131] The smoothness indices of the first set of data are: 0, 5, 59, 114, 168, 194, 216, 238, 260;
[0132] The smoothness indices of the second set of data are: 0, 2, 19, 39, 79, 57, 185, 231, 269;
[0133] The error indicators calculated for each filtered data sequence are:
[0134] The error index data of the first set of data are: 0.9054, 0.5436, 0.5214, 0.4965, 0.4663, 0.4289, 0.3811, 0.325, and 0.2423 respectively.
[0135] The error index data of the second set of data are: 0.7087, 0.4191, 0.2967, 0.2622, 0.2420, 0.2221, 0.1995, 0.1685, and 0.1266 respectively.
[0136] Based on the above smoothness parameters, smoothness indicators, and error indicators, the comprehensive weight corresponding to each smoothing coefficient value is calculated respectively:
[0137] The maximum and minimum values of the smoothness parameter of the first set of data are 260 and 0 respectively.
[0138] The maximum and minimum values of the smoothness parameter for the second set of data are 269 and 0 respectively.
[0139] The comprehensive weights of the 10 data in the first group are: 0.0821, 0.1753, 0.0709, 0.0332, 0.0162, 0.0125, 0.0107, 0.0095, and 0.0092 respectively.
[0140] The comprehensive weights of the 10 data in the second group are: 0.0821, 0.2719, 0.3145, 0.2389, 0.1199, 0.0479, 0.0245, 0.058, and 0.0093 respectively.
[0141] The smoothing coefficient value corresponding to the maximum value of the comprehensive weight of the first group of data is λ1;
[0142] The smoothing coefficient value corresponding to the maximum value of the comprehensive weight of the second set of data is λ2.
[0143] For the first set of data, the optimal smoothing coefficient value λ=0.8597 is obtained by using the bilinear interpolation method based on the smoothing coefficient values λ0 and λ2 adjacent to λ1;
[0144] For the second set of data, the optimal smoothing coefficient value λ=0.7582 is obtained by performing bilinear interpolation method based on the smoothing coefficient values λ1 and λ3 adjacent to λ2.
[0145] According to λ=0.8597, the first set of data is subjected to bidirectional exponential filtering, outlier removal, and exponential filtering again to obtain the optimal filtered data sequence, as shown in Figure 2 As shown, the solid line is the original data waveform, and the dotted line is the optimal filtered data.
[0146] According to λ=0.7582, the second set of data is subjected to bidirectional exponential filtering, outlier removal, and exponential filtering again to obtain the optimal filtered data sequence, as shown in Figure 3 As shown, the solid line is the original data waveform, and the dotted line is the optimal filtered data.
[0147] pass Figure 2 and Figure 3 It can be observed that, for nonlinear data sequences and periodic data sequences, the method provided by the present disclosure can filter and smooth the noise and outliers in the data, and better preserve the trends and features of the original data.
[0148] Based on the same concept as the above technical solution, see Figure 4 The present disclosure provides a one-dimensional sequence data adaptive smoothing filter device 400, the device includes a parameter sampling part 401, a processing part 402, a first evaluation part 403, a second evaluation part 404, a third evaluation part 405, and a determination part 406, wherein:
[0149] The parameter sampling part 401 is configured to: uniformly sample the smoothing coefficient representing the current data weight in the exponential filter within its value range to obtain multiple smoothing coefficient values;
[0150] The processing part 402 is configured to: process the one-dimensional data sequence based on exponential filtering to obtain a plurality of filtered data sequences corresponding to the plurality of smoothing coefficient values, wherein each smoothing coefficient value corresponds to a filtered data sequence;
[0151] The first evaluation part 403 is configured to: count the number of maximum values and minimum values for each filtered data sequence to obtain a smoothness index corresponding to each filtered data sequence;
[0152] The second evaluation part 404 is configured to: obtain an error index corresponding to each filtered data sequence according to the degree of deviation of each filtered data sequence relative to the one-dimensional data sequence;
[0153] The third evaluation part 405 is configured to: construct a comprehensive weight matching the filtering performance of each smoothing coefficient value through the smoothness index and the error index;
[0154] The determination part 406 is configured to obtain an optimal smoothing coefficient value according to the comprehensive weight, so as to obtain an optimal filtering result by processing the one-dimensional data sequence according to the optimal smoothing coefficient value.
[0155] In some examples, the processing portion 402 is configured to:
[0156] The one-dimensional data sequence is processed by bidirectional exponential filtering to obtain multiple filtered data sequences corresponding to the multiple smoothing coefficient values.
[0157] In some examples, the processing portion 402 is configured to:
[0158] For each smoothing coefficient value, the one-dimensional data sequence is processed by bidirectional exponential filtering to obtain a first filtering sequence;
[0159] Performing outlier elimination processing on the first filter sequence to obtain a second filter sequence;
[0160] The second filtering sequence is again subjected to bidirectional exponential filtering according to each of the smoothing coefficient values to obtain a filtering data sequence corresponding to each of the smoothing coefficient values.
[0161] In some examples, the first evaluation part 403′ is configured to:
[0162] Calculate the number of maximum and minimum values of each filtered data sequence to obtain a smoothness parameter corresponding to each filtered data sequence;
[0163] The difference between the smoothness parameter and the initial smoothness parameter is the smoothness index corresponding to each filtered data sequence, wherein the initial smoothness parameter is the smoothness parameter of the filtered data sequence corresponding to the maximum value among the multiple smoothing coefficient values.
[0164] In some examples, the second evaluation portion 404′ is configured to:
[0165] For each filtered data sequence, the mean of the absolute values of the errors between each data and the corresponding data in the one-dimensional data sequence is calculated to obtain the error index corresponding to each filtered data sequence.
[0166] In some examples, the third evaluation portion 405′ is configured to:
[0167] Obtaining a smoothness index weight corresponding to each smoothing coefficient value according to the fluctuation of the smoothness index;
[0168] Obtaining an error index weight corresponding to each smoothing coefficient value according to the error index;
[0169] The comprehensive weight corresponding to each smoothing coefficient value is obtained by multiplying the smoothness index weight by the error index weight.
[0170] In some examples, the third evaluation portion 405′ is configured to:
[0171] According to the fluctuation of each smoothness indicator relative to the maximum value of all smoothness parameters, a first weight parameter corresponding to each smoothness indicator is obtained;
[0172] Obtaining a second weight parameter corresponding to each smoothness indicator according to the fluctuation of each smoothness indicator relative to a first difference between a maximum value and a minimum value among all smoothness parameters;
[0173] The smoothness indicator weight corresponding to each smoothness indicator is constructed by using the first weight parameter and the second weight parameter.
[0174] In some examples, the third evaluation portion 405′ is configured to:
[0175] When the initial smoothness parameter is less than or equal to 5, the first weight parameter corresponding to each smoothness index is 1 / 5 of each smoothness index;
[0176] When the initial smoothness parameter is greater than 5, the first weight parameter corresponding to each smoothness index is the ratio of each smoothness index to the initial smoothness parameter.
[0177] In some examples, the third evaluation portion 405′ is configured to:
[0178] Calculate the difference between the maximum and minimum values of all smoothness parameters;
[0179] When the difference is less than or equal to 5, the second weight parameter corresponding to each smoothness index is 1 / 5 of each smoothness index;
[0180] When the difference is greater than 5, the second weight parameter corresponding to each smoothness index is the ratio of each smoothness index to the difference.
[0181] In some examples, the third evaluation portion 405′ is configured to:
[0182] The smoothness indicator weight corresponding to each smoothness indicator is obtained by taking a weighted average of the exponent of the first weight parameter and the exponent of the second weight parameter.
[0183] In some examples, the third evaluation portion 405′ is configured to:
[0184] For each error indicator, the error indicator weight corresponding to each smoothing coefficient value is determined according to the fluctuation of each error indicator relative to the second difference between the maximum value and the minimum value of the error indicator.
[0185] In some examples, the determining portion 406 is configured to:
[0186] An optimal smoothing coefficient value is obtained by bilinear interpolation according to the first smoothing coefficient value and the second smoothing coefficient value adjacent to the smoothing coefficient value with the largest comprehensive weight.
[0187] refer to Figure 5 , which shows a block diagram of a computing device provided by an exemplary embodiment of the present disclosure. The computing device 500 has a communication function and can access a wired network or a wireless network. In some examples, the computing device 500 can receive data based on the wired network or wireless network accessed. It can be understood that the computing device 500 undertakes the calculation and processing work of the technical solution of the present disclosure, and the present disclosure does not limit this.
[0188] like Figure 5 As shown, the computing device in the present disclosure may include one or more of the following components: a processor 510 and a memory 520 .
[0189] Optionally, the processor 510 uses various interfaces and lines to connect various parts of the entire computing device, and executes various functions of the computing device and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 520, and calling data stored in the memory 520. Optionally, the processor 510 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 510 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a neural network processor (NPU), and a baseband chip. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content that needs to be displayed on the touch display; the NPU is used to implement artificial intelligence (AI) functions; and the baseband chip is used to process wireless communications. It is understandable that the above baseband chip may not be integrated into the processor 510, but may be implemented by a separate chip.
[0190] The memory 520 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 520 includes a non-transitory computer-readable storage medium. The memory 520 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 520 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above various method embodiments, etc.; the data storage area may store data created according to the use of the computing device, etc.
[0191] In addition, those skilled in the art will appreciate that the structure of the computing device shown in the above figures does not constitute a limitation on the computing device, and the computing device may include more or fewer components than shown, or combine certain components, or arrange the components differently. For example, the computing device also includes a display screen, a camera assembly, a microphone, a speaker, a radio frequency circuit, an input unit, a sensor (such as an acceleration sensor, an angular velocity sensor, a light sensor, etc.), an audio circuit, a WiFi module, a power supply, a Bluetooth module, and other components, which will not be described in detail here.
[0192] The present disclosure also provides a computer-readable storage medium storing at least one instruction, wherein the at least one instruction is used to be executed by a processor to implement the one-dimensional sequence data adaptive smoothing filtering method as described in the above embodiments.
[0193] The present disclosure also provides a computer program product, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computing device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computing device executes to implement the one-dimensional sequence data adaptive smoothing filtering method described in the above-mentioned embodiments.
[0194] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present disclosure can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any media that facilitates the transmission of computer programs from one place to another. Storage media can be any available media that can be accessed by a general or special-purpose computer.
[0195] It should be noted that the technical solutions described in the present disclosure can be combined arbitrarily without conflict.
[0196] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A one-dimensional sequence data adaptive smoothing filtering method, characterized in that: The method comprises: For the smoothing coefficient representing the current data weight in the exponential filter, multiple smoothing coefficient values are uniformly sampled within its value range; Processing the one-dimensional data sequence based on exponential filtering to obtain a plurality of filtered data sequences corresponding to the plurality of smoothing coefficient values, wherein each smoothing coefficient value corresponds to a filtered data sequence; For each filtered data sequence, the number of maximum values and minimum values is counted to obtain a smoothness index corresponding to each filtered data sequence; Obtaining an error index corresponding to each filtered data sequence according to the degree of deviation of each filtered data sequence relative to the one-dimensional data sequence; Constructing a comprehensive weight matching the filtering performance of each smoothing coefficient value through the smoothness index and the error index; An optimal smoothing coefficient value is obtained according to the comprehensive weight, so as to obtain an optimal filtering result by processing the one-dimensional data sequence according to the optimal smoothing coefficient value.
2. The method according to claim 1, characterized in that The step of processing the one-dimensional data sequence based on exponential filtering to obtain a plurality of filtered data sequences corresponding to the plurality of smoothing coefficient values comprises: For each smoothing coefficient value, the one-dimensional data sequence is processed by bidirectional exponential filtering to obtain a first filtering sequence; Performing outlier elimination processing on the first filter sequence to obtain a second filter sequence; The second filtering sequence is again subjected to bidirectional exponential filtering according to each of the smoothing coefficient values to obtain a filtering data sequence corresponding to each of the smoothing coefficient values.
3. The method according to claim 1, characterized in that: The step of counting the number of maximum values and minimum values for each filtered data sequence to obtain a smoothness index corresponding to each filtered data sequence includes: Calculate the number of maximum and minimum values of each filtered data sequence to obtain a smoothness parameter corresponding to each filtered data sequence; The difference between the smoothness parameter and the initial smoothness parameter is the smoothness index corresponding to each filtered data sequence, wherein the initial smoothness parameter is the smoothness parameter of the filtered data sequence corresponding to the maximum value among the multiple smoothing coefficient values.
4. The method according to claim 1, characterized in that: The step of obtaining a comprehensive weight corresponding to each smoothing coefficient value according to the smoothness index and the error index includes: Obtaining a smoothness index weight corresponding to each smoothing coefficient value according to the fluctuation of the smoothness index; Obtaining an error index weight corresponding to each smoothing coefficient value according to the error index; The comprehensive weight corresponding to each smoothing coefficient value is obtained by multiplying the smoothness index weight by the error index weight.
5. The method according to claim 4, characterized in that The step of obtaining a smoothness index weight corresponding to each smoothness coefficient value according to the fluctuation of the smoothness index includes: According to the fluctuation of each smoothness indicator relative to the maximum value of all smoothness parameters, a first weight parameter corresponding to each smoothness indicator is obtained; Obtaining a second weight parameter corresponding to each smoothness indicator according to the fluctuation of each smoothness indicator relative to a first difference between a maximum value and a minimum value among all smoothness parameters; The smoothness indicator weight corresponding to each smoothness indicator is constructed by using the first weight parameter and the second weight parameter.
6. The method according to claim 5, characterized in that The step of constructing the smoothness indicator weight corresponding to each smoothness indicator by using the first weight parameter and the second weight parameter includes: The smoothness indicator weight w corresponding to the i-th smoothness indicator ni As shown below: Among them, i represents the sampling number of the smoothing coefficient value, c 1i It is represented as the first weight parameter corresponding to the i-th smoothness index, c 2i Represented as the second weight parameter corresponding to the i-th smoothness index.
7. The method according to claim 4, characterized in that The step of obtaining the error index weight corresponding to each smoothing coefficient value according to the error index includes: For each error indicator, the error indicator weight corresponding to each smoothing coefficient value is determined according to the fluctuation of each error indicator relative to the second difference between the maximum value and the minimum value of the error indicator.
8. The method according to claim 1, characterized in that The obtaining of the optimal smoothing coefficient value according to the comprehensive weight comprises: An optimal smoothing coefficient value is obtained by bilinear interpolation according to the first smoothing coefficient value and the second smoothing coefficient value adjacent to the smoothing coefficient value with the largest comprehensive weight.
9. A one-dimensional sequence data adaptive smoothing filter device, characterized in that: The device comprises a parameter sampling part, a processing part, a first evaluation part, a second evaluation part, a third evaluation part, and a determination part, wherein: The parameter sampling part is configured to: uniformly sample the smoothing coefficient representing the current data weight in the exponential filter within its value range to obtain multiple smoothing coefficient values; The processing part is configured to: process the one-dimensional data sequence based on exponential filtering to obtain a plurality of filtered data sequences corresponding to the plurality of smoothing coefficient values, wherein each smoothing coefficient value corresponds to a filtered data sequence; The first evaluation part is configured to: count the number of maximum values and minimum values for each filtered data sequence to obtain a smoothness index corresponding to each filtered data sequence; The second evaluation part is configured to: obtain an error index corresponding to each filtered data sequence according to the degree of deviation of each filtered data sequence relative to the one-dimensional data sequence; The third evaluation part is configured to: construct a comprehensive weight matching the filtering performance of each smoothing coefficient value through the smoothness index and the error index; The determination part is configured to obtain an optimal smoothing coefficient value according to the comprehensive weight, so as to obtain an optimal filtering result by processing the one-dimensional data sequence according to the optimal smoothing coefficient value.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and the at least one instruction is used to be executed by a processor to implement a one-dimensional sequence data adaptive smoothing filtering method according to any one of claims 1 to 8.
