Data processing method and device, nonvolatile storage medium and electronic equipment

The partition of data blocks dynamically adjusts the partitioning of data blocks in the prior art, solves the problem of low data compression block efficiency, and realizes efficient data block division and compression effects, reducing waste of computing resources.

CN119829573APending Publication Date: 2025-04-15CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411783482.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The data chunking method used for data compression in the prior art cannot efficiently find the optimal data chunk division scheme, resulting in wasted computing resources.

Method used

The Q-Learning algorithm is used to obtain binary input data, determine multiple target schemes, use the upper confidence bound algorithm to determine the average return of the target action, and update the Q value table, and dynamically adjust the division of data blocks to achieve the optimal compression effect.

Benefits of technology

It effectively reduces the waste of computing resources in the data chunking process based on data compression, realizes efficient data block division and compression effects, and is suitable for large-scale time-series data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829573A_ABST
    Figure CN119829573A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method and device, a nonvolatile storage medium and electronic equipment. The method comprises the following steps: acquiring binary input data; determining a plurality of target schemes for performing data division on the input data, and endowing an initial Q value to a target action; determining the average income of the target action by using an upper confidence bound algorithm, and determining a confidence interval corresponding to the average income; updating the initial Q value by using an upper bound value of the confidence interval to obtain a target Q value table, determining a first action with the maximum Q value in the target Q value table, and dividing the input data into a plurality of data blocks according to the first action; and updating the average income of the target action by using the compression ratio, updating the target Q value table according to the updated average income, and selecting a new action from the updated target Q value table. According to the method and the device, the technical problem of waste of computing resources caused by the fact that an optimal data block division scheme cannot be efficiently found by a data block division method for data compression is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and specifically, to a data processing method and device, a non-volatile storage medium, and an electronic device. Background Art

[0002] With the development of the Internet of Things, smart devices and big data technology, the amount of time series data generated has exploded. Time series data is usually generated by sensors, log systems and financial markets, and has the characteristics of high frequency, continuity and large volume. How to effectively store and transmit this massive amount of time series data has become an urgent problem to be solved.

[0003] This growing demand for storing and processing time series data has led to the development of time series databases, including InfluxDB and OpenTSDB. A key component in these databases is an effective compression scheme that can reduce storage space and improve performance. The most typical example is the LZ4 compression algorithm mainly used by OpenTSDB. It first divides the data into fixed-size data blocks, verifies whether the data blocks are identical through hash values, and uses the starting position and data block length to replace the original data for the same data blocks, thereby reducing redundancy and achieving data compression. However, this data compression algorithm needs to traverse the entire data set to find duplicate data blocks, and the data block division scheme is not flexible, resulting in a fixed data block size, making the compression effect not optimal.

[0004] It can be seen that in order to reduce data redundancy and achieve efficient data compression, data blocks must be divided first. However, in existing research, common block division methods include hash-based, range-based, and key-based block division. Although these methods can optimize the data block division scheme by data content, in subsequent operations, these block division methods still make the size of the divided data blocks fixed, resulting in low efficiency and inability to effectively determine the size and number of data blocks for the optimal compression ratio. In theory, the optimal data block division scheme can be found through exhaustive method, but due to its huge amount of calculation, the computing resources and time cost are too high when processing large-scale data sets, making the exhaustive method not practical.

[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0006] The embodiments of the present application provide a data processing method and device, a non-volatile storage medium, and an electronic device to at least solve the technical problem of wasting computing resources due to the inability of a data block partitioning method used for data compression to efficiently find an optimal data block partitioning scheme.

[0007] According to one aspect of an embodiment of the present application, a data processing method is provided, including: obtaining binary input data; determining multiple target schemes for data partitioning the input data, determining the target scheme as a target action, and assigning an initial Q value to the target action, wherein the target scheme includes: the number of data blocks; using an upper confidence bound algorithm to determine the average benefit of the target action, and determining a confidence interval corresponding to the average benefit; using the upper bound value of the confidence interval to update the initial Q value to obtain a target Q value table, determining a first action with the largest Q value in the target Q value table, and dividing the input data into multiple data blocks according to the first action; determining compression ratios corresponding to the multiple data blocks, using the compression ratios to update the average benefit of the target action, updating the target Q value table according to the updated average benefit, and selecting a new action in the updated target Q value table.

[0008] Optionally, the number of data blocks in the target solution ranges from 3 to n / 2, where n is the storage capacity of the input data in bytes and n is a positive integer greater than 7.

[0009] Optionally, determining compression ratios corresponding to multiple data blocks includes: determining the compression ratios of the multiple data blocks based on a first data length of a basic sub-block in the multiple data blocks and a second data length of a difference sub-block, wherein the basic sub-block is an identical data block in the multiple data blocks and the difference sub-block is a different data block in the multiple data blocks.

[0010] Optionally, the compression ratio of multiple data blocks is calculated by the following formula: Among them, k(t) is the number of data blocks, a is the first data length, b is the second data length, and n is the data length of the input data. Among the k+1 data blocks, the lengths of the first k data blocks are all q, and the length of the k+1th data block is r.

[0011] Optionally, after dividing the input data into multiple data blocks according to the first action, the method further includes: identifying identical data blocks in the multiple data blocks, storing the identical data blocks in the multiple data blocks together as basic sub-blocks; and storing different data blocks in the multiple data blocks separately as differential sub-blocks.

