Time sequence missing value filling method and system based on diffusion model

By introducing an adaptive noise weight optimization strategy into the diffusion model, the problem of lack of flexibility in the noise weight algorithm in the existing technology is solved, and the model's adaptability and filling effect to different data sets is improved.

CN119537816AActive Publication Date: 2025-02-28NORTHWEST UNIV

Patent Information

Application Number
CN202510104203.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-02-28
Estimated Expiration
2045-01-23

AI Technical Summary

Technical Problem

The existing noise weight algorithms lack flexibility and are difficult to adapt to different data sets, resulting in poor effectiveness of diffusion models when filling multivariable time series data.

Method used

Through the adaptive noise weight optimization strategy, the model can independently learn the weights of different noise levels, thereby adapting to different timing data sets. Specific methods include introducing an adaptive noise weight optimization strategy during the training process, and by weight allocation of the difficulty of noise learning, the more difficult the noise is given higher weight.

Benefits of technology

The adaptability and universality of the model on different data sets is realized, the effect of filling the missing value of time series is improved, and the learning effect of different levels of noise is balanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119537816A_ABST
    Figure CN119537816A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of multivariate time series data missing value filling, and discloses a time series missing value filling method and system based on a diffusion model, and the method comprises the steps: 1, dividing a time series data set into a training set, a verification set and a test set, and carrying out the data processing of each piece of time series data, obtaining a 01 mask matrix of each piece of time sequence data, a to-be-filled target and observable time sequence data; 2, a training process is carried out, and a trained denoising network is obtained; and step 3, inputting a forward noise adding result corresponding to the test set into the trained denoising network obtained in the step 2, and outputting a reverse denoising result as filled time sequence data. According to the method, the flexibility of noise weight setting is realized, and the applicability and universality of the model to different time sequence data sets are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of missing value filling of multivariate time series data, and specifically relates to a method and system for filling missing values ​​of time series based on a diffusion model. Background Art

[0002] Multivariate time series data are widely used in various practical fields such as finance, medicine, and transportation. However, due to human errors or signal transmission problems, time series data often contain missing values. These missing values ​​will have an adverse impact on downstream tasks such as time series prediction. Therefore, how to use observable data to fill missing values ​​has become an important direction of current research.

[0003] With the continuous development of deep learning technology, people use deep learning models such as Recurrent Neural Network (RNN) and Generative Adversarial Network (GAN) to fill in missing data. However, these models have poor filling performance when facing complex, non-stationary multivariate time series data. As an emerging probability-based deep learning generative model, the diffusion model can better handle non-stationary and noisy time series data. The diffusion model continuously adds different levels of noise to the data in the forward process, and then gradually removes the added noise in the reverse process to learn the distribution of the data. However, the diffusion model usually adds hundreds of different levels of noise to the data. The optimization directions of different levels of noise are different and their effects on the model filling effect are also different. Therefore, if all noises are given the same learning weight during the model learning process, the final effect of the model will not be optimal. Existing noise weight algorithms all manually set fixed noise weights. These algorithms lack flexibility, require high expert knowledge to adjust the weights, and are difficult to adapt to different data sets. Summary of the invention

[0004] The purpose of the present invention is to provide a method and system for filling missing values ​​in time series based on a diffusion model to solve the problem that the existing noise weight algorithm lacks flexibility and is difficult to adapt to different data sets. The present invention enables the model to autonomously learn weights of different noise levels, thereby adapting to different time series data sets.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions: On the one hand, the present invention provides a method for filling missing values ​​in a time series based on a diffusion model, which specifically comprises the following steps: Step 1, data processing: divide the time series data set into training set, validation set and test set, process each time series data in each part, and obtain the 01 mask matrix corresponding to each time series data , and the target to be filled and observable time series data .

[0006] Step 1 specifically includes the following sub-steps: Step 11, given a time series dataset, Represents one of the time series data, where K and L represent the time series data respectively The number and length of channels. Divide the time series data set into three parts: training set, validation set and test set according to a certain ratio; Step 12: For each time series data in each part X , construct the time series data according to the location of the missing value X 01 mask matrix of the same shape ,01 mask matrix 0 in the value indicates that the position is missing, and 1 indicates that the value at the position can be observed. Represents time series data The observable values ​​in ; Step 13: To facilitate model training and evaluation, according to the 01 mask matrix , using the preset missing pattern and missing rate, in the time series data Add new missing values ​​and record the position of the missing values ​​as 01 mask matrix ; Step 14: and Respectively with time series data Perform matrix Hadamard product operation to obtain the target to be filled and observable time series data .

