Time sequence data compression method and device, computer equipment, computer readable storage medium and computer program product
Predicting the future values of time series data and performing differential coding through neural networks or support vector machines solves the problems of low efficiency and insufficient accuracy of time series data compression in the existing technology, achieving efficient and lossless time series data compression and restoration, and is suitable for Highly dynamic scenes.
Patent Information
- Application Number
- CN202410752574.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-10-01
AI Technical Summary
Existing data compression methods have low compression efficiency and insufficient accuracy in processing highly dynamic time series data, making it difficult to meet the needs of real-time monitoring and remote operating systems.
Use neural networks or support vector machines to predict future values of time series data, calculate deviation values and differential sequences, use oscillation coding or variable length coding to encode data, and store prediction models and deviation values to achieve efficient compression.
It improves the compression efficiency and accuracy of time series data, ensures lossless restoration of data, is suitable for high-dynamic time series data compression scenarios with high real-time performance, and balances compression efficiency and data integrity.
Smart Images

Figure CN118740165A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of time series data compression, and in particular to a time series data compression method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] Time series data is a data set generated in a certain time sequence. It is common in sensor networks, financial markets, industrial production, energy, metallurgy, communications and other fields. It usually has the characteristics of high frequency, large scale, continuous growth, periodicity and seasonal changes. With the acceleration of time series data generation and the increase in storage costs, efficient storage and transmission of time series data has become crucial. Furthermore, efficient and accurate time series data compression technology is the key to ensure the effective operation of real-time monitoring systems and remote operating systems.
[0003] When traditional data compression methods such as compressed sensing and entropy coding are applied to highly dynamic time series data compression, although compressed sensing can effectively reduce the amount of data storage, it usually requires complex recovery algorithms and high computational costs; entropy coding relies on the probability model of the data, and its compression efficiency and accuracy are usually insufficient for time series data with complex patterns and high noise.
[0004] With respect to the above-mentioned related technologies, the inventors have found that the existing data compression methods have the problems of low compression efficiency and low accuracy, and are not suitable for high-dynamic time series data compression. Summary of the invention
[0005] In order to improve the compression efficiency of time series data, reduce data restoration loss, and improve the real-time performance of time series data compression, the present application provides a time series data compression method, apparatus, computer equipment, computer-readable storage medium, and computer program product.
[0006] In a first aspect, the present application provides a time series data compression method.
[0007] This application is achieved through the following technical solutions:
[0008] A time series data compression method comprises the following steps:
[0009] Obtain initial time series data and build a time series data set;
[0010] For each moment, a preset neural network or support vector machine is used to predict the predicted value of a future time point corresponding to the current moment for any element in the time series data set;
[0011] Calculate the deviation between the actual value of the time series data at any moment corresponding to the predicted value and the predicted value, and construct a deviation sequence;
[0012] Based on the deviation sequence, the difference between adjacent elements is calculated to construct a difference sequence;
[0013] Determining the properties of the difference sequence;
[0014] When the difference sequence is of a continuously increasing or continuously decreasing attribute, the difference sequence is encoded using an oscillation encoding method to obtain a compressed data set;
[0015] The compressed data set and the corresponding model parameters of the neural network or the support vector machine are stored to obtain target compressed data.
[0016] In a preferred example, the present application can be further configured as follows: the step of using a preset neural network or support vector machine to predict the predicted value of a future time point corresponding to the current moment for any element in the time series data set at each moment includes:
[0017] Determining the time series data type of the time series data set;
[0018] When the time series data type is financial market data, the training steps of the neural network adopted include:
[0019] The number of network layers of the LSTM model was adjusted to 4, the number of neurons in each network layer was 100, the learning rate of the model was 0.0001, and the activation function ReLU was used;
[0020] Input the stock price and trading volume containing the time series at the current moment into the LSTM model for learning, and predict and output the change in the stock price at a future time point corresponding to the current moment;
[0021] The prediction accuracy of the LSTM model is counted until the prediction accuracy of the LSTM model meets a preset condition, thereby obtaining a prediction model for predicting the change amount of any financial market data element in the time series data set.
[0022] In a preferred example, the present application may be further configured as follows: after the step of determining the time series data type of the time series data set, the step further includes:
[0023] When the time series data type is medical monitoring data, the training steps of the neural network adopted include:
[0024] The number of network layers of the GRU model was adjusted to 3, the number of neurons in each network layer was 80, the learning rate of the model was 0.0005, and the activation function tanh was used;
[0025] Inputting the physiological parameters including the time series at the current moment into the GRU model for learning, and predicting and outputting the change amount of the physiological parameters at the future time point corresponding to the current moment;
[0026] The prediction accuracy of the GRU model is counted until the prediction accuracy of the GRU model meets a preset condition, thereby obtaining a prediction model for predicting the change amount of any medical monitoring data element in the time series data set.
[0027] In a preferred example, the present application may be further configured as follows: after the step of determining the time series data type of the time series data set, the step further includes:
[0028] When the time series data type is industrial sensor data, the training steps of the support vector machine adopted include:
[0029] The radial basis function kernel was used as the kernel function of the SVM model, and the regularization parameter of the model was adjusted to 10 and the parameter used to control the amplitude of the kernel function was 0.01;
[0030] Inputting the sensor parameters including the time series at the current moment into the SVM model for learning, and predicting and outputting the change amount of the sensor parameters at a future time point corresponding to the current moment;
[0031] The prediction accuracy of the SVM model is counted until the prediction accuracy of the SVM model meets a preset condition, thereby obtaining a prediction model for predicting the change amount of any industrial sensor data element in the time series data set.
[0032] In a preferred example, the present application may be further configured as follows: after the step of determining the attribute of the differential sequence, it further includes:
[0033] When the differential sequence has a large frequency difference attribute, the differential sequence is encoded using a variable length encoding method to obtain the compressed data set.
[0034] In a preferred example, the present application can be further configured as follows: it also includes the following steps:
[0035] Performing time series data recovery based on the target compressed data includes:
[0036] Extracting model parameters of the neural network or the support vector machine, and calculating a reference value at the current moment;
[0037] The deviation value of the deviation sequence corresponding to the current moment is obtained, and combined with the reference value, the initial time series data is restored.
[0038] In a second aspect, the present application provides a time series data compression device.
[0039] This application is achieved through the following technical solutions:
[0040] A time series data compression device, comprising:
[0041] The initial data module is used to obtain the initial time series data and build a time series data set;
[0042] A prediction module, used to predict, for each moment, a predicted value of a future time point corresponding to the current moment for any element in the time series data set using a preset neural network or support vector machine;
[0043] A deviation module, used to calculate the deviation between the actual value of the time series data at any moment corresponding to the predicted value and the predicted value, and construct a deviation sequence;
[0044] A difference module, used for calculating the difference between adjacent elements based on the deviation sequence to construct a difference sequence;
[0045] An attribute judgment module, used for judging the attribute of the differential sequence;
[0046] An oscillation encoding module, used for encoding the difference sequence in an oscillation encoding manner to obtain a compressed data set when the difference sequence has a continuously increasing or continuously decreasing attribute;
[0047] The compression module is used to store the compressed data set and the corresponding model parameters of the neural network or the support vector machine to obtain target compressed data.
[0048] In a third aspect, the present application provides a computer device.
[0049] This application is achieved through the following technical solutions:
[0050] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above-mentioned time series data compression methods when executing the computer program.
[0051] In a fourth aspect, the present application provides a computer-readable storage medium.
[0052] This application is achieved through the following technical solutions:
[0053] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any one of the above-mentioned time series data compression methods are implemented.
[0054] In a fifth aspect, the present application provides a computer program product.
[0055] This application is achieved through the following technical solutions:
[0056] A computer program product comprises a computer program, wherein when the computer program is executed by a processor, the steps of any one of the above-mentioned time series data compression methods are implemented.
[0057] In summary, compared with the prior art, the technical solution provided by this application has at least the following beneficial effects:
[0058] Using the time series data to be compressed, a time series data set is constructed. For each moment, a preset neural network or support vector machine is used to predict the predicted value of any element in the time series data set at a future time point corresponding to the current moment, which can achieve more accurate time series data prediction and adapt to a wider range of time series data characteristics; the deviation between the actual value of the time series data at any moment corresponding to the predicted value and the predicted value is calculated, and the periodic change characteristics of the time series data are used to construct a deviation sequence to reduce storage requirements and improve the storage efficiency of the time series data; based on the deviation sequence, the difference between adjacent elements is calculated, a differential sequence is constructed, and the differential sequence is encoded to obtain a compressed data set, which can more keenly capture time. The trend changes of time series data can, to a certain extent, achieve noise reduction for time series data, which helps to restore time series data more accurately and, at the same time, perform efficient time series data storage and transmission. Finally, the compressed data set and the corresponding neural network or support vector machine model parameters are stored to obtain the target compressed data, which can ensure the consistency of the model used when decompressing the time series data and losslessly restore the time series data, thereby improving the accuracy of lossless restoration of the time series data. This can in turn improve the compression efficiency and accuracy of the time series data, and is suitable for high-dynamic time series data compression scenarios that require real-time performance. It can better balance the contradictory relationship between the compression efficiency and data integrity of the time series data, and achieve fast lossless compression of the time series data. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 A schematic diagram of the main flow of a time series data compression method provided for an exemplary embodiment of the present application.
[0060] Figure 2 A structural block diagram of a time series data compression device provided for yet another exemplary embodiment of the present application. DETAILED DESCRIPTION
[0061] This specific embodiment is merely an explanation of the present application and is not a limitation of the present application. After reading this specification, those skilled in the art may make modifications to the present embodiment without any creative contribution as needed, but such modifications are protected by the patent law as long as they are within the scope of the claims of the present application.
[0062] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0063] In addition, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article, unless otherwise specified, generally means that the associated objects before and after are in an "or" relationship.
[0064] Traditional data compression strategies include:
[0065] 1. Simple compression: Only basic compression algorithms are used, such as RLE (Run-Length Encoding) or standard data compression technologies (such as ZIP). These technologies do not take advantage of the time series characteristics of time series data, resulting in low compression efficiency in highly dynamic or complex time series data.
[0066] 2. Traditional differential encoding: When data changes frequently or the trend is not obvious, it leads to large data storage requirements, because the data storage at each time point depends on the changes at the previous point;
[0067] 3. Discrete cosine transform (DCT) or Fourier transform: These transforms are often used for data compression in signal processing. They reduce data redundancy by transforming to the frequency domain. When processing non-periodic or short-term data, data loss is large and compression accuracy is low.
[0068] The present application combines the advantages of numerical prediction technology and differential coding technology, and aims to improve the limitations of traditional data compression methods in time series data processing. In the data compression stage, a prediction model is selected to perform numerical prediction on the change amount of time series data with high prediction accuracy. Then, based on the differential coding technology, a differential algorithm is used to calculate the deviation between the actual value and the predicted value, and the deviation and the parameters of the prediction model are stored. The compressed time series data only needs to store the parameters and deviation values of the prediction model, which reduces the storage requirements and makes better use of the regular characteristics of the time series data. The accuracy of the prediction can significantly improve the compression ratio. The prediction and differential calculation processes can be executed quickly, which improves the compression efficiency of the time series data. At the same time, the time series data can be accurately restored, the original data can be restored losslessly, and the integrity and accuracy of the time series data can be ensured. In the data restoration stage, the baseline value of the current time point is obtained based on the parameters of the stored prediction model. Then, the stored deviation value is used to add the baseline value to the deviation value to obtain the restored original time series data value. The compression of time series data that requires real-time and high-precision recovery has broad application prospects, can adapt to various types of time series data, and realize efficient and lossless compression of time series data.
[0069] The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.
[0070] Reference Figure 1 , an embodiment of the present application provides a time series data compression method, and the main steps of the method are described as follows.
[0071] S1: Obtain initial time series data and build a time series data set;
[0072] S2: For each moment, a preset neural network or support vector machine is used to predict the predicted value of any element in the time series data set at a future time point corresponding to the current moment;
[0073] S3: Calculate the deviation between the actual value of the time series data at any moment corresponding to the predicted value and the predicted value, and construct a deviation sequence;
[0074] S4: Based on the deviation sequence, calculate the difference between adjacent elements and construct a difference sequence;
[0075] S5: Determine the attribute of the differential sequence;
[0076] S6: When the difference sequence has a continuously increasing or continuously decreasing attribute, the difference sequence is encoded using an oscillation encoding method to obtain a compressed data set;
[0077] S8: Store the compressed data set and the corresponding model parameters of the neural network or the support vector machine to obtain target compressed data.
[0078] Specifically, the initial time series data is a sequence of data arranged in chronological order, and there is a time correlation between adjacent data points, that is, the value of a data point depends on the value of the previous / next data point or multiple previous / next data points, such as time series data in the fields of energy, metallurgy, and communications. Time series data will show a certain trend of change over time, such as rising or falling. Many time series data show periodic changes, that is, the data presents a repetitive pattern within a certain time period, with a certain time period, such as every second or every millisecond. This application is for time series data with a certain time period. Alternatively, some time series data will show a high degree of volatility, that is, the changes between data points are large and rapid, such as operating status data of rotating equipment or financial data.
[0079] The types of time series data in this application include financial market time series data, medical monitoring time series data, industrial sensor time series data, etc. The time series data format can be: {"timestamp":"2024-05-24T12:00:00Z","value":42.5}.
[0080] Because traditional data compression methods are difficult to fully utilize the regularity and trend characteristics of time series data, there is a large time overhead during decompression, which affects the real-time nature of time series data and has some limitations in the processing of time series data. Therefore, this application uses neural networks or support vector machines for learning and training based on the nonlinearity and seasonal changes of historical time series data. For example, a feedforward neural network or time series prediction model is used to predict future time series data points to obtain predicted values of future time points of the time series data. This can predict in advance the possible loss of accuracy of the time series data during the recovery phase in scenarios with large data fluctuations, thereby making the differential results more compact and information-rich, improving the accuracy of time series data recovery, and being able to adaptively learn complex patterns of time series data and adapt to different types of time series data. It has a wider range of applicable scenarios and is conducive to ensuring lossless restoration of time series data.
[0081] Among them, in order to process the time dependency in the time series data, the preset neural network can use a recurrent neural network (RNN), or its variants such as a long short-term memory network (LSTM), or a gated recurrent unit (GRU) to predict the future value of the time series data. Based on the characteristics of the time series data, the number of layers, number of neurons, activation function, etc. of the neural network are adjusted. For example, for high-frequency time series data, more hidden layers are set to capture the complex patterns of the time series data.
[0082] For static or small amounts of time series data, support vector machines (SVMs) can be used to predict future values. By selecting a suitable kernel function and adjusting the regularization parameters to optimize the model, overfitting can be prevented, making SVM perform well in dealing with nonlinear time series problems, especially when using appropriate kernel functions.
[0083] During training, a loss function, such as mean square error (MSE), is designed to train the neural network or support vector machine model on historical time series data, and the loss of the loss function is minimized using a back propagation algorithm.
[0084] To improve training efficiency, training data is usually divided into multiple batches to use gradient descent or variants of the Adam optimizer for model efficiency training. In this embodiment, the batch size of the model can be adjusted from 32 to 64 to improve training efficiency. The number of iterations of the model can be adjusted from 50 to 100 to ensure that the model is fully trained.
[0085] Based on the newly received historical time series data, an incremental learning method is used or the entire model is retrained to regularly update the model to adapt to the long-term changes in the time series data and maintain the model's predictive accuracy.
[0086] In real-time systems, models can be designed to quickly adapt to new trend patterns to accommodate situations where the nature of the time series data changes significantly.
[0087] In one embodiment, the step of using a preset neural network or support vector machine to predict the predicted value of a future time point corresponding to the current moment for any element in the time series data set at each moment includes:
[0088] Determining the time series data type of the time series data set;
[0089] When the time series data type is financial market data, the training steps of the neural network adopted include:
[0090] The number of network layers of the LSTM model was adjusted to 4, the number of neurons in each network layer was 100, the learning rate of the model was 0.0001, and the activation function ReLU was used;
[0091] Input the stock price and trading volume containing the time series at the current moment into the LSTM model for learning, and predict and output the change in the stock price at a future time point corresponding to the current moment;
[0092] The prediction accuracy of the LSTM model is counted until the prediction accuracy of the LSTM model meets a preset condition, thereby obtaining a prediction model for predicting the change amount of any financial market data element in the time series data set.
[0093] The expression of the activation function ReLU (Rectified Linear Unit) is as follows:
[0094] ReLU(x)=max(0,x)
[0095] The number of network layers of the LSTM model is adjusted from 2 to 4, which can improve the expressiveness of the model and enable it to capture more complex time series data features; the number of neurons is increased from 50 to 100, which can enhance the fitting ability of the model and process more complex time series data; the use of the activation function ReLU can improve the nonlinear expression ability of the model, and has stronger predictive capabilities for financial market time series data, and can accurately capture the characteristics of time series data, which is conducive to the realization of efficient and lossless compression and restoration of time series data.
[0096] In one embodiment, after the step of determining the time series data type of the time series data set, the method further includes:
[0097] When the time series data type is medical monitoring data, the training steps of the neural network adopted include:
[0098] The number of network layers of the GRU model was adjusted to 3, the number of neurons in each network layer was 80, the learning rate of the model was 0.0005, and the activation function tanh was used;
[0099] Inputting the physiological parameters including the time series at the current moment into the GRU model for learning, and predicting and outputting the change amount of the physiological parameters at the future time point corresponding to the current moment;
[0100] The prediction accuracy of the GRU model is counted until the prediction accuracy of the GRU model meets a preset condition, thereby obtaining a prediction model for predicting the change amount of any medical monitoring data element in the time series data set.
[0101] The expression of the activation function tanh includes,
[0102] tanh(x)=(exp(x)-exp(-x)) / (exp(x)+exp(-x))
[0103] The number of network layers of the gated recurrent unit (GRU) is adjusted from 2 to 3, which can improve the expressiveness of the model while ensuring the modeling cost and computing cost, enabling it to capture more complex medical monitoring data features; the number of neurons is increased from 50 to 80, which can enhance the fitting ability of the model; the use of the activation function tanh makes the model more predictive of medical monitoring time series data, and can accurately capture the characteristics of time series data, which is conducive to the efficient and lossless compression and restoration of time series data.
[0104] In one embodiment, after the step of determining the time series data type of the time series data set, the method further includes:
[0105] When the time series data type is industrial sensor data, the training steps of the support vector machine adopted include:
[0106] The radial basis function kernel was used as the kernel function of the SVM model, and the regularization parameter of the model was adjusted to 10 and the parameter used to control the amplitude of the kernel function was 0.01;
[0107] Inputting the sensor parameters including the time series at the current moment into the SVM model for learning, and predicting and outputting the change amount of the sensor parameters at a future time point corresponding to the current moment;
[0108] The prediction accuracy of the SVM model is counted until the prediction accuracy of the SVM model meets a preset condition, thereby obtaining a prediction model for predicting the change amount of any industrial sensor data element in the time series data set.
[0109] The expression of the radial basis function K(x,y) kernel is as follows:
[0110] K(x,y)=exp(-γ||xy||2)
[0111] The SVM model uses the radial basis function (RBF) kernel, which is suitable for most industrial sensor time series data and can capture the nonlinear characteristics of industrial sensor data. The parameter γ, i.e., the learning rate, used to control the amplitude of the kernel function is adjusted from 0.1 to 0.01, which can refine the decision boundary and assist in more stable convergence during model training, thereby improving prediction accuracy. The regularization parameter C determines the degree of penalty for the error term, and the adjustment range can be increased from 1 to 10. The C of the SVM model is adjusted to 10, which can maximize the generalization ability of the model, achieve higher prediction accuracy, and ensure the optimal compression and lossless restoration of industrial sensor data.
[0112] The present application can also select appropriate numerical prediction technology according to the characteristics of time series data.
[0113] For example, for time series data with obvious linear relationships, linear regression numerical prediction technology can be used to fit historical data points to a straight line to predict data at future time points.
[0114] For example, for time series data with nonlinear relationships, a nonlinear regression model can be used to capture the nonlinear change patterns of the time series data.
[0115] For example, for time series data that considers the intrinsic structure of the time series, time series analysis methods such as ARIMA (Autoregressive Integrated Moving Average) are used for numerical prediction.
[0116] To ensure the stability and lossless restoration capability of time series data, after training the prediction model, the parameters of the prediction model should be fixed, such as learning rate, batch size, number of iterations, number of neural network layers and number of neurons in each layer, or regularization parameters, kernel function parameters, etc., for model initialization settings, and remain unchanged throughout the model training and application process. This helps maintain the consistency of the model, avoid inconsistency problems in time series data restoration caused by parameter changes, and make the model more fit and generalize.
[0117] For each time instant (t), the trained prediction model is used to obtain the predicted value yt^.
[0118] After the prediction is completed, the deviation value Pt between each actual data point yt and its corresponding predicted value yt^ is calculated, that is, Pt = yt-yt^, and the deviation values are aggregated to form a deviation sequence.
[0119] In most cases, the length of the time series data change value is smaller than the absolute value length of the time series data, and even a considerable portion of the time series data does not change. At this time, when the time series data has no deviation value, the deviation data is not recorded and the data does not need to be stored, thereby further reducing the storage space of the time series data.
[0120] Numerical prediction technology builds a model to predict time series data at future moments, and then uses the difference between actual data and predicted results as the basis for compression. It can better capture the trends and periodicity in time series data, thereby improving the compression quality of time series data.
[0121] Then, based on the deviation sequence, the difference between adjacent elements is calculated to construct a difference sequence to further optimize the storage space.
[0122] Specifically, because time series data usually exhibits characteristics such as time correlation, periodicity, trend changes and volatility, differential coding technology is adopted. Its basic idea is to record the differences between adjacent time series data and represent the changing trend of time series data with a smaller storage space. It can effectively reduce redundant information, reduce data redundancy, improve the compression quality and compression efficiency of time series data, realize high-speed lossless compression of time series data, and simplify the time series data recovery process.
[0123] In many practical applications, the continuous values of time series data often do not change much, especially when the data collection frequency is high. By calculating the differences between the data at adjacent time points, the time series data can be converted into a differential sequence. Since the difference is often much smaller than the original data, or even zero in a stable state, data storage redundancy can be significantly reduced. Even when continuous time series data points do not change, the data can be chosen not to be stored, thereby greatly reducing the amount of data storage.
[0124] For the time series data set {x1, x2, ..., xn}, the data of adjacent time points are subtracted and the difference is used to construct the difference sequence {d1, d2, ..., di, ..., dn-1}, where di = x i+1 -x i , can effectively capture the changing trend of data, accurately reflect the trend and change of time series data, make the differential sequence more stable, intuitively show the data difference between adjacent time points, have a smaller storage space than the original time series data, reduce the storage redundancy of time series data, reduce storage costs, and is suitable for efficient lossless compression of time series data. For example, the time series data set {10,15,12,18,20}, the corresponding differential sequence is {5,-3,6,2}, each value in the differential sequence represents the difference between data points at adjacent times.
[0125] For monitoring application scenarios that are sensitive to storage space and require fast data transmission, the differential sequence constructed in this application utilizes the correlation between time series data points and optimizes storage by eliminating redundant information in the time series, ensuring that the time series data compression process will not lose important information due to excessive data simplification, and retains sufficient information to ensure that the time series data has integrity and accuracy when decompressed; at the same time, the stored time series data has a lower variance and a tighter data distribution, and its smaller numerical range enables the differential coding compression algorithm to use a shorter code to encode the time series data, thereby making differential coding compression more effective and improving the compression rate of the time series data; in time series data compression scenarios that require real-time processing, calculating the differential sequence is simple and fast, which facilitates rapid response and data updates. In addition, after compression using the differential sequence encoding collected by the present application, during the decompression or recovery process of the compressed data, starting from any given point, it is only necessary to add the values of the differential sequence back to the initial or known data points one by one to restore the entire time series data sequence. The data recovery process is simple and direct, supports real-time data processing, and can quickly respond to data updates and requests without sacrificing compression efficiency. It is very suitable for application scenarios that require instant time series data processing and efficient storage.
[0126] After generating the differential data sequence, in order to make more efficient use of the storage space, a suitable encoding method is used to represent it. This can minimize the storage overhead of the time series data while maintaining the integrity of the time series data, further reducing the storage overhead.
[0127] Specifically, when the differential sequence has the attribute of continuous increasing or continuous decreasing, the natural oscillation or periodic fluctuation attribute of the time series data is identified and utilized, and the differential sequence with periodicity is encoded by oscillation coding, and only the key information of the start and end of the period is recorded to obtain a compressed data set. The differential sequence composed of a series of increasing or decreasing values can be represented by oscillation coding in the form of base value and increment number, rather than each data point, to more compactly represent the time series data, effectively reduce the amount of information that needs to be stored, optimize data storage space, and significantly improve the compression rate of time series data by using the repetitive pattern of data, while maintaining sufficient information to ensure the integrity and accurate recovery of the time series data, and maintain the balance between the integrity of the time series data and the compression efficiency. For example, for the differential sequence {5,6,7,8}, it can be represented as {5,8,1} through oscillation coding, that is, in the form of base value and increment.
[0128] Reference Figure 1 In one embodiment, S7: when the differential sequence has a large frequency difference attribute, the differential sequence is encoded using a variable length coding method to obtain a compressed data set.
[0129] Specifically, according to the frequency and amplitude of the differential data, time series data with high volatility are identified. When the differential sequence has a large frequency difference attribute, that is, the frequency distribution of the occurrence of values is dispersed, such as in the highly volatile equipment vibration time series data, the differential sequence is encoded using a variable length coding method. Shorter codes are assigned to common time series data (high frequency of occurrence), and longer codes are assigned to uncommon time series data (low frequency of occurrence), so as to obtain a compressed data set, thereby optimizing the code length and achieving different length encodings for values with different occurrence frequencies. It can dynamically adapt to the statistical characteristics of the time series data and match the code length with the variability of the data itself, so that the compression strategy can effectively respond to changes in the statistical characteristics of the time series data, thereby optimizing the overall storage requirements of the time series data, with higher flexibility and improved coding efficiency.
[0130] The parameters of the differential sequence and prediction model are encoded and compressed for storage to further compress the deviation value, improve data storage efficiency, minimize the storage requirements of time series data, facilitate data transmission and reconstruction, and efficiently store and losslessly compress time series data.
[0131] Through numerical prediction technology and differential coding technology, efficient and lossless compression of time series data can be achieved, which also improves the transmission rate and storage efficiency of time series data and reduces the storage cost of time series data.
[0132] In one embodiment, the differential coding technique may be used in combination with other compression techniques, such as numerical prediction or dictionary coding, to achieve more comprehensive time series data compression.
[0133] In one embodiment, after constructing the differential sequence, the differential sequence can be directly stored without encoding and compressing the storage, which is more efficient.
[0134] In one embodiment, the difference sequence and the parameters of the prediction model can be directly stored without encoding compression, and the compression strategy is more flexible.
[0135] In one embodiment, the following steps are also included:
[0136] Performing time series data recovery based on the target compressed data includes:
[0137] Extracting model parameters of the neural network or the support vector machine, and calculating a reference value at the current moment;
[0138] The deviation value of the deviation sequence corresponding to the current moment is obtained, and combined with the reference value, the initial time series data is restored.
[0139] Specifically, the model parameters are extracted to restore the prediction model using the parameters of the stored prediction model; for the current time t, the baseline value yt' is calculated using the restored prediction model; then the deviation value Pt corresponding to the time t is obtained from the stored deviation sequence; finally, the baseline value yt' is added to the deviation value Pt to obtain the restored original data value yt=yt'+Pt.
[0140] When time series data needs to be restored, the stored model parameters and differential sequences are used to regenerate the original time series data, ensuring the integrity and accuracy of the time series data. This is suitable for time series data scenarios that require high-speed processing.
[0141] In summary, a time series data compression method uses the time series data to be compressed to construct a time series data set. For each moment, a preset neural network or support vector machine is used to predict the predicted value of a future time point corresponding to the current moment of any element in the time series data set, which can achieve more accurate time series data prediction and adapt to a wider range of time series data characteristics; calculate the deviation between the actual value of the time series data at any moment corresponding to the predicted value and the predicted value, and use the periodic change characteristics of the time series data to construct a deviation sequence to reduce storage requirements and improve the storage efficiency of the time series data; based on the deviation sequence, the difference between adjacent elements is calculated, a differential sequence is constructed, and the differential sequence is encoded to obtain a compressed data set, which can It can more keenly capture the trend changes of time series data, achieve noise reduction for time series data to a certain extent, help to restore time series data more accurately, and at the same time, perform efficient time series data storage and transmission; finally, store the compressed data set and the corresponding neural network or support vector machine model parameters to obtain the target compressed data, which can ensure the consistency of the model used when decompressing the time series data, losslessly restore the time series data, and improve the accuracy of lossless restoration of time series data; thereby improving the compression efficiency and accuracy of time series data, which is suitable for high-dynamic time series data compression scenarios that require real-time performance, and better balances the contradictory relationship between the compression efficiency and data integrity of time series data, and realizes fast lossless compression of time series data.
[0142] A time series data compression method significantly reduces the storage volume of time series data and improves storage efficiency by predicting future time series data and storing differences. It also selects different prediction models and can flexibly adapt to the accurate prediction of different types of time series data. It also uses differential coding technology to store prediction model parameters and deviation values to ensure the consistency of the model, which helps to more accurately reflect the overall trend of time series data. It has strong adaptability and versatility, improves the sensitivity to trend changes in time series data, and the time series data can be fully restored after decompression without information loss. The encoding method is flexible and can adapt to the distribution and change patterns of different time series data, and is suitable for various types of time series data. It supports real-time data compression and decompression to meet the needs of high-speed data processing. It has the advantages of high compression efficiency, ensuring the integrity of time series data, strong applicability, and good real-time performance. The combination of sequence representation and coding representation also helps to save storage space for time series data.
[0143] A time series data compression method is not only suitable for the compression of static data, but also has better performance for the efficient real-time compression of highly dynamic time series data. It is very suitable for application scenarios that require instant data compression and efficient storage, including but not limited to the Internet of Things, financial fields, industrial production, etc., and is of great significance for the storage and transmission of large-scale time series data.
[0144] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0145] Reference Figure 2 The embodiment of the present application also provides a time series data compression device, which corresponds one-to-one to a time series data compression method in the above embodiment. The time series data compression device includes:
[0146] The initial data module is used to obtain the initial time series data and build a time series data set;
[0147] A prediction module, used to predict, for each moment, a predicted value of a future time point corresponding to the current moment for any element in the time series data set using a preset neural network or support vector machine;
[0148] A deviation module, used to calculate the deviation between the actual value of the time series data at any moment corresponding to the predicted value and the predicted value, and construct a deviation sequence;
[0149] A difference module, used for calculating the difference between adjacent elements based on the deviation sequence to construct a difference sequence;
[0150] An attribute judgment module, used for judging the attribute of the differential sequence;
[0151] An oscillation encoding module, used for encoding the difference sequence in an oscillation encoding manner to obtain a compressed data set when the difference sequence has a continuously increasing or continuously decreasing attribute;
[0152] The compression module is used to store the compressed data set and the corresponding model parameters of the neural network or the support vector machine to obtain target compressed data.
[0153] A time series data compression device also includes:
[0154] The variable length coding module is used to encode the differential sequence by using a variable length coding method when the differential sequence has a large frequency difference attribute, so as to obtain the compressed data set.
[0155] Furthermore, the prediction module also includes,
[0156] A financial market data prediction model, used to predict the change in any financial market data element in the time series data set;
[0157] A medical monitoring data prediction model, used to predict the change amount of any medical monitoring data element in the time series data set;
[0158] The industrial sensor data prediction model is used to predict the change amount of any industrial sensor data element in the time series data set.
[0159] For the specific definition of a time series data compression device, please refer to the definition of a time series data compression method mentioned above, which will not be repeated here.
[0160] Each module in the above-mentioned time series data compression device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0161] In one embodiment, a computer device is provided, which may be a server. The computer device includes a processor, a memory, a network interface, and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, any one of the above-mentioned time series data compression methods is implemented.
[0162] In one embodiment, a computer-readable storage medium is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, any one of the above-mentioned time series data compression methods is implemented.
[0163] In one embodiment, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, any one of the above-mentioned time series data compression methods is implemented.
[0164] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. When the computer program is executed, it may include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0165] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above.
Claims
1. A time series data compression method, characterized in that: The following steps are included: Obtain initial time series data and build a time series data set; For each moment, a preset neural network or support vector machine is used to predict the predicted value of a future time point corresponding to the current moment for any element in the time series data set; Calculate the deviation between the actual value of the time series data at any moment corresponding to the predicted value and the predicted value, and construct a deviation sequence; Based on the deviation sequence, the difference between adjacent elements is calculated to construct a difference sequence; Determining the properties of the difference sequence; When the difference sequence is of a continuously increasing or continuously decreasing attribute, the difference sequence is encoded using an oscillation encoding method to obtain a compressed data set; The compressed data set and the corresponding model parameters of the neural network or the support vector machine are stored to obtain target compressed data.
2. The time series data compression method according to claim 1, characterized in that: The step of using a preset neural network or support vector machine to predict the predicted value of a future time point corresponding to the current moment for any element in the time series data set at each moment includes: Determining the time series data type of the time series data set; When the time series data type is financial market data, the training steps of the neural network adopted include: The number of network layers of the LSTM model was adjusted to 4, the number of neurons in each network layer was 100, the learning rate of the model was 0.0001, and the activation function ReLU was used; Input the stock price and trading volume containing the time series at the current moment into the LSTM model for learning, and predict and output the change in the stock price at a future time point corresponding to the current moment; The prediction accuracy of the LSTM model is counted until the prediction accuracy of the LSTM model meets a preset condition, thereby obtaining a prediction model for predicting the change amount of any financial market data element in the time series data set.
3. The time series data compression method according to claim 2, characterized in that: After the step of determining the time series data type of the time series data set, the method further includes: When the time series data type is medical monitoring data, the training steps of the neural network adopted include: The number of network layers of the GRU model was adjusted to 3, the number of neurons in each network layer was 80, the learning rate of the model was 0.0005, and the activation function tanh was used; Inputting the physiological parameters including the time series at the current moment into the GRU model for learning, and predicting and outputting the change amount of the physiological parameters at the future time point corresponding to the current moment; The prediction accuracy of the GRU model is counted until the prediction accuracy of the GRU model meets a preset condition, thereby obtaining a prediction model for predicting the change amount of any medical monitoring data element in the time series data set.
4. The time series data compression method according to claim 2, characterized in that: After the step of determining the time series data type of the time series data set, the method further includes: When the time series data type is industrial sensor data, the training steps of the support vector machine adopted include: The radial basis function kernel was used as the kernel function of the SVM model, and the regularization parameter of the model was adjusted to 10 and the parameter used to control the amplitude of the kernel function was 0.01; Inputting the sensor parameters including the time series at the current moment into the SVM model for learning, and predicting and outputting the change amount of the sensor parameters at a future time point corresponding to the current moment; The prediction accuracy of the SVM model is counted until the prediction accuracy of the SVM model meets a preset condition, thereby obtaining a prediction model for predicting the change amount of any industrial sensor data element in the time series data set.
5. The time series data compression method according to claim 1, characterized in that: After the step of determining the attribute of the differential sequence, the method further includes: When the differential sequence has a large frequency difference attribute, the differential sequence is encoded using a variable length encoding method to obtain the compressed data set.
6. The time series data compression method according to any one of claims 1 to 5, characterized in that: The following steps are also included: Performing time series data recovery based on the target compressed data includes: Extracting model parameters of the neural network or the support vector machine, and calculating a reference value at the current moment; The deviation value of the deviation sequence corresponding to the current moment is obtained, and combined with the reference value, the initial time series data is restored.
7. A time series data compression device, characterized in that: include, The initial data module is used to obtain the initial time series data and build a time series data set; A prediction module, used to predict, for each moment, a predicted value of a future time point corresponding to the current moment for any element in the time series data set using a preset neural network or support vector machine; A deviation module, used to calculate the deviation between the actual value of the time series data at any moment corresponding to the predicted value and the predicted value, and construct a deviation sequence; A difference module, used for calculating the difference between adjacent elements based on the deviation sequence to construct a difference sequence; An attribute judgment module, used for judging the attribute of the differential sequence; An oscillation encoding module, used for encoding the difference sequence in an oscillation encoding manner to obtain a compressed data set when the difference sequence has a continuously increasing or continuously decreasing attribute; The compression module is used to store the compressed data set and the corresponding model parameters of the neural network or the support vector machine to obtain target compressed data.
8. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The invention comprises a computer program, which implements the steps of the method according to any one of claims 1 to 6 when being executed by a processor.
Citation Information
Cited By
Numerical monitoring data compression method, decompression method and monitoring platform
CN118984157A
Numerical data compression and storage method and device and storage medium
CN119377228A
Data compression method and system based on hybrid compression algorithm
CN120074539A
A data compression method and system based on a hybrid compression algorithm
CN120074539B