[0012] Optionally, the upper limit of the confidence interval is expressed by the following formula: Among them, σ 2 is a random variable X i The variance of , where i is a positive integer not greater than n, n is the data length of the input data, and c is the confidence level of the confidence interval. The number of times the target action is selected.

[0013] Optionally, the target Q value table is updated according to the updated average benefit, and a new action is selected in the updated target Q value table, including: when the number of iterations reaches a preset threshold or the Q value is in a preset range, stopping updating the average benefit of the target action.

[0014] According to another aspect of the embodiment of the present application, a data processing device is also provided, including: an acquisition module for acquiring binary input data; a first determination module for determining multiple target schemes for data partitioning of the input data, determining the target scheme as a target action, and assigning an initial Q value to the target action, wherein the target scheme includes: the number of data blocks; a second determination module for determining the average benefit of the target action using an upper confidence bound algorithm, and determining a confidence interval corresponding to the average benefit; a partitioning module for updating the initial Q value using an upper bound value of the confidence interval to obtain a target Q value table, determining a first action with the largest Q value in the target Q value table, and partitioning the input data into multiple data blocks according to the first action; an update module for determining compression ratios corresponding to multiple data blocks, updating the average benefit of the target action using the compression ratio, updating the target Q value table according to the updated average benefit, and selecting a new action in the updated target Q value table.

[0015] According to another aspect of the embodiments of the present application, a non-volatile storage medium is provided, the storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the above data processing method.

[0016] According to another aspect of the embodiments of the present application, there is further provided an electronic device, including: a memory and a processor, wherein the processor is used to run a program stored in the memory, wherein the above data processing method is executed when the program is run.

[0017] According to yet another aspect of the embodiments of the present application, a computer program is further provided, wherein the above data processing method is implemented when the computer program is executed by a processor.

[0018] According to another aspect of the embodiments of the present application, a computer program product is provided, which includes a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above data processing method is implemented.

[0019] In an embodiment of the present application, binary input data is obtained; multiple target schemes for data partitioning the input data are determined, the target scheme is determined as a target action, and an initial Q value is assigned to the target action, wherein the target scheme includes: the number of data blocks; using an upper confidence bound algorithm, the average benefit of the target action is determined, and the confidence interval corresponding to the average benefit is determined; the initial Q value is updated using the upper bound value of the confidence interval to obtain a target Q value table, the first action with the largest Q value is determined in the target Q value table, and the input data is divided into multiple data blocks according to the first action; the compression ratio corresponding to the multiple data blocks is determined, the average benefit of the target action is updated using the compression ratio, the target Q value table is updated according to the updated average benefit, and a new action is selected from the updated target Q value table, thereby achieving the purpose of efficiently determining the optimal data block partitioning scheme, thereby achieving the technical effect of reducing the wasted computing resources in the data partitioning process based on data compression, and further solving the technical problem of wasting computing resources due to the inability of the data partitioning method used for data compression to efficiently find the optimal data block partitioning scheme. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0021] Figure 1 is a flow chart of a data processing method according to an embodiment of the present application;

[0022] Figure 2 is a schematic diagram of a basic sub-block storage method according to an embodiment of the present application;

[0023] Figure 3 is a schematic diagram of a basic sub-block and a difference sub-block according to an embodiment of the present application;

[0024] Figure 4 is a flow chart of another data processing method according to an embodiment of the present application;

[0025] Figure 5 is a structural diagram of a data processing device according to an embodiment of the present application;

[0026] Figure 6 It is a hardware structure block diagram of a computer terminal according to a data processing method of an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the solution of the present application, 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 only 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 should fall within the scope of protection of the present application.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] According to an embodiment of the present application, a method embodiment of a data processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0030] Figure 1 is a flow chart of a data processing method according to an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:

[0031] Step S101, obtaining binary input data.

[0032] First, the time series data is received from the data source and converted into binary format. This step is to standardize and format the original data so that it is suitable for subsequent data block division and compression processing. For example, the network equipment operation time series data continuously received by the data sharing platform of the Jiangsu Telecom Intelligent Cloud Network Dispatching Operation Center will be converted into a binary data stream in the machine learning environment for more efficient data processing and storage.

[0033] Step S102, determining a plurality of target schemes for partitioning the input data, determining the target scheme as a target action, and assigning an initial Q value to the target action, wherein the target scheme includes: the number of data blocks.

[0034] In this application, the number of data blocks is regarded as a strategic choice, namely "target action". These actions need to be initialized at the beginning of the algorithm to ensure that the algorithm has a starting point. For example, for a binary input data of length n, the action space consists of all the numbers of data blocks between 3 and n / 2. In the first cycle, the algorithm will traverse all possible data block partitioning schemes (ie, all target actions), calculate the compression ratio of each scheme as the benefit of the action, and store these benefits as initial Q values ​​in the Q table. This step provides the algorithm with a basic decision-making basis, namely the potential compression effect of each data block partitioning scheme.

[0035] Step S103, using the upper confidence bound algorithm, determine the average benefit of the target action and determine the confidence interval corresponding to the average benefit.