[0007] Step 2, the training process, obtains the trained denoising network, including the following sub-steps: Step 21, forward noise addition: To observable time series data Add T steps of noise in sequence, with different noise levels added in each step, to construct a noise-added sequence , expressed as ,in For the t The time series data obtained after adding noise. When the number of steps T of adding noise tends to infinity, It will approach normal Gaussian noise. Although increasing the value of T can bring certain performance improvements during the training process, the model training time and computational cost will also increase. In order to balance the benefits and costs, T is set to 50 in this embodiment.

[0008] Step 22, reverse denoising: In the reverse denoising stage, the time series data obtained from step 21 Start by gradually removing the noise added in the forward denoising process, and obtain the time series data after each step of noise removal. The whole reverse denoising process is ,in Represents the time series data obtained after denoising in step t, and finally outputs the time series data , as the time series data for filling. Among them, The specific operation is: the time series data obtained by denoising in step t , the condition information Cond and the current denoising step number t are input into the denoising network together to obtain the noise prediction result of the tth step (Abbreviated as ), where t∈1~T; then calculate .

[0009] By optimizing the noise prediction result at step t With real noise added The loss function value between the two is used for iterative training, and the trained denoising network is obtained after the training is completed.

[0010] Specifically, the loss function that needs to be optimized during training is as follows:

[0011] in: —Loss function.

[0012] —Mathematical expectation.

[0013] —Time series data conform to Data distribution; —Time series data during noise addition Data distribution; —Realistic added noise conform to Data distribution; —The weight matrix of the noise at step t, with an initial value of 1.

[0014] As a preferred embodiment of the present invention, in the denoising process, there are T steps of noise of different levels, and these noises have different effects on the filling performance. The learning of T different levels of noise is regarded as T optimization tasks, and by assigning different weights to these optimization tasks, the model pays more attention to learning the noise that has a greater impact on the filling effect. The adaptive noise weight optimization strategy is as follows: An adaptive noise weight optimization strategy is introduced during the model training process. Specifically, the denoising network is allowed to assign weights by itself based on the difficulty of learning the noise. The more difficult the noise is to learn, the more important it is considered to be, and a higher weight needs to be assigned. Since the validation set can preliminarily evaluate the performance of the network model on an unknown data set, the learning effect of the denoising network on the validation set is used to evaluate the difficulty of learning the noise. Specifically, during the model training process, the first formula below is used to set the difficulty of learning at the t-th time step at the i-th epoch, and the second formula below is used to set the weight at the t-th time step at the i-th epoch:

[0015]

[0016] in: —The denoising network is in the validation set at epoch i-1. t The loss function value at time steps; —The denoising network is in the validation set at epoch i-2. t The loss function value at time steps; The weight of the t-th time step at the i-th epoch. During the training of the training set, the weight is used every k epochs. Update once , in this embodiment, k=4. In the calculation of the loss function of the validation set, Always 1.

[0017] —The ratio of the loss function values ​​of the t-th time step of two consecutive epochs in the validation set. If the ratio shows a downward trend, it means that the loss of the t-th time step decreases faster, learning is easier, and a smaller weight should be given. On the contrary, if it shows an upward trend, it means that learning is more difficult and a larger weight should be given; —Adjustment parameters, used to adjust the difference of noise learning at different time steps, The larger the value, the more uniform the weight distribution among different noise tasks will be. When is large enough, the weights of all time step noises will be equal. Set to 1.5; —Weight normalization parameter, ensuring that the sum of weights of all noise learning tasks is equal to , because T is set to 50 in the present invention, there are 50 noise learning tasks, and the weight of each noise task is 1 at the beginning, so Set to 50.

[0018] Step 3: Model sampling process.

[0019] The result of the forward denoising process corresponding to the test set is gradually removed from the noise added in the forward denoising process to obtain the time series data after each step of denoising; wherein the specific operation of each step is: the time series data obtained by denoising the current step, the conditional information Cond and the number of steps of the current denoising are input into the trained denoising network obtained in step 2 to obtain the noise prediction result corresponding to the current step, the time series data obtained by denoising the current step is subtracted from the noise prediction result corresponding to the current step to obtain the time series data obtained by denoising the next step, and the final result is used as the time series data after filling.

