A length normalization method based on time series
The data during the casting process of magnesium alloy is processed through sliding window filtering and weight-based time series length normalization algorithm, which solves the data noise and mutation point problems, realizes the smooth and consistent data processing, and provides a stable input basis. Laid a solid foundation for neural network model training.
Patent Information
- Application Number
- CN202410538574.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-30
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-04-30
AI Technical Summary
The prior art cannot effectively deal with the noise and irregular fluctuations of data samples during the casting of magnesium alloys, resulting in data mutation points and data lengths of each row in the data set, affecting the training effect of the neural network.
Sliding window filtering technology is used to smooth data, combined with weight-based time series length normalization algorithm (WRP) to ensure data consistency and isometric processing, eliminate noise and mutation points, while compressing long time series without changing short time The trend of sequence changes.
Through the combination of sliding window filtering and WRP algorithm, data noise and irregular fluctuations are eliminated, data smoothness and consistency are ensured, and a more stable input foundation is provided, laying a solid foundation for neural network model training.
Smart Images

Figure CN118332247B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of data processing, in particular to a length normalization method based on time series. Background Art
[0002] With the widespread application of magnesium alloy castings, the casting process faces a challenge: when the magnesium alloy solution is injected into the mold, its flow rate often cannot be accurately controlled within the required range. This not only reduces the qualification rate of castings, but may also cause damage to the mold due to air compression problems. Therefore, it is extremely important to perform real-time measurement of the magnesium alloy solution injected into the mold. However, due to the easy oxidation of magnesium alloys at high temperatures and the harshness of the measurement environment, traditional direct measurement technologies such as flow meters or valve switches cannot meet the requirements of real-time measurement. To address this practical problem, one method is to establish a relationship model between impact force and flow based on a neural network model based on CNN and LSTM. However, for this neural network learning method, it is critical to have a reliable, accurate, and easy-to-analyze data set and time series data of equal length as suitable features. This involves the problem of data preprocessing and normalization before training the neural network;
[0003] The flow measurement experimental platform based on impact force that simulates this working condition is composed of the following: PLC, electronic scale, high-precision pressure sensor, water tank, host computer and adjustable frequency water pump. The frequency of the pump is adjusted by the host computer through the PLC, and the force of the water flow impacting the inclined surface at the outlet is collected by an industrial pressure sensor. The water flowing into the water tank is weighed by an electronic scale, and the weighed values are labeled accordingly.
[0004] The main methods of neural network data normalization include: Batch Normalization, Layer Normalization, Group Normalization, Instance Normalization, and Weight Normalization.
[0005] Batch normalization and layer normalization are both normalization methods based on statistical characteristics, but batch normalization focuses on the characteristics of the entire batch, while layer normalization focuses on the layers within a single sample; instance normalization is particularly suitable for the field of image processing; group normalization is a compromise between batch normalization and instance normalization, suitable for small batches of data. Weight normalization focuses on optimizing the weights themselves rather than standardizing the output.
[0006] Through the experimental platform of this project, the impact force sequence of water flow impacting the inclined surface of the pipe under different speeds and time conditions of the pump is collected, and the total mass of the outflowing solution is recorded at the same time; however, due to the different sampling time of each type of pump, the length of the impact force sequence is different. After collecting data samples through the experimental platform, data with noise or irregular fluctuations may appear. At the same time, there will be data mutation points in the classified data set and the length of each row of data will be different. Combined with the current technology as a reference, there are five types of data preprocessing normalization, including batch normalization, layer normalization, group normalization, instance normalization, and weight normalization. None of these five normalization algorithms have the ability to solve the above two problems.
[0007] To this end, those skilled in the art have proposed a time series-based length normalization method to solve the problem raised by the background technology. Summary of the invention
[0008] In order to solve the above technical problems, the present invention provides a length normalization method based on time series to solve the problem in the prior art that after collecting data samples through an experimental platform, data with noise or irregular fluctuations may appear. At the same time, there will be data mutation points in the classified data set and the length of each row of data is different. Combined with the current technology as a reference, there are five types of data preprocessing normalization, including: batch normalization, layer normalization, group normalization, instance normalization, and weight normalization. These five normalization algorithms do not have the ability to solve the above two problems.
[0009] A length normalization method based on time series includes the following steps:
[0010] S1. Obtain the experimental sample data set; use the total mass of the solution as the classification grade standard and divide it into several categories according to actual conditions;
[0011] S2. The classification labels of the data set are based on the total mass of each water flow. Several categories need to be specifically classified and divided, and then statistically recorded in a table form; the purpose is to clearly and intuitively see the number of samples in different categories and prepare for subsequent data processing;
[0012] S3. In order to process the collected impact force data more finely, the sliding window filtering technology is used. This technology helps to smooth the impact force data, eliminate potential noise or irregular fluctuations, and analyze the trend and characteristics of the data more accurately. By implementing the sliding window on the time series, the obtained impact force data is ensured to be smooth and coherent, laying a solid foundation for further analysis and the accuracy of the experimental results.
[0013] S4. The optimal selection method for the window size when filtering the impact force data is:
[0014] S41. Assume a time series T = {t1, t2, t3...t k}, use a window of size w for average sliding, and the result can be obtained by the following formula; where i = {1,2,3,...,k-w+1};
[0015]
[0016] S42, the values obtained by sliding average form a new time series, denoted as Y = {y1, y2, y3..., y k-w+1}, calculate the mean value E(Y) of Y, based on each suitable window w i The sliding average result is recorded as Y j , the mean is denoted as E(Y j ), define the dist function:
[0017] dist j =Σ(Y j -E(Y j )) (2)
[0018] S43, draw a curve graph with the time window size as the horizontal axis and the dist result as the vertical axis; wherein the first local minimum point is selected as the optimal window size;
[0019] S5, data length normalization: based on filtering and sliding window processing, the processed data is further normalized to ensure the consistency of data under different experimental conditions;
[0020] In order to achieve equal length processing of time series data, a weight-based time processing method, namely the WRP method, is adopted; WRP can solve problems such as data mutation points. This method can also compress long time series without changing the trend of short time series. The following will explain the WRP length normalization algorithm in detail, including:
[0021] S51. First, define a weight function:
[0022]
[0023] S52, let the sequence length be t i , the time series S i (n) compressed to S' i (m), where n = 1, 2, ... t i , m = 1, 2...m, for the 2nd to t i -1 data point, and perform the following processing: divide n into m parts, take the corresponding S i (n) S' i (m) and S'i (m) The two copies of data before and after, a total of three copies of data;
[0024] S53, the compressed time series length S' i (m) The three copies of data are set as Q i (m), then the maximum value Q among the three data is i (m) max and minimum Q i (m) min It is expressed as follows:
[0025]
[0026] S54. Define the row vector R i (m) where the value is Q i (m) min To Q i (m) max All integers between i Every value in (m) satisfy:
[0027]
[0028] S55, R i (m) is scaled proportionally to the x-axis of the weight function, that is, r1 = -3, r t =3, and we get R' i (m);
[0029]
[0030] S56. Take row vector R i Every two data in (m) The median value is Arrange horizontally to get S i (m);
[0031]
[0032] S57, will Substituting into the weight function we get
[0033]
[0034] S58, perform normalization processing to obtain a weight matrix M i (m):
[0035]
[0036] S59, S i (n) Press R i(m) is segmented to obtain K i (m), time series after WRP processing;
[0037] S' i (m) = K i (m)×M i (m) (11)
[0038] S6, S' i (m) is the impact force sequence after WRP treatment.
[0039] Preferably, in S5, the WRP data length normalization process includes the steps of defining a weight function, compressing a time series, calculating a maximum value and a minimum value, scaling proportionally, taking a median value, substituting into a weight function, normalization, and segmentation.
[0040] Compared with the prior art, the present invention has the following beneficial effects:
[0041] The present invention combines sliding window filtering with the WRP time series length normalization algorithm to process data. After the data is normalized, its overall change trend does not change significantly and still maintains the characteristics of the original data. At the same time, the sliding window algorithm can eliminate potential noise or irregular fluctuations, thereby more accurately analyzing the trend and characteristics of the data. The WRP time series length normalization algorithm can achieve equal-length data processing, solve data mutation points, and compress long time series without changing the change trend of short time series, providing a more consistent and stable input basis for subsequent model building. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A method flow chart of the technical solution of the present invention;
[0043] Figure 2 A schematic diagram of an optimal solution for the dynamic window size value of the present invention;
[0044] Figure 3 It is a filtering effect waveform diagram of the present invention under different sliding window sizes;
[0045] Figure 4 It is a time series length compression processing principle diagram of the present invention;
[0046] Figure 5 The following are the effect diagrams of a group of data of the present invention after being processed by the sliding window algorithm and the WRP algorithm respectively. DETAILED DESCRIPTION
[0047] The following embodiments of the present invention are described in further detail in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0048] like Figure 1 As shown:
[0049] Embodiment: The present invention provides a length normalization method based on time series, comprising the following steps:
[0050] S1. Obtain the experimental sample data set; use the total mass of the solution as the classification standard and divide it into 12 categories according to actual needs;
[0051] S2. The classification labels of the dataset are divided into the following categories based on the total mass of each water flow: total mass less than 50g is one category, total mass greater than 150g is another category; within the range of 50g to 150g, every 10g is a category, for a total of 12 categories;
[0052] The overall data classification and classification quantity are detailed in Table 1:
[0053]
[0054] S3. In order to process the collected impact force data more finely, a sliding window filtering technique was used; this technique helps smooth the impact force data, eliminate potential noise or irregular fluctuations, and more accurately analyze the trend and characteristics of the data; by implementing a sliding window on the time series, the obtained impact force data is ensured to be smooth and coherent, laying a solid foundation for further analysis and the accuracy of the experimental results;
[0055] S4. Take these 1971 rows of impact force data of different lengths as input. The optimal selection method of window size when filtering the data is as follows:
[0056] S41: Assume a time series T = {t1, t2, t3...t k}, use a window of size w for average sliding, and the result can be obtained by the following formula; where i = {1,2,3,...,k-w+1};
[0057]
[0058] S42: The values obtained by sliding average form a new time series, denoted as Y = {y1, y2, y3..., y k-w+1}, calculate the mean value E(Y) of Y, based on each suitable window w i The sliding average result is recorded as Y j , the mean is denoted as E(Y j ), define the dist function:
[0059] dist j =Σ(Y j -E(Y j)) (2)
[0060] S43: The curve graph with the time window size as the horizontal axis and the dist result as the vertical axis is as follows Figure 2 As shown; the red dots in the figure represent local minimum points, among which the first local minimum point, that is, when the sliding window is 50, is selected as the optimal window size;
[0061] A set of impact force data was randomly selected and processed using the local minimum time window size for sliding window processing; the processed data results are presented in Figure 3 In the figure, the horizontal axis represents the sampling time of the impact force, where the sliding window step size of 0 represents the original data, and the other curves represent the filtering effect waveforms under different sliding window sizes;
[0062] S5, data length normalization: based on filtering and sliding window processing, the processed data is further normalized to ensure the consistency of data under different experimental conditions;
[0063] In order to achieve equal length processing of time series data, a weight-based time processing method, namely the WRP method, is adopted; WRP can solve problems such as data mutation points. This method can also compress long time series without changing the trend of short time series. The following will explain the WRP length normalization algorithm in detail, including:
[0064] S51: First define a weight function:
[0065]
[0066] S52: Let the sequence length be t i , the time series S i (n) compressed to S' i (m), where n = 1, 2, ... t i , m = 1, 2...m, for the 2nd to t i -1 data point, and perform the following processing: divide n into m parts, take the corresponding S i (n) S' i (m) and S' i (m) The two copies of data before and after, a total of three copies of data;
[0067] Combination Figure 4 As shown, Figure 4 This is a schematic diagram of the time series length compression processing principle;
[0068] S53: Compress the time series length S' i (m) The three copies of data are set as Q i (m), then the maximum value Q among the three data is i(m) max and minimum Q i (m) min It is expressed as follows:
[0069]
[0070] S54: Define the row vector R i (m) where the value is Q i (m) min To Q i (m) max All integers between i Every value in (m) satisfy:
[0071]
[0072] S55: R i (m) is scaled proportionally to the x-axis of the weight function, that is, r1 = -3, r t =3, and we get R' i (m):
[0073]
[0074] S56: Take row vector R i Every two data in (m) The median value is Arrange horizontally to get S i (m);
[0075]
[0076] S57: Substituting into the weight function we get
[0077]
[0078] S58: Perform normalization processing to obtain a weight matrix M i (m);
[0079]
[0080] S59: S i (n) Press R i (m) is segmented to obtain K i (m), time series after WRP processing;
[0081] S' i (m) = K i (m)×M i (m) (11)
[0082] S6: S' i (m) is the impact force sequence after WRP treatment;
[0083] The original data is processed by sliding window, and the processed data is stretched and compressed using the WRP method, and all are processed into equal-length data of 2048 in length; a group of data is randomly selected, the original data length is 4800, the original data is processed by sliding window filtering, and then the WRP algorithm is used for calculation, and finally the data of 4800 in length is converted into data of 2048 in length. The processed data is as follows Figure 5 shown.
[0084] As can be seen from the above, the present invention combines sliding window filtering with the WRP time series length normalization algorithm to process data. The sliding window algorithm can eliminate potential noise or irregular fluctuations, and thus more accurately analyze the trend and characteristics of the data. The WRP time series length normalization algorithm can achieve equal length processing of data, solve data mutation points, and compress long time series without changing the change trend of short time series.
[0085] The embodiments of the present invention are provided for the purpose of illustration and description. Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations of the present invention. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present invention.
Claims
1. A length normalization method based on time series, characterized by: The following steps are involved: S1. First, obtain data samples collected by the experimental platform. The data samples are collected through the experimental platform respectively under the conditions of different speeds and times of the pump, the time series of the impact force of the water flow impacting the inclined surface of the pipe and the total mass of the outflowing solution, and establish a relationship model between the impact force and the total mass of the outflowing solution according to the time series of the impact force; S2, then divide the data samples into different categories according to the total mass of the solution flowing out each time, taking it as the classification grade standard, and record it in a table form; S3, then in order to eliminate the noise or irregular fluctuations in the impact force time series, the collected impact force time series is preprocessed using a sliding window filtering technique; S4, then by drawing a curve graph of the window size and the dist result, the first local minimum point is selected as the optimal size of the sliding window; the description of step S4 is as follows: S41. First, assume that an impact force time series is T and use a window of size w for uniform sliding; S42, then the values obtained by uniform sliding form a new time series based on each appropriate window w i The result of uniform sliding is recorded as Y j , the mean is denoted as E(Y j ), define the dist function; S43, finally, draw a curve graph with the time window size as the horizontal axis and the dist result as the vertical axis; The first local minimum point is selected as the optimal window size; S5, then based on filtering and sliding window processing, the WRP method is used to normalize the length of the data; the operation of using the WRP method to normalize the length of the data is as follows: S51. First, define a weight function: S52, let the sequence length be t i , the time series S i (n)Compressed to S' i (m), where n = 1, 2, ... t i , m = 1, 2...m, for the 2nd to t i -1 data point, and perform the following processing: divide n into m parts, take the corresponding S i S′ under (n) i (m) and S′ i (m) The two copies of data before and after, a total of three copies of data; Step 53: Compress the length of the time series S′ i (m) The three copies of data are set as Q i (m), then the maximum value Q among the three data is i (m) max and minimum Q i (m) min It is expressed as follows: S54. Define the row vector R i (m), where the value of each element is Q i (m) min To Q i (m) max An integer between i Every value in (m) satisfy: S55, R i (m) is scaled proportionally to the x-axis of the weight function, that is, r1 = -3, r t =3, we get R′ i (m): S56. Take row vector R i Every two data in (m) The median value is Arrange horizontally to get S i (m): S57, will Substituting into the weight function we get S58, perform normalization processing to obtain a weight matrix M i (m): S59, S i (n) Press R i (m) is segmented to obtain K i (m), time series after WRP processing: S′ i (m)=K i (m)×M i (m) (11) S60, S′ i (m) is the length-normalized time series after WRP processing; S6. Finally, the length-normalized time series after WRP processing is obtained as the final output.
2. A time series-based length normalization method as claimed in claim 1, characterized in that: The specific description of step S4 is as follows: S41. First, assume a time series T = {t1, t2, t3...t k }, use a window of size w to slide evenly, and the result can be obtained by the following formula; where i = {1,2,3,...,k-w+1} S42, then the values obtained by uniform sliding form a new time series, recorded as Y = y1, y2, y3..., y k-w+1 }, calculate the mean value E(Y) of Y, based on each suitable window w i The uniform sliding result is recorded as Y j , the mean is denoted as E(Y j ), define the dist function: dist j =∑(And j -HEY j )) (2) S43, finally, draw a curve graph with the time window size as the horizontal axis and the dist result as the vertical axis; The first local minimum point is selected as the optimal window size.