[0036] In subsequent cycles, the algorithm uses the upper confidence bound algorithm to estimate the average benefit of the target action. The upper confidence bound algorithm allows the agent to balance uncertainty and known returns. By calculating the confidence upper bound value of each action, the action with the highest confidence upper bound value is selected for trial. At the same time, the degree of exploration of the action is also taken into account, avoiding only selecting the action with the best historical performance and ignoring the exploration of potential better solutions. Through the confidence interval determination, the algorithm can quantify the uncertainty of the benefit estimate of each action, providing more comprehensive information for the decision-making process.

[0037] Step S104, using the upper limit value of the confidence interval to update the initial Q value, obtain a target Q value table, determine the first action with the largest Q value in the target Q value table, and divide the input data into multiple data blocks according to the first action.

[0038] In each decision cycle, the algorithm will update the Q value of each action in the Q table according to the upper bound value calculated by the confidence upper bound algorithm. This means that the Q value of the action reflects both the historical average return and the uncertainty of the return. The algorithm will select the action with the largest Q value (the first action) from the updated Q value table as the current optimal strategy, and divide the binary input data into corresponding data blocks according to this action. For example, if the Q value table indicates that division into 5 data blocks is optimal, then the algorithm will process the input data in this way and generate 5 data blocks in preparation for subsequent compression.

[0039] Step S105, determining compression ratios corresponding to the plurality of data blocks, using the compression ratios to update the average benefit of the target action, updating the target Q value table according to the updated average benefit, and selecting a new action in the updated target Q value table.

[0040] After the data block is generated, the algorithm will calculate the compression ratio of the current partitioning scheme. The compression ratio is determined by comparing the amount of original data with the amount of compressed data, which directly reflects the quality of the compression effect. The algorithm will use this compression ratio to update the average benefit of the previously selected action and adjust the corresponding Q value in the Q table to reflect the latest compression effect. This process is iterative, which means that each selection and update contributes to the algorithm's learning process, enabling it to gradually optimize its decision-making strategy. In the next step, the algorithm will again select the action with the highest Q value based on the updated Q value table, and continue to optimize the partitioning and compression effect of the data block until convergence is reached or a specific stopping condition is met.

[0041] By executing the above steps repeatedly, the time series data block compression method based on Q-Learning in this application can intelligently adjust the division of data blocks to achieve the best compression effect. By balancing exploration and utilization, the algorithm can not only process data efficiently, but also ensure that the compression strategy can be continuously optimized over time to adapt to changes in data characteristics, thereby achieving efficient compression and management of large-scale time series data.

[0042] In practical applications, such as in the scenario of Jiangsu Telecom's intelligent cloud network dispatching and operation center, large-scale equipment operation data can be effectively compressed and stored, significantly reducing the use of storage space, while also improving the efficiency of data management and analysis. This compression method based on intelligent learning provides a new solution for big data management, especially when processing high-frequency and regular time series data, showing unique advantages.

[0043] The following Figure 1 The steps shown are exemplary and explanatory.

[0044] According to some optional embodiments of the present application, the number of data blocks in the target solution ranges from 3 to n / 2, where n is the storage capacity of the input data in bytes and n is a positive integer greater than 7.

[0045] The following is a detailed explanation of why the number of data blocks ranges from 3 to n / 2:

[0046] Assume that the input data of length n that has been serialized into binary (hereinafter referred to as data set) is divided into k+1 data blocks, and let the set Z represent all possible data blocks (C1, C2, ..., C k ,C k+1 ), the length of each data block is:

[0047]

[0048] r=n mod k (2)

[0049] here Indicates rounding down. Formula (1) (2) indicates the first k data blocks (C1, C2, ..., C k ) are all of length q, and the last data block (C k+1 ) is r. If r is 0, it means that n is divisible by k, that is, the size of each data block is q; otherwise, the size of the last data block is r.

[0050] In the absence of compression, the storage space occupied by the data set is: S(k)=n bits.

[0051] Each data block is divided into two parts: basic sub-block and difference sub-block for storage, such as Figure 2 and Figure 3 As shown, the basic sub-block is the same part A between each data block, and its length is defined as a. Then the storage space it occupies is composed of the basic sub-block position identifier and the valid value, as shown in Figure 2 As shown. Therefore, for binary data, the storage space occupied by the basic sub-block is:

[0052] Sa(k)=2a bits (3)

[0053] Then the difference sub-block length B_k of data block k is:

[0054]

[0055] At this time, all data blocks are composed of basic sub-blocks that are stored only once, the location identifiers of the basic sub-blocks, and the difference sub-blocks of each data block. Therefore, the storage size occupied by the compressed data set is:

[0056]

[0057] In summary, the compression ratio can be obtained as formula (6). The larger the CR, the better the compression ratio.

[0058]

[0059] The data block lengths q and r can be expressed by the number of data blocks k and the basic sub-block bit length a. Substituting equations (1) and (2) into equation (6), we can obtain:

[0060]

[0061] For the data block partitioning problem, define action a tis the number of data blocks k(t) used when dividing data blocks at time t. Each choice corresponds to a specific action. In principle, a data set of length n can be divided into 1 to n data blocks, that is, the value of k can be between 1 and n. However, in this embodiment, the elimination method is used to narrow the range of k, thereby further reducing the amount of calculation. The specific method is as follows:

[0062] 1. The minimum value that k can take:

[0063] When the k value is 1, substituting into equations (1) and (2) yields q = n, r = 0. In this case, it is obvious that the subsequent division of the basic sub-block and the difference sub-block cannot be performed, so k = 1 is meaningless;