[0020] In a second aspect, the present invention provides a time series missing value filling system based on a diffusion model, which specifically includes the following modules: The data processing module is used to divide the time series data set into training set, validation set and test set, and process each time series data in each part to obtain the 01 mask matrix corresponding to each time series data. , and the target to be filled and observable time series data ; The training module is used to obtain a trained denoising network, which is implemented using the following operation process: Forward noise addition: To observable time series data Add T steps of noise in sequence, with different noise levels added in each step, to construct a noise-added sequence , expressed as ,in For the t The time series data obtained after adding noise; Inverse denoising: In the reverse denoising stage, the time series data obtained from the forward denoising Starting from the beginning, the noise added in the forward denoising process is gradually removed to obtain the time series data after each step of noise removal; the entire reverse denoising process is expressed as ,in Represents the time series data obtained after denoising in step t, and finally outputs the time series data , as the filled time series data; where, The specific operation is: the time series data obtained by denoising in step t , the condition information Cond and the current denoising step number t are input into the denoising network together to obtain the noise prediction result of the tth step (Abbreviated as ), where t∈1~T; then calculate ; By taking the noise prediction result of step t With real noise added The loss function value between is used for iterative training, and the denoising network is obtained after the training. The loss function that needs to be optimized during the training process is as follows:

[0021] in: — loss function; — mathematical expectation; —Time series data during noise addition Data distribution; —Time series data conform to Data distribution; —Realistic added noise conform to Data distribution; —The weight matrix of the noise at step t, with an initial value of 1.

[0022] The missing value filling module is used to gradually remove the noise added in the forward denoising process from the result of the forward denoising process corresponding to the test set, and obtain the time series data after each step of denoising; wherein the specific operation of each step is: input the denoising time series data, condition information Cond and the number of steps of the current denoising into the trained denoising network obtained in step 2, and obtain the noise prediction result corresponding to the current step; subtract the noise prediction result corresponding to the current step from the denoising time series data, and obtain the denoising time series data for the next step; the final result is used as the filled time series data.

[0023] In a third aspect, the present invention provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the method for filling missing values ​​in a time series based on a diffusion model is implemented.

[0024] In a fourth aspect, the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the above-mentioned method for filling missing values ​​in a time series based on a diffusion model.

[0025] Compared with the prior art, the present invention has the following technical effects: (1) Different from the traditional fixed noise weight method, the present invention provides an adaptive noise weight method and system based on a diffusion model. The present invention enables the model to adaptively adjust different weights according to different noise levels when running on different data sets, so that the model can focus on learning the noise level that has a greater impact on the filling effect. In this way, the learning effects of different levels of noise are balanced, and the overall filling effect of the model is enhanced. Through the adaptive learning method, the flexibility of noise weight setting is achieved, and the applicability and versatility of the model to different time series data sets are enhanced.

[0026] (2) Through comparative experiments, multiple fixed weight algorithms and multiple different models were selected as references. Through qualitative and quantitative analysis, it was proved that the algorithm has good effects on time series data sets in multiple different fields, which proves the specificity and versatility of the adaptive noise weight algorithm in the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The present application may be better understood by referring to the following description given in conjunction with the accompanying drawings, which together with the following detailed description are incorporated in and form a part of this specification.

[0028] Figure 1 It is a structural diagram of the denoising network in the present invention; Figure 2 This is a comparison chart of the filling effects of the present invention and the benchmark model CSDI method on the AQI-36 dataset. DETAILED DESCRIPTION

[0029] The exemplary embodiments of the present application will be described below in conjunction with the accompanying drawings. For the sake of clarity and conciseness, not all features of the actual embodiments are described in the specification. However, it should be understood that many implementation-specific decisions can be made in the process of developing any such actual embodiments in order to achieve the specific goals of the developer, and these decisions may vary from embodiment to embodiment.

[0030] It is also necessary to explain here that, in order to avoid obscuring the present application due to unnecessary details, only the device structure closely related to the scheme according to the present application is shown in the drawings, while other details that are not closely related to the present application are omitted.

[0031] It should be understood that the present application is not limited to the described implementation forms due to the following description with reference to the accompanying drawings. In the present application, the embodiments can be combined with each other, features between different embodiments can be replaced or borrowed, and one or more features can be omitted in one embodiment, if feasible.

