Model training method, data discrimination method, device, medium and product
By training time series data generation and identification models using adversarial training methods, the similarity between synthetic and real data is improved, solving the problems of low similarity and high acquisition cost of synthetic data, and realizing a research scheme with high reliability and low cost.
Patent Information
- Application Number
- CN202210665189.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-13
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2042-06-13
AI Technical Summary
The synthetic time series data generated by existing technologies have low similarity to real data, resulting in poor reliability of research based on synthetic data and high cost of acquiring time series data.
Synthetic data is generated by a time series data generation model, and adversarial training methods are used to train the time series data generation model and the discrimination model to improve the similarity between the synthetic data and the real data and enhance the discrimination ability of the discrimination model.
It improves the similarity between synthetic data and real data, ensures the reliability of research based on synthetic data, and reduces the cost of acquiring time series data.
Smart Images

Figure CN115048426B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of machine learning, and in particular, to a model training method, a data discrimination method, a device, a medium and a product. BACKGROUND
[0002] In recent years, with the improvement of computing power and the progress of communication technology, data has become an important resource in the world, among which time series data with high time correlation is particularly important. Time series data usually contains rich and complex information, for example, time series data can be data continuously collected by various sensors (such as sensors in medical devices, sensors in power grid devices, etc.), audio call data, etc. In recent years, research on time series data has gradually become a hot topic in the industry.
[0003] Considering that time series data often carries information with high sensitivity, such as users' personal privacy information, information related to financial transactions, etc., the process of obtaining time series data is more cumbersome and requires more resources, resulting in high cost of obtaining time series data. In order to solve the above problems, in related technologies, synthetic data similar to real time series data can be generated.
[0004] Although the above scheme can reduce the cost of obtaining time series data, since the similarity between the generated synthetic data and the real time series data is still low, the reliability of research based on synthetic data is poor. SUMMARY
[0005] In order to solve the problems in the related art, the embodiments of the present disclosure provide a model training method, a data discrimination method, a device, a medium and a product.
[0006] In a first aspect, the embodiments of the present disclosure provide a model training method, which comprises:
[0007] obtaining time series data;
[0008] generating synthetic time series data through a time series data generation model;
[0009] processing the time series data to obtain time series feature data, and processing the synthetic time series data to obtain synthetic time series feature data;
[0010] inputting the time series feature data and the synthetic time series feature data into a time series data discrimination model to obtain a data discrimination result, the data discrimination result being used to indicate the similarity between the time series data and the synthetic time series data;
[0011] Based on the data discrimination result, the time series data generation model and the time series data discrimination model are trained in an adversarial training manner.
[0012] In response to the data discrimination result output by the time series data discrimination model after at least one round of training satisfying the undifferentiated condition of the synthetic time series data, the time series data generation model after at least one round of training is determined as the target time series data generation model.
[0013] In an implementation manner of the present disclosure, the time series feature data includes at least two of the time series data, the frequency domain feature data corresponding to the time series data, the time domain and frequency domain splicing feature data corresponding to the time series data, and the autocorrelation feature data corresponding to the time series data.
[0014] The synthetic time series feature data includes at least two of the synthetic time series data, the synthetic frequency domain feature data corresponding to the synthetic time series data, the synthetic time domain and frequency domain splicing feature data corresponding to the synthetic time series data, and the synthetic autocorrelation feature data corresponding to the synthetic time series data.
[0015] In an implementation manner of the present disclosure, the time series data is processed to obtain the time series feature data, including:
[0016] The time series data is subjected to Fourier transform to obtain the frequency domain feature data.
[0017] The synthetic time series data is subjected to Fourier transform to obtain the synthetic frequency domain feature data.
[0018] In an implementation manner of the present disclosure, the time series data is processed to obtain the time series feature data, further including:
[0019] The time series data and the frequency domain feature data are spliced to obtain the time domain and frequency domain splicing feature data.
[0020] The synthetic time series data and the synthetic frequency domain feature data are spliced to obtain the synthetic time domain and frequency domain splicing feature data.
[0021] In an implementation manner of the present disclosure, the time series data is processed to obtain the time series feature data, including:
[0022] The time series data is processed based on the autocorrelation function to obtain the autocorrelation feature data.
[0023] The synthetic time series data is processed based on the autocorrelation function to obtain the synthetic autocorrelation feature data.
[0024] In one implementation of the present disclosure, the time series data discrimination model comprises a time domain discriminator model, a frequency domain discriminator model, a time-frequency discriminator model, and an autocorrelation discriminator model.
[0025] The time series feature data and the synthesized time series feature data are input into the time series data discrimination model to obtain a data discrimination result, comprising:
[0026] The time series data and the synthesized time series data are input into the time domain discriminator model to obtain a time domain discrimination result.
[0027] And / or, the frequency domain feature data and the synthesized frequency domain feature data are input into the frequency domain discriminator model to obtain a frequency domain discrimination result.
[0028] And / or, the time-frequency splicing feature data and the synthesized time-frequency splicing feature data are input into the time-frequency discriminator model to obtain a time-frequency discrimination result.
[0029] And / or, the autocorrelation feature data and the synthesized autocorrelation feature data are input into the autocorrelation discriminator model to obtain an autocorrelation discrimination result.
[0030] The data discrimination result comprises at least two of the time domain discrimination result, the frequency domain discrimination result, the time-frequency discrimination result, and the autocorrelation discrimination result.
[0031] In a second aspect, the present disclosure provides a data discrimination method, comprising:
[0032] Obtaining sampled time series data;
[0033] Processing the sampled time series data to obtain sampled time series feature data, the sampled time series feature data comprising at least two of the sampled time series data, sampled frequency domain feature data corresponding to the sampled time series data, sampled time domain frequency domain splicing feature data corresponding to the sampled time series data, and sampled autocorrelation feature data corresponding to the sampled time series data.
[0034] Inputting the sampled time series data into the time domain discriminator model to obtain a sampled time domain discrimination result.
[0035] And / or, inputting the sampled frequency domain feature data into the frequency domain discriminator model to obtain a sampled frequency domain discrimination result.
[0036] And / or, inputting the sampled time domain frequency domain splicing feature data into the time-frequency discriminator model to obtain a sampled time-frequency discrimination result.
[0037] And / or, inputting the sampled autocorrelation feature data into the autocorrelation discriminator model to obtain a sampled autocorrelation discrimination result.
[0038] The sampling data discrimination result is obtained according to at least two of the sampling time domain discrimination result, the sampling frequency domain discrimination result, the sampling time-frequency discrimination result and the sampling autocorrelation discrimination result, and the sampling data discrimination result is used for indicating the authenticity of the sampling time sequence data.
[0039] In a third aspect, an electronic device is provided in the embodiments of the present disclosure, comprising a memory and a processor; the memory is configured to store one or more computer instructions; the one or more computer instructions are executed by the processor to implement the method steps in the first aspect, any implementation manner of the first aspect, or any item in the second aspect.
[0040] In a fourth aspect, a readable storage medium is provided in the embodiments of the present disclosure, and the readable storage medium has computer instructions stored thereon; the computer instructions are executed by a processor to implement the method steps in the first aspect, any implementation manner of the first aspect, or any item in the second aspect.
[0041] In a fifth aspect, a computer program product is provided in the embodiments of the present disclosure, and the computer program product comprises computer instructions; the computer instructions are executed by a processor to implement the method steps in the first aspect, any implementation manner of the first aspect, or any item in the second aspect.
[0042] The scheme of the embodiment of the present disclosure is as follows: time series data is acquired; synthetic time series data is generated by a time series data generation model; the time series data is processed to obtain time series feature data, and the synthetic time series data is processed to obtain synthetic time series feature data; the time series feature data and the synthetic time series feature data are input into a time series data discrimination model to obtain a data discrimination result, which is used to indicate the similarity degree of the time series data and the synthetic time series data; the time series data generation model and the time series data discrimination model are trained in an adversarial training manner based on the data discrimination result; and the time series data generation model after at least one round of training is determined as a target time series data generation model in response to the data discrimination result output by the time series data discrimination model after at least one round of training satisfying a synthetic time series data indistinguishable condition. Since the time series data generation model and the time series data discrimination model are trained in an adversarial training manner, the similarity degree of the synthetic time series data generated by the time series data generation model and the real time series data can be continuously improved in the training process, and the discrimination ability of the time series data discrimination model can also be continuously enhanced, and the data discrimination result obtained based thereon can distinguish the synthetic time series data of the time series data that is more and more similar to the real time series data from the real time series data. When the data discrimination result output by the trained time series data discrimination model satisfies the synthetic time series data indistinguishable condition, it can be considered that the discrimination ability of the time series data discrimination model cannot distinguish the synthetic time series data generated by the time series data generation model at this time from the real synthetic time series data even after training, and therefore the time series data generation model at this time is determined as the target time series data generation model. The target time series data generation model can generate synthetic time series data that is highly similar to the real time series data, thereby ensuring high reliability of research based on the synthetic time series data.
[0043] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0044] Other features, objects, and advantages of the present disclosure will become more apparent from the following detailed description of the non-limiting embodiments in conjunction with the accompanying drawings. In the drawings:
[0045] Figure 1 A flowchart of a model training method according to an embodiment of the present disclosure is shown.
[0046] Figure 2 A flowchart of a data discrimination method according to an embodiment of the present disclosure is shown.
[0047] Figure 3 A structural block diagram of an electronic device according to an embodiment of the disclosure is shown.
[0048] Figure 4 A block diagram of a computer system suitable for implementing a federated edge learning configuration information acquisition method according to an embodiment of the disclosure is shown. DETAILED DESCRIPTION
[0049] Hereinafter, exemplary embodiments of the disclosure will be described in detail with reference to the accompanying drawings so as to be easily implemented by those skilled in the art. Also, parts irrelevant to the description of the exemplary embodiments are omitted in the drawings for the sake of clarity.
[0050] In the disclosure, it is understood that terms such as "include" or "have" are intended to indicate the presence of features, numbers, steps, actions, components, parts or combinations thereof disclosed in the specification, and do not want to exclude the possibility of one or more other features, numbers, steps, actions, components, parts or combinations thereof exist or be added.
[0051] It is further noted that the embodiments in the disclosure and the features in the embodiments can be combined with each other without conflict. The disclosure will be described in detail below with reference to the drawings and in conjunction with the embodiments.
[0052] In the related art, when conducting research related to time series data, considering that time series data often carries information with high sensitivity, such as personal privacy information of users, information related to financial transactions, etc., the process of obtaining time series data is relatively cumbersome, which consumes a lot of resources, resulting in high cost of obtaining time series data. Therefore, in order to solve the above problems, synthetic data similar to real time series data can be generated, and research related to time series data can be conducted based on the synthetic data.
[0053] However, although the above scheme can reduce the cost of obtaining time series data, since the similarity between the generated synthetic data and the real time series data is still low, it may lead to poor reliability of the research results obtained by conducting research based on the synthetic data.
[0054] To solve the above problems, the disclosure provides a model training method, a data discrimination method, an apparatus, a medium and a product.
[0055] Figure 1 A flowchart of a model training method according to an embodiment of the disclosure is shown, as shown in Figure 1 The method includes steps S101-S106.
[0056] In step S101, time series data is obtained.
[0057] In step S102, the synthetic time series data is generated by the time series data generation model.
[0058] In step S103, the time series data is processed to obtain time series feature data, and the synthetic time series data is processed to obtain synthetic time series feature data.
[0059] In step S104, the time series feature data and the synthetic time series feature data are input into the time series data discrimination model to obtain a data discrimination result.
[0060] The data discrimination result is used to indicate the similarity between the time series data and the synthetic time series data.
[0061] In step S105, the time series data generation model and the time series data discrimination model are trained by means of adversarial training based on the data discrimination result.
[0062] In step S106, in response to the data discrimination result output by the time series data discrimination model after at least one round of training satisfying a synthetic time series data indistinguishable condition, the time series data generation model after at least one round of training is determined as a target time series data generation model.
[0063] In an embodiment of the present disclosure, the time series data can be understood as real data continuously generated at a certain time interval. For example, the time series data can be voice call data, or data collected by a sensor, such as a sensor on a medical device, a sensor on a meteorological or geographic information detection device, etc. The present disclosure does not limit the specific type of time series data.
[0064] In an embodiment of the present disclosure, the collected time series data can be normalized, divided into a plurality of time series data sequences of the same length, and divided into a plurality of time series data groups, each including a target number of time series data sequences. At least one time series data group is randomly selected from the plurality of time series data groups as the time series data obtained in step S101.
[0065] It should be noted that, in the process of training the time series data generation model and the time series data discrimination model, in order to avoid repetition of the time series data obtained by step S101 in different rounds of training, at least one time series data group can be randomly selected from the plurality of time series data groups as the time series data obtained in step S101.
[0066] In an embodiment of the present disclosure, the time series data generation model can be a long short-term memory (LSTM) model, a neural network (NN) model, a convolutional neural network (CNN) model, or the like. The present disclosure does not limit the specific implementation of the time series data generation model.
[0067] In an embodiment of the present disclosure, the time series data generation model can be a long short-term memory (LSTM) model, a neural network (NN) model, a convolutional neural network (CNN) model, or the like. The present disclosure does not limit the specific implementation of the time series data generation model.
[0068] In an embodiment of the present disclosure, the time series feature data can be understood as data indicating the characteristics of the time series data in at least one aspect. For example, the time series feature data can be used to indicate the characteristics of the time series data in at least one aspect such as the time domain or the frequency domain. Similarly, the synthetic time series feature data can be understood as data indicating the characteristics of the synthetic time series data in at least one aspect.
[0069] In an embodiment of the present disclosure, the time series data discrimination model can be a recurrent neural network (RNN) combined with a fully connected network, a neural network model, a convolutional neural network model, or the like. The present disclosure does not limit the specific implementation of the time series data discrimination model.
[0070] In an embodiment of the present disclosure, the data discrimination result can be understood as a data discrimination result corresponding to each of the time series data and the synthetic time series data, wherein each data discrimination result is used to indicate whether the corresponding data is synthetic or real. For example, the data discrimination result can be a vector with a value range of (0, 1). If the value of the data discrimination result is closer to 1, the corresponding data is more likely to be real. If the value of the data discrimination result is closer to 0, the corresponding data is more likely to be synthetic.
[0071] The data discrimination result can also be understood as a data discrimination result corresponding to the time series data and the synthetic time series data, wherein the data discrimination result can be used to indicate which data in the time series data and the synthetic time series data is real or which data is synthetic.
[0072] In an embodiment of the present disclosure, based on the data discrimination result, the time series data generation model and the time series data discrimination model are trained in an adversarial training manner, which can be understood as obtaining a loss function of the time series data discrimination model according to the data discrimination result obtained in step S104, calculating a gradient update vector of the time series data discrimination model according to the loss function, updating the time series data discrimination model according to the gradient update vector to update parameters of the time series data discrimination model, then repeatedly executing steps S101 to S104, and obtaining a loss function of the time series data generation model according to the data discrimination result obtained by repeated execution, and calculating a gradient update vector of the time series data generation model according to the loss function.
[0073] In an embodiment of the present disclosure, the data discrimination result output by the time series data discrimination model after at least one round of training satisfies the synthetic time series data indistinguishable condition, which can be understood as that the loss function of the time series data generation model obtained according to the data discrimination result converges; it can also be understood that the loss function of the time series data discrimination model obtained according to the data discrimination result converges, and the time series data and the synthetic time series data cannot be distinguished according to the data discrimination result.
[0074] In the scheme of the embodiments of the present disclosure, time series data is acquired; synthetic time series data is generated by a time series data generation model; the time series data is processed to obtain time series feature data, and the synthetic time series data is processed to obtain synthetic time series feature data; the time series feature data and the synthetic time series feature data are input into a time series data discrimination model to obtain a data discrimination result, which is used to indicate the similarity between the time series data and the synthetic time series data; the time series data generation model and the time series data discrimination model are trained in an adversarial training manner based on the data discrimination result; and the time series data generation model after at least one round of training is determined as a target time series data generation model in response to the data discrimination result output by the time series data discrimination model after at least one round of training satisfying a synthetic time series data indistinguishable condition. Since the time series data generation model and the time series data discrimination model are trained in an adversarial training manner, the similarity between the synthetic time series data generated by the time series data generation model and the real time series data can be continuously improved in the training process, and the discrimination ability of the time series data discrimination model can also be continuously enhanced, and the data discrimination result obtained based thereon can distinguish the synthetic time series data that is more and more similar to the real time series data from the real time series data. When the data discrimination result output by the trained time series data discrimination model satisfies the synthetic time series data indistinguishable condition, it can be considered that the discrimination ability of the time series data discrimination model cannot be improved even after training, and it cannot distinguish the synthetic time series data generated by the time series data generation model at this time from the real time series data. Therefore, the time series data generation model at this time is determined as the target time series data generation model, which can generate synthetic time series data that is highly similar to the real time series data, thereby ensuring high reliability of research based on the synthetic time series data.
[0075] In one implementation manner of the present disclosure, the time series feature data includes at least two of the time series data, the frequency domain feature data corresponding to the time series data, the time domain and frequency domain splicing feature data corresponding to the time series data, and the autocorrelation feature data corresponding to the time series data.
[0076] The synthetic time series feature data includes at least two of the synthetic time series data, the synthetic frequency domain feature data corresponding to the synthetic time series data, the synthetic time domain and frequency domain splicing feature data corresponding to the synthetic time series data, and the synthetic autocorrelation feature data corresponding to the synthetic time series data.
[0077] In one embodiment of the present disclosure, the frequency domain feature data corresponding to the time series data can be understood as indicating the characteristics of the time series data in the frequency domain; the time domain and frequency domain splicing feature data corresponding to the time series data can be understood as being spliced from the time series data and the frequency domain feature data, and indicating the characteristics of the time series data in both the time domain and the frequency domain; and the autocorrelation feature data corresponding to the time series data can be understood as indicating the repetitive pattern of the time series data, such as a periodic signal hidden by noise, etc. Similarly, the synthetic frequency domain feature data corresponding to the synthetic time series data can be understood as indicating the characteristics of the synthetic time series data in the frequency domain; the synthetic time domain and frequency domain splicing feature data corresponding to the synthetic time series data can be understood as being spliced from the synthetic time series data and the synthetic frequency domain feature data, and indicating the characteristics of the synthetic time series data in both the time domain and the frequency domain; and the synthetic autocorrelation feature data corresponding to the synthetic time series data can be understood as indicating the repetitive pattern of the synthetic time series data.
[0078] In the scheme of the embodiments of the present disclosure, by limiting the time series feature data to include at least two of the time series data, the frequency domain feature data corresponding to the time series data, the time domain and frequency domain splicing feature data corresponding to the time series data, and the autocorrelation feature data corresponding to the time series data; and by limiting the synthetic time series feature data to include at least two of the synthetic time series data, the synthetic frequency domain feature data corresponding to the synthetic time series data, the synthetic time domain and frequency domain splicing feature data corresponding to the synthetic time series data, and the synthetic autocorrelation feature data corresponding to the synthetic time series data, it can be ensured that the time series feature data can indicate the characteristics of the time series data in multiple aspects, and that the synthetic time series feature data can indicate the characteristics of the synthetic time series data in multiple aspects, thereby improving the diversity of the time series feature data and the synthetic time series feature data, and indirectly improving the accuracy of the data discrimination result obtained based on the time series feature data and the synthetic time series feature data.
[0079] In one implementation of the present disclosure, in step S103, the time series data is processed to obtain time series feature data, which can be achieved by the following steps:
[0080] performing Fourier transform on the time series data to obtain frequency domain feature data;
[0081] performing Fourier transform on the synthetic time series data to obtain synthetic frequency domain feature data.
[0082] In one embodiment of the present disclosure, the Fourier transform can be performed on the time series data to obtain the frequency domain feature data F(w) according to the following formula:
[0083]
[0084] wherein t is time, w is the frequency of the time series data, f(t) is the time series data, and e is a natural constant.
[0085] In one implementation of the present disclosure, the Fourier transform of the synthetic time series data can be performed according to the following formula to obtain the synthetic frequency domain feature data F(w):
[0086]
[0087] wherein t is time, w1 is the frequency of the synthetic time series data, f1(t) is the synthetic time series data, and e is a natural constant.
[0088] In the scheme of the embodiments of the present disclosure, the Fourier transform of the time series data is performed to obtain the frequency domain feature data, and the Fourier transform of the synthetic time series data is performed to obtain the synthetic frequency domain feature data, which can reduce the difficulty of obtaining the frequency domain feature data and the synthetic frequency domain feature data and improve the processing efficiency.
[0089] In one implementation of the present disclosure, in step S103, the processing of the time series data to obtain the time series feature data can further include the following steps:
[0090] The time series data and the frequency domain feature data are spliced to obtain time domain frequency domain spliced feature data;
[0091] The synthetic time series data and the synthetic frequency domain feature data are spliced to obtain synthetic time domain frequency domain spliced feature data.
[0092] In the scheme of the embodiments of the present disclosure, the time series data and the frequency domain feature data are spliced to obtain the time domain frequency domain spliced feature data, and the synthetic time series data and the synthetic frequency domain feature data are spliced to obtain the synthetic time domain frequency domain spliced feature data, which can reduce the difficulty of obtaining the time domain frequency domain spliced feature data and the synthetic time domain frequency domain spliced feature data and improve the processing efficiency.
[0093] In one implementation of the present disclosure, in step S103, the processing of the time series data to obtain the time series feature data can be implemented by the following steps:
[0094] The time series data is processed based on the autocorrelation function to obtain autocorrelation feature data;
[0095] The synthetic time series data is processed based on the autocorrelation function to obtain synthetic autocorrelation feature data.
[0096] In one embodiment of the present disclosure, the time series data is processed based on the autocorrelation function to obtain autocorrelation feature data, which can be an autocorrelation function (ACF) of the time series data. Specifically, the autocorrelation function R(τ) of the time series data can be calculated according to the following formula:
[0097]
[0098] wherein f(t) is the time series data, and f(t+τ) is the time series data with a time interval of τ from f(t).
[0099] The time series data is processed based on the synthetic autocorrelation function to obtain synthetic autocorrelation feature data, which can be an autocorrelation function of the synthetic time series data. Specifically, the autocorrelation function R1(τ) of the time series data can be calculated according to the following formula:
[0100]
[0101] wherein f1(t) is the synthetic time series data, and f1(t+τ) is the synthetic time series data with a time interval of τ from f1(t).
[0102] In the scheme of the embodiments of the present disclosure, the autocorrelation feature data is obtained by processing the time series data based on the autocorrelation function, and the synthetic autocorrelation feature data is obtained by processing the synthetic time series data based on the autocorrelation function, which can reduce the difficulty of obtaining the autocorrelation feature data and the synthetic autocorrelation feature data, and improve the processing efficiency.
[0103] In one implementation of the present disclosure, the time series data discrimination model includes a time domain discriminator model, a frequency domain discriminator model, a time-frequency discriminator model, and an autocorrelation discriminator model.
[0104] In step S104, the time series feature data and the synthetic time series feature data are input into the time series data discrimination model to obtain a data discrimination result, which can be achieved by the following steps:
[0105] The time series data and the synthetic time series data are input into the time domain discriminator model to obtain a time domain discrimination result.
[0106] And / or, the frequency domain feature data and the synthetic frequency domain feature data are input into the frequency domain discriminator model to obtain a frequency domain discrimination result.
[0107] And / or, the time domain frequency domain splicing feature data and the synthetic time domain frequency domain splicing feature data are input into the time-frequency discriminator model to obtain a time-frequency discrimination result.
[0108] and / or, inputting the self-correlation feature data and the synthesized self-correlation feature data into the self-correlation discriminator model to obtain a self-correlation discrimination result;
[0109] The data discrimination result includes at least two of the time domain discrimination result, the frequency domain discrimination result, the time-frequency discrimination result and the self-correlation discrimination result.
[0110] In the scheme of the embodiments of the present disclosure, by limiting the time series data discrimination model to include the time domain discriminator model, the frequency domain discriminator model, the time-frequency discriminator model and the self-correlation discriminator model, and inputting the time series data and the synthesized time series data into the time domain discriminator model to obtain the time domain discrimination result, and / or inputting the frequency domain feature data and the synthesized frequency domain feature data into the frequency domain discriminator model to obtain the frequency domain discrimination result, and / or inputting the time domain frequency domain splicing feature data and the synthesized time domain frequency domain splicing feature data into the time-frequency discriminator model to obtain the time-frequency discrimination result, and / or inputting the self-correlation feature data and the synthesized self-correlation feature data into the self-correlation discriminator model to obtain the self-correlation discrimination result, and limiting the data discrimination result to include at least two of the time domain discrimination result, the frequency domain discrimination result, the time-frequency discrimination result and the self-correlation discrimination result, it can be ensured that the time domain discrimination result can reflect whether the synthesized time series data is similar to the real time series data in at least two aspects, thereby improving the accuracy of the time domain discrimination result.
[0111] In one implementation manner of the present disclosure, the model training method can specifically include the following steps:
[0112] Obtaining time series data x, and obtaining random noise data based on a random function, inputting the random noise data into the time series data generation model to generate synthesized time series data
[0113] Obtaining frequency domain feature data corresponding to the time series data x, time domain frequency domain splicing feature data corresponding to the time series data x, self-correlation feature data corresponding to the time series data x, synthesized time series data corresponding synthesized frequency domain feature data, synthesized time series data corresponding synthesized time domain frequency domain splicing feature data, synthesized time series data corresponding synthesized self-correlation feature data;
[0114] Inputting the time series data x into the time domain discriminator model to obtain a time domain discrimination result D t (x), and inputting the synthesized time series data into the time domain discriminator model to obtain a synthesized time domain discrimination result and calculating a loss function of the time domain discriminator model according to the following formula
[0115]
[0116] wherein BCE represents a binary cross entropy (BCE) calculation on data.
[0117] inputting the frequency domain feature data into the frequency domain discriminator model to obtain a frequency domain discrimination result D F inputting the synthesized frequency domain feature data into the frequency domain discriminator model to obtain a synthesized frequency domain discrimination result and calculating a loss function of the frequency domain discriminator model according to the following formula
[0118]
[0119] inputting the time domain frequency domain splicing feature data into the time frequency discriminator model to obtain a time frequency discrimination result D TF inputting the synthesized time domain frequency domain splicing feature data into the time frequency discriminator model to obtain a synthesized time frequency discrimination result and calculating a loss function of the time frequency discriminator model according to the following formula
[0120]
[0121] inputting the autocorrelation feature data into the autocorrelation discriminator model to obtain an autocorrelation discrimination result D AC inputting the synthesized autocorrelation feature data into the autocorrelation discriminator model to obtain a synthesized autocorrelation discrimination result and calculating a loss function of the autocorrelation discriminator according to the following formula
[0122] calculating a data discrimination result L according to the following formula D :
[0123]
[0124] according to L D , calculating a gradient update vector of the time series data discrimination model based on an Adam algorithm, and updating parameters of the time series data discrimination model according to the gradient update vector;
[0125] again obtaining time series data x, and again obtaining random noise data based on a random function, inputting the again obtained random noise data into the time series data generation model to again generate synthesized time series data
[0126] based on the above similar steps, obtaining a synthesized time domain discrimination result a synthesized frequency domain discrimination result synthetic time-frequency discrimination result synthetic autocorrelation discrimination result
[0127] The loss function L of the time series data generation model is calculated according to the following formula G :
[0128]
[0129] According to L G , the gradient update vector of the time series data generation model is calculated based on the Adam algorithm, and the parameters of the time series data generation model are updated according to the gradient update vector.
[0130] The above steps can be understood as a round of training of the time series data discrimination model and the time series data generation model;
[0131] In response to the data discrimination result output by the time series data discrimination model after at least one round of training satisfying the synthetic time series data indistinguishable condition, the time series data generation model after at least one round of training is determined as the target time series data generation model.
[0132] Figure 2 A flowchart of a data discrimination method according to an embodiment of the present disclosure is shown, as Figure 2 shown, the method comprises steps S201-S204.
[0133] In step S201, sample time series data is obtained.
[0134] In step S202, the sample time series data is processed to obtain sample time series feature data.
[0135] The sample time series feature data includes at least two of the sample time series data, the sample frequency domain feature data corresponding to the sample time series data, the sample time domain frequency domain splicing feature data corresponding to the sample time series data, and the sample autocorrelation feature data corresponding to the sample time series data.
[0136] In step S203, the sample time series data is input into the time domain discriminator model to obtain a sample time domain discrimination result; and / or, the sample frequency domain feature data is input into the frequency domain discriminator model to obtain a sample frequency domain discrimination result; and / or, the sample time domain frequency domain splicing feature data is input into the time-frequency discriminator model to obtain a sample time-frequency discrimination result; and / or, the sample autocorrelation feature data is input into the autocorrelation discriminator model to obtain a sample autocorrelation discrimination result.
[0137] In step S204, the sampling data discrimination result is obtained according to at least two of the sampling time domain discrimination result, the sampling frequency domain discrimination result, the sampling time-frequency discrimination result, and the sampling autocorrelation discrimination result.
[0138] The sampling data discrimination result is used to indicate the authenticity of the sampling time series data.
[0139] In an embodiment of the present disclosure, the sampling time series data can be understood as real data continuously generated at a certain time interval. For example, the sampling time series data can be voice call data, or data collected by a sensor, such as a sensor on a medical device, a sensor on a meteorological or geographic information detection device, etc. The present disclosure does not limit the specific type of sampling time series data.
[0140] In an embodiment of the present disclosure, the collected sampling time series data can be normalized, divided into a plurality of sampling time series data sequences of the same length, and divided into a plurality of sampling time series data groups, each of which includes a target number of sampling time series data sequences. At least one sampling time series data group is randomly selected from the plurality of sampling time series data groups as the sampling time series data obtained in step S101.
[0141] In an embodiment of the present disclosure, the time series data discrimination model can be composed of a recurrent neural network (RNN) and a fully connected network, or can be a neural network model or a convolutional neural network model, etc. The present disclosure does not limit the specific implementation of the time series data discrimination model.
[0142] In an embodiment of the present disclosure, the data discrimination result can be understood as a data discrimination result corresponding to the sampling time series data, wherein each data discrimination result is used to indicate whether the corresponding data is synthesized or real. For example, the data discrimination result can be a vector, and the value range of the vector is (0, 1). If the value of the data discrimination result is closer to 1, the corresponding data is more likely to be real. If the value of the data discrimination result is closer to 0, the corresponding data is more likely to be synthesized.
[0143] In one implementation of the present disclosure, the frequency domain feature data corresponding to the sampled time series data can be understood as indicating the characteristics of the sampled time series data in the frequency domain; the time domain and frequency domain splicing feature data corresponding to the sampled time series data can be understood as being spliced from the sampled time series data and the frequency domain feature data, and indicating the characteristics of the sampled time series data in both the time domain and the frequency domain; and the autocorrelation feature data corresponding to the sampled time series data can be understood as indicating the repetitive pattern of the sampled time series data, such as a periodic signal hidden by noise.
[0144] In one implementation of the present disclosure, the Fourier transform can be performed on the sampled time series data to obtain the frequency domain feature data.
[0145] For example, the Fourier transform can be performed on the sampled time series data according to the following formula to obtain the frequency domain feature data F(w):
[0146]
[0147] wherein t is time, w is the frequency of the sampled time series data, f(t) is the sampled time series data, and e is the natural constant.
[0148] In one implementation of the present disclosure, the sampled time series data and the frequency domain feature data can be spliced to obtain the time domain and frequency domain splicing feature data.
[0149] In one implementation of the present disclosure, the sampled time series data can be processed based on the autocorrelation function to obtain the autocorrelation feature data.
[0150] For example, the sampled time series data can be processed based on the autocorrelation function to obtain the autocorrelation feature data, which can be the autocorrelation function (ACF) of the sampled time series data. Specifically, the autocorrelation function R(τ) of the sampled time series data can be calculated according to the following formula:
[0151]
[0152] wherein f(t) is the sampled time series data, and f(t+τ) is the sampled time series data with a time interval τ from f(t).
[0153] In the scheme of the embodiments of the present disclosure, the sampling time sequence data is acquired, and the sampling time sequence data is processed to acquire sampling time sequence feature data. The sampling time sequence data is input into a time domain discriminator model to acquire a sampling time domain discrimination result. The sampling frequency domain feature data is input into a frequency domain discriminator model to acquire a sampling frequency domain discrimination result. The sampling time domain frequency domain splicing feature data is input into a time frequency discriminator model to acquire a sampling time frequency discrimination result. The sampling autocorrelation feature data is input into an autocorrelation discriminator model to acquire a sampling autocorrelation discrimination result. The sampling data discrimination result is acquired according to at least two of the sampling time domain discrimination result, the sampling frequency domain discrimination result, the sampling time frequency discrimination result, and the sampling autocorrelation discrimination result. Since the sampling data discrimination result used to indicate the authenticity of the sampling time sequence data is acquired according to at least two of the sampling time domain discrimination result, the sampling frequency domain discrimination result, the sampling time frequency discrimination result, and the sampling autocorrelation discrimination result, at least two different aspects of the sampling time sequence data are considered in the process of acquiring the sampling data discrimination result, thereby improving the accuracy of the sampling data discrimination result.
[0154] The present disclosure also discloses an electronic device, Figure 3 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown.
[0155] As Figure 3 shown, the electronic device 100 includes a memory 101 and a processor 102, wherein the memory 101 is configured to store one or more computer instructions, and the one or more computer instructions are executed by the processor 102 to implement the following method steps:
[0156] In a first aspect, the embodiments of the present disclosure provide a model training method, which comprises:
[0157] Acquiring time sequence data;
[0158] Generating synthetic time sequence data by a time sequence data generation model;
[0159] Processing the time sequence data to acquire time sequence feature data, and processing the synthetic time sequence data to acquire synthetic time sequence feature data;
[0160] Inputting the time sequence feature data and the synthetic time sequence feature data into a time sequence data discrimination model to acquire a data discrimination result, the data discrimination result being used to indicate the similarity between the time sequence data and the synthetic time sequence data;
[0161] Based on the data discrimination result, the time sequence data generation model and the time sequence data discrimination model are trained in an adversarial training manner;
[0162] In response to the data discrimination result output by the at least one trained time series data discrimination model satisfying the undiscriminated condition of the synthetic time series data, the at least one trained time series data generation model is determined as a target time series data generation model.
[0163] In one implementation of the present disclosure, the time series feature data includes at least two of the time series data, the frequency domain feature data corresponding to the time series data, the time domain and frequency domain splicing feature data corresponding to the time series data, and the autocorrelation feature data corresponding to the time series data.
[0164] The synthetic time series feature data includes at least two of the synthetic time series data, the synthetic frequency domain feature data corresponding to the synthetic time series data, the synthetic time domain and frequency domain splicing feature data corresponding to the synthetic time series data, and the synthetic autocorrelation feature data corresponding to the synthetic time series data.
[0165] In one implementation of the present disclosure, the time series data is processed to obtain time series feature data, including:
[0166] The time series data is subjected to Fourier transform to obtain frequency domain feature data;
[0167] The synthetic time series data is subjected to Fourier transform to obtain synthetic frequency domain feature data.
[0168] In one implementation of the present disclosure, the time series data is processed to obtain time series feature data, further including:
[0169] The time series data and the frequency domain feature data are spliced to obtain time domain and frequency domain splicing feature data;
[0170] The synthetic time series data and the synthetic frequency domain feature data are spliced to obtain synthetic time domain and frequency domain splicing feature data.
[0171] In one implementation of the present disclosure, the time series data is processed to obtain time series feature data, including:
[0172] The time series data is processed based on an autocorrelation function to obtain autocorrelation feature data;
[0173] The synthetic time series data is processed based on an autocorrelation function to obtain synthetic autocorrelation feature data.
[0174] In one implementation of the present disclosure, the time series data discrimination model includes a time domain discriminator model, a frequency domain discriminator model, a time-frequency discriminator model, and an autocorrelation discriminator model.
[0175] input the time series feature data and the synthesized time series feature data into the time series data discrimination model to obtain a data discrimination result, including:
[0176] input the time series data and the synthesized time series data into the time domain discriminator model to obtain a time domain discrimination result;
[0177] and / or, input the frequency domain feature data and the synthesized frequency domain feature data into the frequency domain discriminator model to obtain a frequency domain discrimination result;
[0178] and / or, input the time domain frequency domain splicing feature data and the synthesized time domain frequency domain splicing feature data into the time frequency discriminator model to obtain a time frequency discrimination result;
[0179] and / or, input the autocorrelation feature data and the synthesized autocorrelation feature data into the autocorrelation discriminator model to obtain an autocorrelation discrimination result;
[0180] The data discrimination result includes at least two of the time domain discrimination result, the frequency domain discrimination result, the time frequency discrimination result, and the autocorrelation discrimination result.
[0181] In a second aspect, the disclosure provides a data discrimination method, including:
[0182] obtaining sampled time series data;
[0183] processing the sampled time series data to obtain sampled time series feature data, the sampled time series feature data including at least two of the sampled time series data, sampled frequency domain feature data corresponding to the sampled time series data, sampled time domain frequency domain splicing feature data corresponding to the sampled time series data, and sampled autocorrelation feature data corresponding to the sampled time series data;
[0184] input the sampled time series data into the time domain discriminator model to obtain a sampled time domain discrimination result;
[0185] and / or, input the sampled frequency domain feature data into the frequency domain discriminator model to obtain a sampled frequency domain discrimination result;
[0186] and / or, input the sampled time domain frequency domain splicing feature data into the time frequency discriminator model to obtain a sampled time frequency discrimination result;
[0187] and / or, input the sampled autocorrelation feature data into the autocorrelation discriminator model to obtain a sampled autocorrelation discrimination result;
[0188] obtain a sampled data discrimination result according to at least two of the sampled time domain discrimination result, the sampled frequency domain discrimination result, the sampled time frequency discrimination result, and the sampled autocorrelation discrimination result, the sampled data discrimination result being used to indicate the authenticity of the sampled time series data.
[0189] Figure 4 A structural diagram showing a computer system suitable for use in implementing the federated edge learning configuration information acquisition according to embodiments of the present disclosure is shown.
[0190] As shown in Figure 4 , the computer system 200 includes a processing unit 201 which can execute various methods in the above-described embodiments according to programs stored in a read-only memory (ROM) 202 or loaded into a random access memory (RAM) 203 from a storage section 208. Various programs and data required for the operation of the system 200 are also stored in the RAM 203. The processing unit 201, the ROM 202, and the RAM 203 are connected to each other through a bus 204. An input / output (I / O) interface 205 is also connected to the bus 204.
[0191] The following components are connected to the I / O interface 205: an input section 206 including a keyboard, a mouse, etc.; an output section 207 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 208 including a hard disk, etc.; and a communication section 209 including a network interface card such as a LAN card, a modem, etc. The communication section 209 performs communication processes via a network such as the Internet. A drive 210 is also connected to the I / O interface 205 as necessary. A removable recording medium 211 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 210 as necessary, so that a computer program read therefrom is installed into the storage section 208 as necessary. The processing unit 201 can be implemented as a CPU, a GPU, a TPU, a FPGA, a NPU, etc.
[0192] In particular, the methods described above can be implemented as a computer software program according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program containing program code for executing the methods described above. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 209 and / or installed from the removable recording medium 211.
[0193] The flow and block diagrams in the drawings represent possible architectural, functional, and operational architectures of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block can represent a module, a segment, or a portion of code that comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flowchart illustrations, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or combinations of special purpose hardware and computer instructions.
[0194] The units or modules described in the embodiments of the present disclosure can be implemented by software, or by programmable hardware. The described units or modules can also be arranged in a processor, and the names of the units or modules do not constitute a limitation on the units or modules themselves in some cases.
[0195] As another aspect, the present disclosure also provides a computer readable storage medium, which can be the computer readable storage medium included in the electronic device or the computer system in the above embodiments, or can exist separately from the device and not be assembled into the device. The computer readable storage medium stores one or more programs for execution by one or more processors to perform the methods described in the present disclosure.
[0196] The above description is merely preferred embodiments of the present disclosure and a description of principles of applied technologies. It should be understood by those skilled in the art that the scope of the present disclosure is not limited to the technical solutions formed by the specific combinations of the above technical features, and also includes other technical solutions formed by the combinations of the above technical features or equivalent features without departing from the inventive concept. For example, the above technical features can be replaced with the technical features disclosed in the present disclosure (but not limited to) having similar functions to form technical solutions.
Claims
1. A model training method, characterized in that, The method comprises: obtaining time series data; generating synthetic time series data through a time series data generation model; processing the time series data to obtain time series feature data, and processing the synthetic time series data to obtain synthetic time series feature data; inputting the time series feature data and the synthetic time series feature data into the time series data discrimination model to obtain a data discrimination result, the data discrimination result being used to indicate the similarity between the time series data and the synthetic time series data; training the time series data generation model and the time series data discrimination model through an adversarial training manner based on the data discrimination result; in response to the data discrimination result output by the time series data discrimination model after at least one round of training satisfying a synthetic time series data undiscrimination condition, determining the time series data generation model after the at least one round of training as a target time series data generation model; the time series feature data comprises the time series data, frequency domain feature data corresponding to the time series data, time domain frequency domain splicing feature data corresponding to the time series data, and autocorrelation feature data corresponding to the time series data; the synthetic time series feature data comprises the synthetic time series data, synthetic frequency domain feature data corresponding to the synthetic time series data, synthetic time domain frequency domain splicing feature data corresponding to the synthetic time series data, and synthetic autocorrelation feature data corresponding to the synthetic time series data; the time series data discrimination model comprises a time domain discriminator model, a frequency domain discriminator model, a time frequency discriminator model, and an autocorrelation discriminator model; and the inputting of the time series feature data and the synthetic time series feature data into the time series data discrimination model to obtain the data discrimination result comprises: inputting the time series data and the synthetic time series data into the time domain discriminator model to obtain a time domain discrimination result; inputting the frequency domain feature data and the synthetic frequency domain feature data into the frequency domain discriminator model to obtain a frequency domain discrimination result; inputting the time domain frequency domain splicing feature data and the synthetic time domain frequency domain splicing feature data into the time frequency discriminator model to obtain a time frequency discrimination result; inputting the autocorrelation feature data and the synthetic autocorrelation feature data into the autocorrelation discriminator model to obtain an autocorrelation discrimination result; the data discrimination result comprises at least two of the time domain discrimination result, the frequency domain discrimination result, the time frequency discrimination result, and the autocorrelation discrimination result.
2. The model training method of claim 1, wherein, the processing of the time series data to obtain the time series feature data comprises: performing Fourier transform on the time series data to obtain the frequency domain feature data; performing Fourier transform on the synthetic time series data to obtain the synthetic frequency domain feature data.
3. The model training method of claim 2, wherein, the processing of the time series data to obtain the time series feature data further comprises: splicing the time series data and the frequency domain feature data to obtain the time domain frequency domain splicing feature data; splicing the synthetic time series data and the synthetic frequency domain feature data to obtain the synthetic time domain frequency domain splicing feature data.
4. The model training method of claim 1, wherein, The time series data is processed to obtain time series feature data, including: The time series data is processed based on the autocorrelation function to obtain autocorrelation feature data; The time series data is processed based on the autocorrelation function to obtain autocorrelation feature data.
5. A data authentication method characterized by, The method comprises: Obtaining sampling time series data; Processing the sampling time series data to obtain sampling time series feature data, the sampling time series feature data comprising at least two of the sampling time series data, sampling frequency domain feature data corresponding to the sampling time series data, sampling time domain frequency domain splicing feature data corresponding to the sampling time series data, and sampling autocorrelation feature data corresponding to the sampling time series data; Inputting the sampling time series data into a time domain discriminator model to obtain a sampling time domain discrimination result; Inputting the sampling frequency domain feature data into a frequency domain discriminator model to obtain a sampling frequency domain discrimination result; Inputting the sampling time domain frequency domain splicing feature data into a time frequency discriminator model to obtain a sampling time frequency discrimination result; Inputting the sampling autocorrelation feature data into an autocorrelation discriminator model to obtain a sampling autocorrelation discrimination result; Obtaining a sampling data discrimination result according to the sampling time domain discrimination result, the sampling frequency domain discrimination result, the sampling time frequency discrimination result, and the sampling autocorrelation discrimination result, the sampling data discrimination result being used to indicate the authenticity of the sampling time series data.
6. An electronic device, comprising: The memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method of any one of claims 1-4.
7. A readable storage medium, having stored thereon computer instructions, characterized in that, The computer instructions are executed by the processor to implement the method of any one of claims 1-4.
8. A computer program product comprising computer instructions which, when executed by a processor, implement the method steps of any one of claims 1-4.
Citation Information
Patent Citations
A method for generating time series based on generating antagonistic network
CN109376862A
Time sequence prediction method and device, equipment and storage medium
CN113344129A