[0064] When the k value is 2, substituting it into formula (8) yields CR = 1. In this case, no data compression is performed and there is no optimization effect. Therefore, k = 2 is meaningless.

[0065] When the k value is greater than or equal to 3, substituting it into formula (8) yields because therefore Right now At this time, data compression is effective, so the minimum value of k should be 3.

[0066] 2. The maximum value k can take is:

[0067] When the value of k is n, substituting into equations (1) and (2) yields q = 1, r = 0. At this time, each bit becomes a data block, and it is impossible to divide the basic sub-block and the difference sub-block. Therefore, k = n is meaningless.

[0068] When the k value is greater than n / 2, substituting it into equation (1,2) yields q=1. In this case, data block division is also impossible, so k>n / 2 is meaningless.

[0069] When the k value is n / 2, substituting it into formula (1,2), we can see that q=2, r=1 or 0. At this time, the data block can be divided and the operation is valid. Therefore, it can be seen that the maximum value that k can take should be n / 2.

[0070] In summary, k should be obtained from 3 to n / 2, that is, the action set When the number of data blocks is 1, it means that the entire input data is treated as a single data block for processing, which is contrary to the goal of data partitioning and compression, because without data block partitioning, data redundancy cannot be identified and eliminated. When the number of data blocks is 2, although a preliminary partition is performed, this partitioning method is too simple to effectively improve the compression ratio because it does not fully explore the repeated patterns in the data. Therefore, the minimum number of data blocks is set to 3 to ensure that data partitioning can bring substantial compression effects. When the number of data blocks reaches the length n of the input data, it means that the data is divided into n single-byte data blocks, which obviously cannot achieve effective sharing between data blocks because each block becomes an independent unit, and this highly fine-grained partitioning cannot fully utilize the similarity between data blocks for compression. The maximum number of data blocks is set to n / 2, considering the relationship between the length of the data and the compression ratio. When the number of data blocks exceeds n / 2, the compression efficiency usually drops rapidly because the data blocks are divided too frequently, resulting in an increase in the management cost of the basic sub-blocks and difference sub-blocks, which in turn reduces the overall compression efficiency. Therefore, n / 2 is a practical upper limit that ensures that data chunking is both effective in identifying duplicates and keeping management costs low.

[0071] The selection of data blocks between 3 and n / 2 is based on a comprehensive consideration of data redundancy identification and compression efficiency. A smaller number of data blocks (such as 3) can identify large-scale repetitive patterns, thereby improving the compression ratio; while a larger number of data blocks (greater than n / 2) can identify repetitions more finely, but it will also increase the computational cost. By dynamically adjusting the number of data blocks within the range of 3 to n / 2, the Q-Learning algorithm can find an optimal balance between compression efficiency and computational cost, effectively identifying repetitions between data blocks while maintaining low management costs, achieving highly efficient data compression.

[0072] According to some other optional embodiments of the present application, determining the compression ratio corresponding to multiple data blocks can be achieved by the following method: determining the compression ratio of the multiple data blocks based on the first data length of the basic sub-block in the multiple data blocks and the second data length of the difference sub-block, wherein the basic sub-block is the same data block in the multiple data blocks and the difference sub-block is the different data blocks in the multiple data blocks.

[0073] Specifically, the compression ratio r(t) of multiple data blocks can be calculated by the following formula:

[0074]

[0075] Among them, k(t) is the number of data blocks, a is the first data length, b is the second data length, and n is the data length of the input data. Among the k+1 data blocks, the lengths of the first k data blocks are all q, and the length of the k+1th data block is r.

[0076] In the design of this embodiment, the overall goal is to optimize the compression ratio, that is, to maximize the compression ratio after using this method, so as to achieve better compression effect. To achieve this goal, this embodiment defines to perform action a at time t t After that, the actual benefit r(t) obtained by the agent is the compression ratio obtained by the number of selected data blocks k(t). Therefore, according to mathematical derivation, action a t The actual profit function is:

[0077]

[0078] The optimal strategy π should satisfy the requirement of selecting those strategies that can maximize the action value as the optimal strategy among all possible strategies, that is:

[0079] π = argmax π E[r(t)] (9)

[0080] Since the agent wants to find the number of data blocks that maximizes the action value, it needs to obtain benefits by exhaustively traversing all division situations, which requires a lot of calculations. Therefore, the agent needs to use the historical benefit samples of the number of data blocks k to evaluate the action value, and then use the evaluation value to select the number of data blocks k. In order to make the evaluation result close to the expectation, this embodiment uses the historical average compression ratio of k to estimate the action value of each k(t), that is, as the estimated value of the action value. When the sample size gradually increases, the average compression ratio gradually converges to the expected compression ratio.

[0081] In the initial stage of the Q-Learning algorithm, since the system has not yet performed any operations or tried any compression strategies, the values ​​of all actions are unknown. In order to provide an effective starting point for the subsequent Q-Learning process, this embodiment traverses all possible data block partitioning schemes for the first sample data in the first cycle, calculates the benefits of each scheme, and assigns an initial value to each action.

[0082] At time t, the action value estimate of the defined data block number k(t) is the average benefit of each action in the historical sample, that is:

[0083]

[0084] in Indicates the number of times the number of data blocks k(t) is selected.