[0032] The specific contents of the present invention are further explained in detail below with reference to examples.

[0033] Embodiment 1: This implementation example provides a method and system for filling missing values ​​in a time series based on a diffusion model. Specifically, it includes the following steps: Step 1, data processing. It includes the following sub-steps: Step 11, input time series data It is a two-dimensional matrix with a shape and size of L*K, which respectively represent the length and number of channels in a time series data.

[0034] Step 12: For each time series data in each part X , according to the location of the missing value, a 01 mask matrix of the same size as the input data is obtained , 0 in the 01 mask matrix indicates that the position is a missing value, and 1 indicates that the value of the position can be observed.

[0035] Step 13, in 01 mask matrix On the basis of the missing pattern and missing rate set in advance, in each channel of the input data, the values ​​of some positions are randomly set to missing according to the different missing patterns. Specifically, the missing pattern is random missing or time-continuous missing. Random missing means that each position of the channel is randomly set to missing, and time-continuous missing means that a continuous section of data in a channel is set to missing. The missing rate is determined according to experience as needed. The positions that are artificially set to missing are recorded to obtain the 01 mask matrix. .

[0036] Step 14: and Use time series data Perform matrix Hadamard product operation to obtain the target to be filled And the observable time series data after artificially adding missing values .

[0037] Step 2: Model training process.

[0038] Step 21: Forward noise addition: For observable time series data Perform T times of noise addition to obtain the noised data .

[0039] Specifically, the forward noise addition formula is shown in the following two formulas (the second formula is the probability distribution expression of the first formula)

[0040]

[0041] in: Given time series data hour The joint probability distribution of Given time series data hour Data distribution; —Time series data during noise addition Data distribution; —Gaussian distribution; —Artificially set noise intensity table, .

[0042] —The identity matrix has the same shape as the time series data, and its shape is .

[0043] When T tends to infinity, the final time series data after noise addition will approach a normal Gaussian distribution.

[0044] Step 22, reverse denoising: In the reverse denoising process, the time series data obtained from step 21 Start by removing the noise step by step. .by Take the denoising process as an example to introduce it in detail.

[0045] We introduced conditional information Specifically, the condition information Cond is composed of a 01 mask matrix , diffusion time coding, time position coding and feature coding, of which the last three are known information. t Time series data after step noise addition , Condition Information and diffusion time step t is input into the denoising network.

[0046] Specifically, the structure of the denoising network is as follows Figure 1 As shown, it includes a first module, a second module, a third module, a fourth module and s In the present invention, s is 4.

[0047] The first module includes a fully connected layer, a SiLu activation function, a fully connected layer and a ReLu activation function connected in sequence; the second module includes connected 1x1 convolution and ReLu modules; the third module includes connected 1x1 convolution and ReLu modules; the fourth module includes 1x1 convolution and ReLu modules and subsequent connected 1x1 convolutions; each residual layer includes a temporal attention module, a channel attention module, a gated activation unit and multiple 1x1 convolution blocks.

[0048] Diffusion time coding input first module, time series data after noise addition (Input data) is input to the second module, which is represented by the mask matrix , time position coding, and feature coding are input into the third module. The output of the first module is added to the output of the second module after a 1x1 convolution in the current residual layer, and then enters the time attention module in the current residual layer to realize feature extraction in the length dimension, and then enters the channel attention module to realize feature extraction in the channel dimension, and then passes through a 1x1 convolution and is added to the output of the third module, and then enters the gated activation unit to filter the feature information to obtain the output feature. The output feature is residually connected to the output of the second module after a 1x1 convolution and then output to the next residual layer for processing; in addition, the output feature of the current residual layer is also skip-connected to the output feature of each residual layer, and then enters the fourth module for processing. The result is used as the output result of the denoising network: noise level prediction result .

[0049] Predicting results by optimizing noise levels With real noise added The model is trained using the MSE loss between the two. The process definition formula for the entire reverse denoising process is:

[0050] in: —Has learnable parameters The distribution of the inverse process.

[0051] Given time series data and condition information hour, The joint probability distribution of .

[0052] Given time series data and condition information hour, data distribution.

[0053] The objective function of the entire noise network optimization is defined as:

[0054] in: — loss function; — mathematical expectation; —Time series data during noise addition Data distribution; —Time series data conform to Data distribution; —Realistic added noise conform to Data distribution; —The weight matrix of the noise at step t, with an initial value of 1.