[0085] In each subsequent cycle, if the compression ratio of the number of data blocks is small, there may be a large gap between the estimated value and the true value of the action value. If the algorithm always chooses the maximum benefit among the estimated values ​​as the number of data blocks to be divided ("using" experience In order to correctly evaluate the action value of each value and avoid missing the optimal number of data blocks, the proposed algorithm needs to fully explore the compression ratio of each value (break away from the constraints of experience and do not use Similarly, when all data block values ​​have been accurately evaluated, the algorithm should promptly select the optimal solution (using ), so that the compression ratio is maximized. Therefore, the proposed algorithm needs to correctly handle the problem of balance between exploration and utilization, that is, to what extent (r(t))- is utilized. This embodiment uses a confidence upper bound to weigh exploration and utilization.

[0086] Since for any k(t), the true value of the action value exists in a confidence interval centered on the estimated value obtained from the sample data, that is, the confidence interval is Where c is the confidence level of the confidence interval. The width of the confidence interval is And the number of times selected Inversely proportional, that is, the fewer times an action is selected, the higher the uncertainty of the action value will be. Therefore, the width of the confidence interval can be defined as a measure of the uncertainty of the action value. The two operations of exploration and utilization can be balanced by adjusting the width of the confidence interval.

[0087] In some optional embodiments of the present application, the upper limit value Q(t) of the confidence interval is expressed by the following formula:

[0088]

[0089] Among them, σ 2 is a random variable X i The variance of , where i is a positive integer not greater than n, n is the data length of the input data, and c is the confidence level of the confidence interval. The number of times the target action is selected.

[0090] It should be noted that the confidence interval is Here is a detailed explanation of why the confidence interval falls within the above range:

[0091] There is always a certain difference between the mean calculated according to statistics and the true expectation. The probability that this difference is less than a small value δ>0 is called confidence. That is:

[0092]

[0093] Where X i (i=1,…,n) is the statistical sample data of independent and identical distribution, n is the number of samples, E(X) is the true expectation of these samples, α is the confidence level, and the above formula can be changed to:

[0094]

[0095] According to the central limit theorem, we know that:

[0096]

[0097] where σ 2 is a random variable X i The variance of (i=1,…,n), so we have

[0098]

[0099] Because erfc(x) <exp(-x 2 ), so there is

[0100]

[0101] Let confidence Then the relationship between δ and α can be calculated:

[0102]

[0103] All the benefits of the data block value k(t) are also independent and identically distributed random variables, so the true value of its action value exists in a confidence interval centered on the measurement result obtained from the sample data. Let c be the confidence level of the confidence interval, so the confidence interval is

[0104] As other optional embodiments of the present application, updating the target Q value table according to the updated average benefit and selecting a new action in the updated target Q value table can be achieved by the following method: when the number of iterations reaches a preset threshold or the Q value is in a preset range, stop updating the average benefit of the target action.

[0105] At the beginning of the algorithm, an iteration threshold is set (which may be based on time, data volume, or computing resources). When the number of iterations reaches this preset threshold, the Q value is stopped. This threshold can be set high enough to ensure that the algorithm has sufficient time to explore different data block partitioning schemes, while being low enough to avoid unnecessary calculations and maintain the efficiency of the algorithm. For example, if the preset number of iterations is 1000, the algorithm will perform at least 1000 learning cycles, after which it will stop adjusting the Q value and instead use the current Q value table to make decisions and select the best partitioning scheme for the data block.

[0106] Another stopping condition is when the change in the Q value or the standard deviation is lower than a preset threshold. This indicates that the algorithm has converged, that is, for different data block partitioning schemes, the Q-Learning algorithm has found a stable evaluation with no significant learning progress. For example, if the change in the Q value is less than 0.01 for several consecutive iterations, or the standard deviation of the Q value is lower than a preset threshold, the algorithm can be considered to have found a relatively optimal data block partitioning scheme, and no further exploration and adjustment is needed, so the Q value update is stopped.

[0107] These two conditions can be used independently or in combination to ensure that the algorithm can fully explore to find the optimal solution and stop in time to avoid over-learning and waste of resources. When any of the above stopping conditions is met, the algorithm will no longer update the average benefit of the target action, but will use the current Q value table to make decisions and select the optimal data block partitioning scheme. This scheme will be used for actual time series data compression operations, that is, the data is divided according to the action with the largest Q value (number of data blocks), and then the basic sub-blocks and difference sub-blocks are stored to achieve the highest possible compression ratio. This method can not only reduce the resource consumption of data storage and transmission, but also ensure the efficiency and quality of the compression process. It is an effective way to process large-scale time series data.

[0108] Through the above steps, it can be seen that this application introduces the Q-Learning algorithm to dynamically adjust the data block partitioning strategy according to the characteristics and change rules of time series data to ensure the optimal compression ratio, thereby improving the compression effect. The Q-Learning algorithm can intelligently explore different partitioning strategies, optimize using past experience, and use current feedback to update experience, so that each compression can be close to the optimal solution.

[0109] The present application stores the same parts of the divided data blocks as basic sub-blocks at one time, and stores the different parts as difference sub-blocks separately. This method effectively reduces data redundancy and optimizes the data storage structure, thereby significantly improving the efficiency of data compression and reducing unnecessary data duplication.

[0110] In addition, compared with the traditional exhaustive method, this application greatly reduces the amount of calculation through intelligent strategy selection. The exhaustive method needs to traverse all possible partitioning schemes in each data block adjustment cycle, which is computationally intensive and infeasible. In addition to traversing all partitioning schemes to obtain initial experience in the first cycle, the Q-Learning algorithm can achieve near-optimal compression effects with less computation through learning and experience accumulation in subsequent cycles. This not only reduces the consumption of computing resources, but also improves the operability and practicality of the algorithm.

[0111] In summary, this application achieves the optimal division of data blocks through the Q-Learning algorithm, and significantly improves the efficiency and effect of data compression by storing basic sub-blocks and difference sub-blocks separately, which has important practical application value and broad application prospects. This method not only solves the problems of inflexible block division, low compression efficiency, poor adaptability and large computational complexity in the prior art, but also provides an efficient and flexible data compression solution for the field of time series database compression.

[0112] Figure 4 is a flow chart of another data processing method according to an embodiment of the present application. Figure 4 As shown, the method comprises the following steps:

[0113] Step S401, data input.

[0114] Get the time series data to be compressed. This data can be obtained from the equipment operation records of the Jiangsu Telecom Intelligent Cloud Network Dispatching Operation Center, or time series data from any other source. The data input stage includes converting the data into binary format for subsequent processing. For example, if the data is sensor readings or other data, they will be serialized into a binary data stream as input to the algorithm.

[0115] Step S402, traverse all data partitioning schemes, initialize the Q table, and assign an initial value to each task.

[0116] In the first cycle, the algorithm will traverse all possible data block partitioning schemes, which consist of a number of data blocks k(t) between 3 and n / 2, where n is the length of the input data in bytes. At this stage, the algorithm will perform data block partitioning and compression operations for each k(t) value and record the compression ratio of each scheme as the initial value of the action. This process creates a Q table, where the rows of the Q table represent different states (in this embodiment, the state may refer to the characteristics of the input data, such as data length or data type), and the columns represent different actions (i.e., different numbers of data blocks).

[0117] Step S4031, evaluate average revenue The Q value obtained by using UCB is balanced between exploration and utilization.

[0118] In subsequent cycles, the algorithm will use the UCB algorithm to evaluate the average benefit of each action to determine the next action. The UCB algorithm balances exploration and exploitation by calculating the upper bound of the Q value, where the Q value consists of the average benefit of historical sample data and a confidence interval width representing uncertainty. The algorithm will calculate the average benefit for each number of data blocks k(t), and obtain the Q value of each action based on these benefits and confidence interval width to ensure that the agent not only utilizes the known best actions (i.e., solutions with known high compression ratios), but also explores other actions that may have higher compression ratios but have not been fully tested.

[0119] Step S4032, select the action that maximizes the Q value, and divide the data blocks according to the selected action.

[0120] Select the action with the highest Q value, that is, the number of data blocks k(t). This step is to transform theoretical decisions into practical operations. By selecting the action with the largest Q value, the algorithm is actually selecting the current optimal data block partitioning scheme. According to the selected k(t) value, the algorithm divides the data into k(t) data blocks, and the length of each data block is calculated according to formulas (1) and (2).

[0121] Step S4033: Take the same value in each block as the basic sub-block, and store the basic sub-block and the difference sub-block.

[0122] Once the data is divided into multiple data blocks, the algorithm will identify the same parts of these blocks and store them as basic sub-blocks. Differential sub-blocks cover different parts of the data blocks, and they will also be stored separately. This stage takes advantage of the data block division. By storing the basic sub-blocks once, data redundancy is avoided, and the storage of differential sub-blocks ensures the integrity and accuracy of the data.

[0123] Step S4034, calculating the compression ratio of the current data block division scheme as the actual benefit.

[0124] After the data is divided and stored, the algorithm will calculate the compression ratio of the current scheme, which is achieved by comparing the length of the original data and the length of the compressed data. The compression ratio calculation formula uses the formula (6) or its variant in the above technical disclosure book, which reflects the effectiveness of the current data block division scheme. This compression ratio is used as the real benefit to evaluate the effectiveness of the current action and will be used to update the Q value in the Q table to reflect the most recent decision results.

[0125] Step S4035, update average revenue

[0126] At the end of each cycle, the algorithm will update the average benefit of the action. The average benefit is obtained by accumulating the compression ratio samples of each action and calculating the average value, so that the actual compression ratio of each action can be gradually approached as the algorithm iterates. The update of the average benefit is a key part of the algorithm's learning process because it affects the calculation of the Q value, which determines the action selection in subsequent cycles.

[0127] By repeating the above steps, the algorithm can dynamically adjust the division of data blocks to achieve optimal data compression.

[0128] In the above steps, the Q-Learning algorithm is used to optimize the data block division, which significantly reduces the computational cost compared with the existing methods and can approach the optimal solution that can be obtained by the exhaustive method. The method of storing the basic sub-blocks and the difference sub-blocks separately effectively reduces data redundancy. This not only improves the compression efficiency, but also ensures the integrity and quality of the compressed data, avoids excessive redundant data occupying the storage space, and effectively reduces data redundancy to achieve compression. The Q-Learning algorithm has adaptive capabilities and can dynamically adjust the compression strategy according to the real-time changes of the time series data to adapt to the time series data with similar change rules. Compared with the exhaustive method, the computational amount is small and the computational cost is significantly saved. The Q-Learning algorithm balances exploration and utilization, enabling the system to dynamically adjust and optimize the compression strategy while maintaining efficient data compression. The exploration part allows the system to try new data block division schemes and discover potential better schemes; the utilization part ensures that the system uses known effective methods for compression to maintain the current high efficiency. Through this balance, the system not only improves the compression efficiency, but also enhances the adaptability and flexibility, enabling it to continuously optimize the compression strategy according to the changes in the characteristics of the time series data and actual needs.

[0129] In general, this application uses Q-Learning for time series data compression, which not only achieves efficient and high-quality compression, but also greatly reduces the computational complexity, and enhances the adaptability and flexibility of the system by balancing exploration and utilization, and can track data features and adapt to changes. These advantages make the application of Q-Learning in time series data compression have significant advantages and potential.

[0130] Figure 5 is a structural diagram of a data processing device according to an embodiment of the present application, such as Figure 5 As shown, the device comprises:

[0131] The acquisition module 51 is used to acquire binary input data.

[0132] The first determination module 52 is used to determine multiple target solutions for data partitioning of the input data, determine the target solution as a target action, and assign an initial Q value to the target action, wherein the target solution includes: the number of data blocks.

[0133] The second determination module 53 is used to determine the average benefit of the target action and determine the confidence interval corresponding to the average benefit by using the upper confidence bound algorithm.

[0134] The partitioning module 54 is used to update the initial Q value using the upper limit value of the confidence interval to obtain a target Q value table, determine the first action with the largest Q value in the target Q value table, and partition the input data into multiple data blocks according to the first action.

[0135] The updating module 55 is used to determine the compression ratios corresponding to the plurality of data blocks, update the average benefit of the target action using the compression ratio, update the target Q value table according to the updated average benefit, and select a new action in the updated target Q value table.

[0136] Optionally, the number of data blocks in the target solution ranges from 3 to n / 2, where n is the storage capacity of the input data in bytes and n is a positive integer greater than 7.

[0137] Optionally, the update module 55 is also used to perform the following steps: determine the compression ratio of multiple data blocks based on the first data length of the basic sub-block in the multiple data blocks and the second data length of the difference sub-block, wherein the basic sub-block is the same data block in the multiple data blocks and the difference sub-block is the different data block in the multiple data blocks.

[0138] Optionally, the compression ratio of multiple data blocks is calculated by the following formula: Among them, k(t) is the number of data blocks, a is the first data length, b is the second data length, and n is the data length of the input data. Among the k+1 data blocks, the lengths of the first k data blocks are all q, and the length of the k+1th data block is r.

[0139] Optionally, the data processing device is also used to perform the following steps after dividing the input data into multiple data blocks according to the first action: identifying the same data blocks in the multiple data blocks, and storing the same data blocks in the multiple data blocks as basic sub-blocks together; and storing different data blocks in the multiple data blocks as difference sub-blocks separately.

[0140] Optionally, the upper limit of the confidence interval is expressed by the following formula: Among them, σ 2 is a random variable X i The variance of , where i is a positive integer not greater than n, n is the data length of the input data, and c is the confidence level of the confidence interval. The number of times the target action is selected.

[0141] Optionally, the updating module 55 is further configured to execute the following steps: when the number of iterations reaches a preset threshold or the Q value is within a preset interval, stop updating the average benefit of the target action.

[0142] It should be noted that the above Figure 5 The modules in the embodiment may be program modules (e.g., a set of program instructions for implementing a specific function) or hardware modules. For the latter, they may be expressed in the following forms, but are not limited thereto: the expression form of the above modules is a processor, or the functions of the above modules are implemented by a processor.

[0143] It should be noted that Figure 5 The preferred implementation of the illustrated embodiment can be found in Figure 1 The relevant description of the illustrated embodiment will not be repeated here.

[0144] Figure 6 FIG. 1 shows a hardware structure block diagram of a computer terminal for implementing a data processing method. Figure 6 As shown, the computer terminal 60 may include one or more (602a, 602b, ..., 602n are used to illustrate) processors 602 (the processor 602 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 604 for storing data, and a transmission module 606 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 6 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 6 More or fewer components as shown, or with Figure 6 Different configurations shown.

[0145] It should be noted that the one or more processors 602 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 60. As involved in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0146] The memory 604 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the data processing method in the embodiment of the present application. The processor 602 executes various functional applications and data processing by running the software programs and modules stored in the memory 604, that is, realizing the above-mentioned data processing method. The memory 604 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 604 may further include a memory remotely arranged relative to the processor 602, and these remote memories may be connected to the computer terminal 60 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0147] The transmission module 606 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 60. In one example, the transmission module 606 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission module 606 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0148] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 60 .

[0149] It should be noted that, in some optional embodiments, the above Figure 6 The computer terminal shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. It should be noted that Figure 6 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the computer terminal described above.

[0150] It should be noted that Figure 6 The computer terminal shown is used to execute Figure 1 The data processing method shown, therefore the relevant explanations in the execution method of the above command are also applicable to the electronic device and will not be repeated here.

[0151] An embodiment of the present application further provides a non-volatile storage medium, which includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the above data processing method.

[0152] A program for a non-volatile storage medium to perform the following functions: obtaining binary input data; determining multiple target schemes for data partitioning the input data, determining the target scheme as a target action, and assigning an initial Q value to the target action, wherein the target scheme includes: the number of data blocks; using an upper confidence bound algorithm to determine the average benefit of the target action, and determining a confidence interval corresponding to the average benefit; using an upper bound value of the confidence interval to update the initial Q value to obtain a target Q value table, determining a first action with the largest Q value in the target Q value table, and dividing the input data into multiple data blocks according to the first action; determining compression ratios corresponding to the multiple data blocks, using the compression ratio to update the average benefit of the target action, updating the target Q value table according to the updated average benefit, and selecting a new action in the updated target Q value table.

[0153] An embodiment of the present application further provides an electronic device, including: a memory and a processor, wherein the processor is used to run a program stored in the memory, wherein the above data processing method is executed when the program is run.