[0055] Get the noise prediction result of step t After that, the result of the previous step is obtained by subtracting the noise of the current step. .

[0056] In the process of optimizing the denoising network objective function, an adaptive noise weight optimization method is introduced. The adaptive noise weight optimization strategy is as follows: The weights are adaptively assigned according to the difficulty of learning the model on the validation set. The specific method is: training is performed on the training set, and the weights of all noise levels are set to 1 at the beginning. Evaluation is performed on the validation set every k epochs, and the weights of each noise level are readjusted. Specifically: the loss ratio of two consecutive validation sets is calculated on the validation set as a measure of learning difficulty, and then the weight of each noise step level is obtained through the softmax function. Then, W in the loss function during training is updated ( t ). The specific formula is as follows:

[0057]

[0058] in: —The denoising network is in the validation set at epoch i-1. t The loss function value at time steps; —The denoising network is in the validation set at epoch i-2. t The loss function value at time steps; The weight of the t-th time step at the i-th epoch. During the training of the training set, the weight is used every k epochs. Update once , k=4; in the calculation of the loss function of the validation set, Always 1; —The ratio of the loss function values ​​of the t-th time step of two consecutive epochs in the validation set; —Adjustment parameters, used to adjust the difference of noise learning at different time steps, Set to 1.5; —weight normalization parameter, Set to 50.

[0059] The difference between different noise levels can be adjusted by adjusting K in the second formula. When K is large enough, the weights of different noises will tend to be equal.

[0060] Step 3: Model sampling process.

[0061] In this process, the result of the forward denoising process corresponding to the test set is gradually removed from the noise added in the forward denoising process to obtain the time series data after each step of denoising; wherein the specific operation of each step is: the time series data obtained by denoising the current step, the conditional information Cond and the number of steps of the current denoising are input into the trained denoising network obtained in step 2 to obtain the noise prediction result corresponding to the current step, the time series data obtained by denoising the current step is subtracted from the noise prediction result corresponding to the current step to obtain the time series data obtained by denoising the next step, and the final result is used as the time series data after filling.

[0062] In order to analyze the effectiveness of the method of the present invention, in this example, the filling effect of the method of the present invention in different data sets and different missing modes is verified. Three time series data sets in different fields were used for verification, namely: AQI-36 air quality data set, PhysioNet ECG data set, and METR-LA traffic data set. Then the two evaluation indicators MAE and RMSE were used to evaluate the filling effect. Each group of experiments was repeated 5 times. Table 1 is the filling experimental results of the method of the present invention and other methods in the above three data sets in different missing modes. Figure 2 It is a comparison of the filling effect of the method of the present invention and the benchmark model CSDI on the AQI-36 dataset.

[0063] Table 1 Experimental results of the present invention in filling different missing modes in three data sets

[0064] It can be seen from Table 1 that compared with the benchmark model and other fixed noise weight strategy methods, the present invention has improved the filling accuracy in different data sets and different missing patterns to varying degrees, and can effectively handle data sets and missing patterns in various situations in the real world.

[0065] Figure 2 The results of the filling generation of the method proposed in the present invention and the benchmark model CSDI are shown in Figure 1. Three channels are selected for visualization analysis. The red cross represents the observed value, the green solid line represents the filling value generated by the method of the present invention, the blue circle represents the true value, and the green shaded area represents the quantile range from 0.05 to 0.95. It can be seen from the figure that the method of the present invention is closer to the true value in terms of filling effect, and the generation effect is better than the benchmark model.

[0066] Embodiment 2: This embodiment provides a time series missing value filling system based on a diffusion model, which specifically includes the following modules: The data processing module is used to divide the time series data set into training set, validation set and test set, and process each time series data in each part to obtain the 01 mask matrix corresponding to each time series data. , and the target to be filled and observable time series data ; The training module is used to obtain a trained denoising network, which is implemented using the following operation process: Forward noise addition: To observable time series data Add T steps of noise in sequence, with different noise levels added in each step, to construct a noise-added sequence , expressed as ,in For the t The time series data obtained after adding noise; Inverse denoising: In the reverse denoising stage, the time series data obtained from the forward denoising Starting from the beginning, the noise added in the forward denoising process is gradually removed to obtain the time series data after each step of noise removal; the entire reverse denoising process is expressed as ,in Represents the time series data obtained after denoising in step t, and finally outputs the time series data , as the filled time series data; where, The specific operation is: the time series data obtained by denoising in step t , the condition information Cond and the current denoising step number t are input into the denoising network together to obtain the noise prediction result of the tth step (Abbreviated as ), where t∈1~T; then calculate ; By taking the noise prediction result of step t With real noise added The loss function value between is used for iterative training, and the denoising network is obtained after the training. The loss function that needs to be optimized during the training process is as follows:

[0067] in: — loss function; — mathematical expectation; —Time series data conform to Data distribution; —Time series data during noise addition Data distribution; —Realistic added noise conform to Data distribution; —The weight matrix of the noise at step t, with an initial value of 1; The missing value filling module is used to gradually remove the noise added in the forward denoising process from the result of the forward denoising process corresponding to the test set, and obtain the time series data after each step of denoising; wherein the specific operation of each step is: input the denoising time series data, condition information Cond and the number of steps of the current denoising into the trained denoising network obtained in step 2, and obtain the noise prediction result corresponding to the current step; subtract the noise prediction result corresponding to the current step from the denoising time series data, and obtain the denoising time series data for the next step; the final result is used as the filled time series data.

[0068] Example 3 This embodiment provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the method for filling missing values ​​of a time series based on a diffusion model of the present invention is implemented.

[0069] Example 4 This embodiment provides a computer program product, including a computer program / instruction. When the computer program / instruction is executed by a processor, the method for filling missing values ​​of a time series based on a diffusion model of the present invention is implemented.

[0070] The above are only various implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for filling missing values ​​in time series based on diffusion model, characterized in that: The specific steps include: Step 1, data processing: divide the time series data set into training set, validation set and test set, process each time series data in each part, and obtain the 01 mask matrix corresponding to each time series data , and the target to be filled and observable time series data ; Step 2, the training process, obtains the trained denoising network, including the following sub-steps: Step 21, forward noise addition: To observable time series data Add T steps of noise in sequence, with different noise levels added in each step, to construct a noise-added sequence , expressed as ,in For the t The time series data obtained after step noise addition; the result of forward noise addition is the time series data ; Step 22, reverse denoising: In the reverse denoising stage, the time series data obtained from step 21 Starting from the beginning, the noise added in the forward denoising process is gradually removed to obtain the time series data after each step of noise removal; the entire reverse denoising process is expressed as ,in Represents the time series data obtained after denoising in step t, and finally outputs the time series data , as the filled time series data; where, The specific operation is: the time series data obtained by denoising in step t , the condition information Cond and the current denoising step number t are input into the denoising network together to obtain the noise prediction result of the tth step , abbreviated as , where t∈1~T; then calculate ; By taking the noise prediction result of step t With real noise added The loss function value between is used for iterative training, and the denoising network is obtained after the training. The loss function that needs to be optimized during the training process is as follows: in: — loss function; — mathematical expectation; —Time series data conform to Data distribution; —Time series data during noise addition Data distribution; —Realistic added noise conform to Data distribution; —The weight matrix of the noise at step t, with an initial value of 1; Step 3, gradually remove the noise added in the forward denoising process from the result of the forward denoising process corresponding to the test set, and obtain the time series data after denoising at each step; wherein the specific operation of each step is: input the denoising time series data obtained by the current step, the condition information Cond and the number of current denoising steps into the trained denoising network obtained in step 2, obtain the noise prediction result corresponding to the current step, subtract the noise prediction result corresponding to the current step from the denoising time series data obtained by the current step, obtain the denoising time series data for the next step, and the final result is used as the filled time series data.

2. The method for filling missing values ​​in a time series based on a diffusion model according to claim 1, characterized in that: Step 1 specifically includes the following sub-steps: Step 11, given a time series dataset, Represents one of the time series data, where K and L represent the time series data respectively The number and length of channels; divide the time series data set into three parts: training set, validation set and test set according to a certain ratio; Step 12: For each time series data in each part X , construct the time series data according to the location of the missing value X 01 mask matrix of the same shape ,01 mask matrix 0 in the value indicates that the position is missing, and 1 indicates that the value at the position can be observed. Represents time series data The observable values ​​in ; Step 13, according to the 01 mask matrix , using the preset missing pattern and missing rate, in the time series data Add new missing values ​​and record the position of the missing values ​​as 01 mask matrix ; Step 14: and Respectively with time series data Perform matrix Hadamard product operation to obtain the target to be filled and observable time series data .