[0154] The processor is used to run a program that performs the following functions: obtain binary input data; determine multiple target schemes for data partitioning the input data, determine the target scheme as a target action, and assign an initial Q value to the target action, wherein the target scheme includes: the number of data blocks; use an upper confidence bound algorithm to determine the average benefit of the target action, and determine the confidence interval corresponding to the average benefit; use the upper bound value of the confidence interval to update the initial Q value to obtain a target Q value table, determine the first action with the largest Q value in the target Q value table, and divide the input data into multiple data blocks according to the first action; determine the compression ratios corresponding to the multiple data blocks, use the compression ratios to update the average benefit of the target action, update the target Q value table according to the updated average benefit, and select a new action in the updated target Q value table.

[0155] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0156] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0157] In the above-mentioned embodiments of the present application, the collected information is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary protection measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0158] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0159] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0160] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0161] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for 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 method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.

[0162] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A data processing method, characterized in that: include: Get binary input data; Determine a plurality of target schemes for data partitioning the input data, determine the target schemes as target actions, and assign an initial Q value to the target actions, wherein the target schemes include: the number of data blocks; Using an upper confidence bound algorithm, determine the average benefit of the target action, and determine a confidence interval corresponding to the average benefit; Using the upper limit value of the confidence interval to update the initial Q value, obtain a target Q value table, determine a first action with the largest Q value in the target Q value table, and divide the input data into a plurality of data blocks according to the first action; Determine the compression ratios corresponding to the plurality of data blocks, use the compression ratios to update the average benefit of the target action, update the target Q value table according to the updated average benefit, and select a new action from the updated target Q value table.