3. The method for filling missing values ​​in a time series based on a diffusion model according to claim 1, characterized in that: In step 21, T is set to 50.

4. The method for filling missing values ​​in a time series based on a diffusion model according to claim 1, characterized in that: In step 22, the condition information Cond is composed of a 01 mask matrix , diffusion time coding, time position coding and feature coding.

5. The method for filling missing values ​​in a time series based on a diffusion model according to claim 1, characterized in that: In step 22, during the model training process, the difficulty of learning at the t-th time step at the i-th epoch is set using the following first formula, and the weight of the t-th time step at the i-th epoch is set using the following second formula: in: —The denoising network is in the validation set at epoch i-1. t The loss function value at time steps; —The denoising network is in the validation set at epoch i-2. t The loss function value at time steps; The weight of the t-th time step at the i-th epoch. During the training of the training set, the weight is used every k epochs. Update once , k=4; in the loss function calculation of the validation set, Always 1; —The ratio of the loss function values ​​of the t-th time step of two consecutive epochs in the validation set; —Adjustment parameters, used to adjust the difference of noise learning at different time steps, Set to 1.5; —weight normalization parameter, Set to 50.

6. A time series missing value filling system based on diffusion model, characterized in that: Specifically includes the following modules: The data processing module is used to divide the time series data set into training set, validation set and test set, and process each time series data in each part to obtain the 01 mask matrix corresponding to each time series data. , and the target to be filled and observable time series data ; The training module is used to obtain a trained denoising network, which is implemented using the following operation process: Forward noise addition: To observable time series data Add T steps of noise in sequence, with different noise levels added in each step, to construct a noise-added sequence , expressed as ,in For the t The time series data obtained after adding noise; Inverse denoising: In the reverse denoising stage, the time series data obtained from the forward denoising Starting from the beginning, the noise added in the forward denoising process is gradually removed to obtain the time series data after each step of noise removal; the entire reverse denoising process is expressed as ,in Represents the time series data obtained after denoising in step t, and finally outputs the time series data , as the filled time series data; where, The specific operation is: the time series data obtained by denoising in step t , the condition information Cond and the current denoising step number t are input into the denoising network together to obtain the noise prediction result of the tth step , abbreviated as , where t∈1~T; then calculate ; By taking the noise prediction result of step t With real noise added The loss function value between is used for iterative training, and the denoising network is obtained after the training. The loss function that needs to be optimized during the training process is as follows: in: — loss function; — mathematical expectation; —Time series data conform to Data distribution; —Time series data during noise addition Data distribution; —Realistic added noise conform to Data distribution; —The weight matrix of the noise at step t, with an initial value of 1; The missing value filling module is used to gradually remove the noise added in the forward denoising process from the result of the forward denoising process corresponding to the test set, and obtain the time series data after each step of denoising; wherein the specific operation of each step is: input the denoising time series data, condition information Cond and the number of steps of the current denoising into the trained denoising network obtained in step 2, and obtain the noise prediction result corresponding to the current step; subtract the noise prediction result corresponding to the current step from the denoising time series data, and obtain the denoising time series data for the next step; the final result is used as the filled time series data.

7. 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 method for filling missing values ​​of a time series based on a diffusion model as described in any one of claims 1 to 5 is implemented.

8. A computer program product, characterized in that It includes a computer program / instruction, and when the computer program / instruction is executed by a processor, it implements the method for filling missing values ​​of a time series based on a diffusion model as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Time series prediction method combined with multiple models

    CN113065703A

  • Knowledge embedding and filling soft measurement method based on conditional score diffusion

    CN117370771A

  • Self-supervised trajectory completion method in general scene

    CN118550907A

  • Multivariate time series diffusion filling method based on acceleration guidance

    CN118626776A

  • Time series data missing value filling method based on diffusion model

    CN119202555A

Cited By

  • Power data missing value completion method and system based on time perception diffusion

    CN119884626A

  • Sequence diffusion method based on multi-sequence alignment and electronic equipment thereof

    CN120220812A

  • A sequence diffusion method based on multiple sequence alignment and electronic device thereof

    CN120220812B

  • MIMO scattering channel estimation method, medium and device

    CN120547024A

  • Distribution line fault type identification method based on data enhancement algorithm

    CN122020320A