2. The method according to claim 1, characterized in that The number of the data blocks in the target solution ranges from 3 to n / 2, where n is the storage capacity of the input data in bytes and is a positive integer greater than 7.

3. The method according to claim 1, characterized in that Determining compression ratios corresponding to the plurality of data blocks includes: The compression ratio of the multiple data blocks is determined based on the first data length of the basic sub-block in the multiple data blocks and the second data length of the difference sub-block, wherein the basic sub-block is the same data block in the multiple data blocks and the difference sub-block is the different data block in the multiple data blocks.

4. The method according to claim 3, characterized in that include: The compression ratio r(t) of the data blocks is calculated by the following formula: Among them, k(t) is the number of data blocks, a is the first data length, b is the second data length, and n is the data length of the input data. Among the k+1 data blocks, the lengths of the first k data blocks are all q, and the length of the k+1th data block is r.

5. The method according to claim 1, characterized in that After dividing the input data into a plurality of data blocks according to the first action, the method further includes: Identifying identical data blocks among the plurality of data blocks, and storing the identical data blocks among the plurality of data blocks as basic sub-blocks together; Different data blocks among the plurality of data blocks are stored as difference sub-blocks respectively.

6. The method according to claim 1, characterized in that The upper limit of the confidence interval is expressed by the following formula: Among them, σ 2 is a random variable X i The variance of , where i is a positive integer not greater than n, n is the data length of the input data, c is the confidence level of the confidence interval, The number of times the target action was selected.

7. The method according to claim 1, characterized in that Update the target Q value table according to the updated average revenue, and select new actions in the updated target Q value table, including: When the number of iterations reaches a preset threshold or the Q value is within a preset interval, the updating of the average benefit of the target action is stopped.

8. A data processing device, characterized in that: include: An acquisition module is used to obtain binary input data; A first determination module is used to determine a plurality of target solutions for dividing the input data, determine the target solution as a target action, and assign an initial Q value to the target action, wherein the target solution includes: the number of data blocks; A second determination module is used to determine the average benefit of the target action by using an upper confidence bound algorithm, and to determine a confidence interval corresponding to the average benefit; a partitioning module, configured to update the initial Q value by using the upper limit value of the confidence interval to obtain a target Q value table, determine a first action with the largest Q value in the target Q value table, and partition the input data into a plurality of data blocks according to the first action; An updating module is used to determine the compression ratio corresponding to the plurality of data blocks, update the average benefit of the target action using the compression ratio, update the target Q value table according to the updated average benefit, and select a new action in the updated target Q value table.

9. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored program, wherein when the program is executed, the device where the non-volatile storage medium is located is controlled to execute the data processing method according to any one of claims 1 to 7.

10. An electronic device, characterized in that: include: A memory and a processor, wherein the processor is used to run a program stored in the memory, wherein the program executes the data processing method according to any one of claims 1 to 7 when running.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the data processing method according to any one of claims 1 to 7 is implemented.