WO2024104276A1 - Time series perdition optimization method, device, and storage medium - Google Patents

Time series perdition optimization method, device, and storage medium Download PDF

Info

Publication number
WO2024104276A1
WO2024104276A1 PCT/CN2023/131132 CN2023131132W WO2024104276A1 WO 2024104276 A1 WO2024104276 A1 WO 2024104276A1 CN 2023131132 W CN2023131132 W CN 2023131132W WO 2024104276 A1 WO2024104276 A1 WO 2024104276A1
Authority
WO
WIPO (PCT)
Prior art keywords
sequence
time
prediction
loss function
feature
Prior art date
Application number
PCT/CN2023/131132
Other languages
French (fr)
Chinese (zh)
Inventor
谢娟
Original Assignee
杭州阿里云飞天信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 杭州阿里云飞天信息技术有限公司 filed Critical 杭州阿里云飞天信息技术有限公司
Publication of WO2024104276A1 publication Critical patent/WO2024104276A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • the present application relates to the field of data processing technology, and in particular to a time series prediction optimization method, device and storage medium.
  • Time series forecasting is widely used in industries such as industry, agriculture, water services, and finance.
  • Existing time series forecasting solutions have increasingly used neural network models such as deep learning and machine learning.
  • these models usually use the mean absolute error (MAE) constructed based on the predicted results and the actual measurement results as the loss function.
  • MAE mean absolute error
  • Multiple aspects of the present application provide a time series prediction optimization method, device and storage medium to optimize the prediction performance of a time series prediction model.
  • the present application provides a time series prediction optimization method, including:
  • the feature conversion module and the prediction module are jointly tuned to update relevant model parameters in the time series prediction model.
  • the present application also provides a time series prediction optimization method, including:
  • the prediction module uses an evaluation index based on dynamic time warping (DTW) as a loss function.
  • DTW dynamic time warping
  • the embodiment of the present application also provides a computing device, including a memory and a processor;
  • the memory is used to store one or more computer instructions
  • the processor is coupled to the memory and is used to execute the one or more computer instructions to execute the aforementioned timing prediction optimization method.
  • An embodiment of the present application also provides a computer-readable storage medium storing computer instructions.
  • the computer instructions are executed by one or more processors, the one or more processors are caused to execute the aforementioned timing prediction optimization method.
  • the feature conversion module can be used to convert the received feature sequence into a converted sequence carrying time-varying features and time-invariant features, and the converted sequence output by the module will be used as the input of the prediction module.
  • the prediction module can be used to perform time series prediction and generate a prediction sequence. In this way, the time-invariant feature can be introduced into the time series prediction process as an important influencing factor through the feature conversion module.
  • the volatility evaluation index for the time-invariant feature as the first loss function corresponding to the feature conversion module, and the evaluation index of the prediction sequence based on dynamic time warping DTW as the second loss function corresponding to the prediction module, and the time series prediction model is tuned based on at least these two loss functions.
  • FIG1 is a flow chart of a timing prediction optimization method provided by an exemplary embodiment of the present application.
  • FIG2 is a schematic diagram of the logical structure of a time series prediction model provided by an exemplary embodiment of the present application.
  • FIG3 is a schematic diagram of an optional implementation of a feature conversion module provided by an exemplary embodiment of the present application.
  • FIG4 is a flow chart of another timing prediction optimization method provided by an exemplary embodiment of the present application.
  • FIG5 is a schematic diagram of the structure of a computing device provided by another exemplary embodiment of the present application.
  • the performance of the time series prediction model is poor, and the accuracy of the prediction results is insufficient.
  • the feature conversion module can be used to convert the received feature sequence into a converted sequence carrying time-varying features and time-invariant features, and the converted sequence output by it will be used as the input of the prediction module, and the prediction module can be used to perform time series prediction and generate a prediction sequence.
  • the time-invariant feature can be introduced into the time series prediction process as an important influencing factor through the feature conversion module.
  • the volatility evaluation index for the time-invariant feature as the first loss function corresponding to the feature conversion module, and the evaluation index of the prediction sequence based on dynamic time warping DTW as the second loss function corresponding to the prediction module, and the time series prediction model is tuned based on at least these two loss functions.
  • FIG1 is a flow chart of a method for optimizing time series prediction provided by an exemplary embodiment of the present application.
  • the method may be executed by a data processing device, which may be implemented as a combination of software and/or hardware, and may be integrated in a computing device.
  • the method may include:
  • Step 100 Input the sample feature sequence into a feature conversion module constructed in the time series prediction model, where the feature conversion module is used to convert the received sequence into a converted sequence carrying time-varying features and time-invariant features;
  • Step 101 input the converted sequence into a prediction module constructed in a time series prediction model, the prediction module is used to perform time series prediction based on the time-varying features and time-invariant features carried by the converted sequence to generate a prediction sequence;
  • Step 102 Calculate an evaluation index for volatility for the time-invariant feature corresponding to the sample feature sequence to determine a first loss function value corresponding to the feature conversion module;
  • Step 103 Calculate an evaluation index based on dynamic time warping (DTW) for the prediction sequence to determine a second loss function value corresponding to the prediction module;
  • DTW dynamic time warping
  • Step 104 Based on the first loss function value and the second loss function value, jointly tune the feature conversion module and the prediction module to update relevant model parameters in the time series prediction model.
  • time series prediction optimization method can be applied to various scenarios that require time series prediction, such as water conservancy, digital agriculture and other scenarios.
  • This embodiment does not limit the application scenarios.
  • the feature sequence used as the basis for prediction may have different contents, and the final prediction sequence may also have different contents.
  • the sequence content can be adaptively set according to the needs of the scenario, and this embodiment does not limit this.
  • time series prediction can be understood as using historical time series to predict future time series. For example, the temperature forecast of the past 12 hours can be used to predict the temperature series of the next 6 hours.
  • FIG2 is a schematic diagram of the logical structure of a time series prediction model provided by an exemplary embodiment of the present application.
  • the time series prediction module may include a feature conversion module and a prediction module.
  • both the feature conversion module and the prediction module may adopt various feasible neural network learning models, such as RNN, CNN, Transformer, etc.
  • RNN neural network learning models
  • the feature conversion module and the prediction module may adopt various feasible neural network learning models, such as RNN, CNN, Transformer, etc.
  • the conversion module and the prediction module are connected in series, that is, the output result of the feature conversion module will be used as the input of the prediction module.
  • the feature conversion module can be used to convert the received feature sequence into a converted sequence carrying time-varying features and time-invariant features
  • the prediction module can be used to perform time series prediction based on the received converted sequence to generate a predicted sequence. That is, the input of the feature conversion module may include the historical feature sequence, and the output includes the converted sequence; and the input of the prediction module may include the converted sequence provided by the feature conversion module, and the output may include the predicted sequence.
  • the time series prediction logic in the prediction module can adopt single-step time series prediction logic or multi-step time series prediction logic, which is not limited in this embodiment.
  • the time-varying features mentioned above refer to features that change with time
  • the time-invariant features are features that do not change with time.
  • the sample feature sequence can be input into the feature conversion module constructed in the time series prediction model.
  • the feature conversion module can convert the feature sequence it receives into a converted sequence. Therefore, in step 100 , the feature conversion sequence can be used to output the converted sequence corresponding to the sample feature sequence.
  • the sample feature sequence refers to the historical feature sequence used as the basis for prediction.
  • the sample feature sequence is usually associated with a corresponding sample future sequence.
  • the sample future sequence is usually a real sequence corresponding to the predicted sequence generated after the time series prediction based on the sample feature sequence. That is, the sample future sequence is usually a real collection value, and similarly, the sample feature sequence is usually a real collection value.
  • the time series prediction module can generate a predicted sequence based on the sample feature sequence, and the real sequence associated with the sample feature sequence can be used to evaluate the accuracy of the predicted sequence, thereby guiding the tuning of the time series prediction model.
  • FIG3 is a schematic diagram of an optional implementation of a feature conversion module provided by an exemplary embodiment of the present application.
  • the feature conversion module may adopt an encoding-decoding model
  • the processing logic of the feature conversion module may be:
  • the encoding unit in the feature conversion module is used to map the sample feature sequence to the time-invariant space and the time-varying space, so as to respectively extract the time-varying features and the time-invariant features corresponding to the sample feature sequence;
  • the fused sequence is decoded using the decoding unit in the feature conversion module to generate a converted sequence.
  • Y_label[tn:t-1] may represent a sample feature sequence
  • u[tk:t-1] represents the dimension of a single time-varying feature
  • s[tk:t-1] represents the dimension of a single time-invariant feature.
  • each sample element in Y_label[tn:t-1] may generate a time-varying feature u and a time-invariant feature s.
  • ht may represent a fused sequence generated by reconstructing the time-varying feature and the time-invariant feature.
  • the encoding unit may also first standardize the sample feature sequence, and then map the standardized sample feature sequence to the time-invariant space and the time-varying space.
  • the sample feature sequence may be standardized to [-1, 1].
  • this embodiment does not limit the range used in the standardization link.
  • the decoded sequence may be de-standardized to generate a converted sequence.
  • the standardization link can effectively reduce the amount of calculation inside the feature conversion model.
  • the time-invariant features include the autocorrelation information between the elements in the feature sequence and other information that does not change with time.
  • the time-invariant features such as the autocorrelation information of the historical feature sequence can be introduced into the time series prediction process.
  • the subsequent prediction module can smoothly capture the time-invariant features in the historical feature sequence, thereby more accurately predicting the time series.
  • the converted sequence can be input into the prediction module constructed in the time series prediction model.
  • the prediction module can be used to generate a prediction sequence by performing time series prediction based on the time-varying features and time-invariant features carried by the converted sequence.
  • the input of the prediction module may also include other contents besides the converted sequence provided by the feature conversion module, for example, multimodal data that affects the variables in the sample feature sequence.
  • the sample feature sequence may be a temperature sequence
  • the input of the prediction module may include, in addition to the converted sequence corresponding to the temperature sequence, weather data, seasonal data, geographic location data, human data and other multimodal data that affect the temperature, which can also serve as the basis for time series prediction. That is, this embodiment does not limit other inputs of the prediction module, and it can be accessed on demand according to the needs of the application scenario.
  • step 101 a prediction sequence corresponding to the sample feature sequence can be generated.
  • step 102 an evaluation index for volatility can be calculated for the time-invariant feature corresponding to the sample feature sequence to determine the first loss function value corresponding to the feature conversion module.
  • step 103 an evaluation index based on dynamic time warping DTW can be calculated for the prediction sequence to determine the second loss function value corresponding to the prediction module.
  • a first loss function can be configured for the feature conversion module, and the first loss function can adopt a volatility evaluation index for time-invariant features;
  • a second loss function can also be configured for the prediction module, and the second loss function can adopt an evaluation index for the prediction sequence based on dynamic time warping DTW.
  • the mean square error of the time-invariant features extracted by the feature conversion module can be used as an evaluation index for volatility, and a first loss function is also generated.
  • the first loss function can be characterized as:
  • s(t-i) and s(t-i-1) are the time-invariant features corresponding to any two adjacent ones of the sample feature sequence
  • K is the number of time-invariant features, which is usually consistent with the sequence length of the sample feature sequence.
  • the shape deviation and time of the predicted dynamic time warping may be calculated for the predicted sequence.
  • the time deviation is used to construct the second loss function.
  • L shape represents the shape deviation
  • L tdi represents the time deviation
  • the knowledge related to the dynamic time warping DTW technology can be found in the existing and future public information.
  • the two processing objects of the dynamic time warping DTW are limited to the prediction queue and its corresponding real queue, and the specific dynamic time warping logic can be found in the records in the relevant materials, which will not be explained in detail here.
  • This embodiment does not change the DTW technology itself.
  • the process of calculating the evaluation index based on dynamic time warping DTW for the prediction sequence to determine the second loss function value corresponding to the prediction module may be:
  • a second loss function value is determined based on the shape deviation and the time deviation.
  • a shape deviation calculation scheme may be: for each element in the predicted sequence, determine the corresponding matching element in the real sequence after dynamic time warping; for each element in the predicted sequence, calculate the distance between it and the corresponding matching element; calculate the square root of the sum of the distances as the shape deviation.
  • the shape deviation can be characterized as:
  • is the shortest path after dynamic time warping
  • Y pred[i] is the value of the i-th element in the sample feature sequence
  • Y label[j] is the value of the j-th element in the corresponding true sequence
  • i and j are aligned.
  • the shape deviation can also be converted into log-sum-exp.
  • a time deviation calculation scheme may be: for each element in the predicted sequence, determine the corresponding matching element in the real sequence after dynamic time warping; for each element in the predicted sequence, calculate the time difference between it and the corresponding matching element; calculate the mean square sum of the time differences as the time deviation.
  • the time deviation can be characterized as:
  • is the shortest path after dynamic time warping
  • i is the time corresponding to the i-th element in the predicted sequence
  • j is the time corresponding to the j-th element in the corresponding real sequence
  • i and j are aligned.
  • the time deviation can also be converted into log-sum-exp mathematically
  • the feature conversion module and the prediction module may be jointly tuned based on the first loss function value and the second loss function value to update relevant model parameters in the time series prediction model.
  • the feature conversion module can optimize the extraction performance of the time-invariant features, so that the fluctuation of the time-invariant features extracted by the feature conversion module is more stable, thereby capturing the time-invariant features more accurately.
  • the prediction module can fully consider the deviations in the prediction of time series regularity during the time series prediction process, especially the lag or deviation that may exist in the case of time series mutation, so as to make time series prediction more accurate.
  • a typical loss function can be the mean absolute error MAE.
  • a third loss function can also be configured for the prediction module.
  • the third loss function uses the mean absolute error MAE for the prediction sequence.
  • the third loss function can be characterized as:
  • Y pred[i] represents the i-th element value in the predicted sequence
  • Y label[i] represents the i-th element value in the corresponding true sequence
  • n is the length of the predicted sequence
  • the three loss functions mentioned above can be combined to generate a hybrid loss function.
  • a hybrid loss function can be used to jointly tune the feature conversion module and the prediction module in the time series prediction model to jointly optimize the performance of the feature conversion module and the prediction module.
  • the mean absolute error MAE between the predicted sequence corresponding to the sample feature sequence and the corresponding true sequence can be calculated to determine the third loss function value corresponding to the prediction module; the first loss function value, the second loss function value and the third loss function value are weighted and summed to jointly optimize the feature conversion module and the prediction module.
  • the gradient of the mixed loss function can also be automatically derived to determine the weight values corresponding to the first loss function, the second loss function, and the third loss function.
  • each weight parameter in the mixed loss function can be set as an adjustable weight parameter, the sum of which is less than 1, and is set as a differentiable function. In this way, the final weight value can be automatically found through the gradient automatic derivation technology.
  • these weight values in the mixed loss function can be fixed.
  • Ls can use an independent weight parameter, and its weight parameter can be set to 1 or other, and the weight coefficients of other loss functions can be combined for gradient automatic derivation.
  • this is only an exemplary method, and this embodiment does not limit this.
  • time series prediction model After the time series prediction model is trained, you can use the time series prediction model to provide time series prediction services.
  • a time series prediction request can also be received, and according to the time series prediction request, a historical feature sequence can be obtained; the historical feature sequence is input into the feature conversion module in the time series prediction model, so as to use the feature conversion module to convert the historical feature sequence into a converted sequence carrying time-varying features and time-invariant features; the converted sequence corresponding to the historical feature sequence is input into the prediction module, so as to use the prediction module to perform time series prediction, and generate a prediction sequence corresponding to the historical feature sequence.
  • the historical feature sequence can be directly carried in the time series prediction request, and of course, it can also be obtained from other channels.
  • the feature conversion sequence can accurately extract time-varying features and time-invariant features from the historical sample sequence, and these features are brought into the prediction module through the converted sequence.
  • the prediction module can fully capture the influence of the time-invariant features and the relevant indicators of the dynamic time rule DTW on the prediction results, so as to more accurately perform time series prediction, and the output prediction sequence has higher accuracy.
  • the feature conversion module can be used to convert the received feature sequence into a converted sequence carrying time-varying features and time-invariant features, and the converted sequence output by it will be used as the input of the prediction module.
  • the prediction module can be used to perform time series prediction and generate a prediction sequence. In this way, the time-invariant feature can be introduced into the time series prediction process as an important influencing factor through the feature conversion module.
  • the volatility evaluation index for the time-invariant feature as the first loss function corresponding to the feature conversion module, and the evaluation index of the prediction sequence based on dynamic time warping DTW as the second loss function corresponding to the prediction module, and the time series prediction model is tuned based on at least these two loss functions.
  • FIG4 is a flow chart of another timing prediction optimization method provided by an exemplary embodiment of the present application. Referring to FIG4 , the method may include:
  • Step 400 receiving a timing prediction request
  • Step 401 obtaining a historical feature sequence according to a time series prediction request
  • Step 402 input the historical feature sequence into a feature conversion module in the time series prediction model, so as to generate a converted sequence for the historical feature sequence using the feature conversion module, wherein the feature conversion module is used to extract time-varying features and time-invariant features from the received sequence to generate a converted sequence;
  • Step 403 input the converted sequence corresponding to the historical feature sequence into the prediction module, so as to use the prediction module to perform time series prediction and generate a prediction sequence corresponding to the historical feature sequence;
  • the prediction module uses the evaluation index based on dynamic time warping DTW as the loss function.
  • a time series prediction model which includes a feature conversion module and a prediction module.
  • the functions of the block are as above.
  • the feature conversion module can fully capture the time-varying features and time-invariant features in the historical feature sequence, and bring them into the prediction module through the converted sequence. In this way, the time-varying features in the historical feature sequence can be used as the influencing factors of time series prediction, which can effectively improve the accuracy of time series prediction.
  • the prediction module also uses an evaluation index based on dynamic time rules as a loss function, which allows the time series prediction process of the prediction module to fully consider the time regularity deviation as another important influencing factor. Especially for the prediction work under the condition of time series mutation, it can effectively improve the prediction accuracy.
  • this embodiment only has requirements for the structure and module functions of the time series prediction model, and does not limit the specific training process.
  • the time series prediction model in this embodiment can be tuned using the training scheme provided in the relevant embodiment of Figure 1, but it should be understood that this embodiment is not limited to this, and any training scheme that can ensure the model structure and module functions required by this embodiment can be used.
  • model training scheme please refer to the exemplary scheme provided in the relevant embodiment of Figure 1, which will not be described here in order to save space.
  • Fig. 5 is a schematic diagram of a computing device provided by another exemplary embodiment of the present application. As shown in Fig. 5 , the computing device includes: a memory 50 and a processor 51 .
  • the processor 51 is coupled to the memory 50 and is used to execute the computer program in the memory 50 to:
  • the feature conversion module Inputting the sample feature sequence into a feature conversion module constructed in the time series prediction model, the feature conversion module is used to convert the received sequence into a converted sequence carrying time-varying features and time-invariant features;
  • the converted sequence is input into a prediction module constructed in the time series prediction model, and the prediction module is used to perform time series prediction based on the time-varying features and time-invariant features carried by the converted sequence to generate a prediction sequence;
  • the feature conversion module and the prediction module are jointly tuned to update relevant model parameters in the time series prediction model.
  • the processor 51 in the process of calculating the evaluation index based on dynamic time warping (DTW) for the prediction sequence to determine the second loss function value corresponding to the prediction module, may be used to:
  • DTW dynamic time warping
  • a second loss function value is determined based on the shape deviation and the time deviation.
  • the processor 51 in the process of calculating the shape deviation between the predicted sequence and the true sequence after the dynamic time warping process, may be used to:
  • the square root of the sum of the distances is calculated as the shape deviation.
  • the processor 51 in the process of calculating the time deviation between the predicted sequence and the real sequence after the dynamic time warping process, may be used to:
  • the processor 51 jointly tunes the feature conversion module and the prediction module based on the first loss function value and the second loss function value, and the processor 51 may also be used to:
  • the first loss function value, the second loss function value, and the third loss function value are weightedly summed to jointly tune the feature conversion module and the prediction module.
  • the processor 51 may also be configured to:
  • the first loss function, the second loss function, and the third loss function are respectively configured with weight parameters and then combined to generate a mixed loss function
  • the gradient of the mixed loss function is automatically derived to determine the weight values corresponding to the first loss function, the second loss function, and the third loss function.
  • the feature conversion module adopts an encoding-decoding model
  • the processor 51 can also be used to:
  • the encoding unit in the feature conversion module is used to map the sample feature sequence to the time-invariant space and the time-varying space, so as to respectively extract the time-varying features and the time-invariant features corresponding to the sample feature sequence;
  • the fused sequence is decoded using the decoding unit in the feature conversion module to generate a converted sequence.
  • the processor 51 in the process of calculating the evaluation index for volatility for the time-invariant feature corresponding to the sample feature sequence, may be used to:
  • the mean square error of the time-invariant features corresponding to the sample feature sequence is calculated as an evaluation indicator for volatility.
  • the time-invariant features include autocorrelation information.
  • the processor 51 may also be used to:
  • the converted sequence corresponding to the historical feature sequence is input into the prediction module, so as to use the prediction module to perform time series prediction and generate a prediction sequence corresponding to the historical feature sequence.
  • the processor 51 in the computing device may also be used to execute the computer program in the memory 50 to:
  • the prediction module uses the evaluation index based on dynamic time warping DTW as the loss function.
  • the computing device also includes other components such as a communication component 52 and a power component 53.
  • Fig. 5 only schematically shows some components, which does not mean that the computing device only includes the components shown in Fig. 5.
  • an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed, can implement the steps that can be executed by a computing device in the above method embodiment.
  • the memory in FIG. 5 is used to store computer programs and can be configured to store various other data to support operations on the computing platform. Examples of such data include instructions for any application or method operating on the computing platform, contact data, phone book data, messages, pictures, videos, etc.
  • the memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EPROM erasable programmable read-only memory
  • PROM programmable read-only memory
  • ROM read-only memory
  • magnetic memory flash memory
  • flash memory magnetic disk or optical disk.
  • the communication component in FIG. 5 is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices.
  • the device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G/LTE, 5G and other mobile communication networks, or a combination thereof.
  • the communication component is connected to a wireless network via a broadband connection.
  • the broadcast channel receives a broadcast signal or broadcast related information from an external broadcast management system.
  • the communication component further includes a near field communication (NFC) module to facilitate short-range communication.
  • the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • the power supply assembly in Figure 5 provides power to various components of the device where the power supply assembly is located.
  • the power supply assembly may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply assembly is located.
  • the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
  • a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
  • These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
  • a computing device includes one or more processors (CPU), input/output interfaces, network interfaces, and memory.
  • processors CPU
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash memory
  • Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), Dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM Dynamic random access memory
  • RAM random access memory
  • ROM read-only memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Economics (AREA)
  • Human Resources & Organizations (AREA)
  • Strategic Management (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Molecular Biology (AREA)
  • Evolutionary Computation (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Data Mining & Analysis (AREA)
  • Development Economics (AREA)
  • Game Theory and Decision Science (AREA)
  • Operations Research (AREA)
  • Entrepreneurship & Innovation (AREA)
  • General Business, Economics & Management (AREA)
  • Marketing (AREA)
  • Tourism & Hospitality (AREA)
  • Quality & Reliability (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

Embodiments of the present application provide a time series prediction optimization method, a device, and a storage medium. A feature conversion module and a prediction module are constructed in a time series prediction model, and a time-invariant feature can be introduced into a time series prediction process by means of the feature conversion module to serve as an important influencing factor. In addition, it is also proposed that a volatility evaluation index for the time-invariant feature is used as a first loss function corresponding to the feature conversion module, an evaluation index of a prediction sequence based on dynamic time warping (DTW) is used as a second loss function corresponding to the prediction module, and tuning is performed on the time series prediction model at least based on the two loss functions. In this way, the extraction of the time-invariant feature is more accurate, and the DTW can be introduced into the time series prediction process by means of the second loss function to serve as another important influencing factor, thereby improving the accuracy of sudden change prediction. Therefore, the performance of the time sequence prediction model can be effectively optimized, and the prediction accuracy is improved.

Description

一种时序预测优化方法、设备及存储介质A time series prediction optimization method, device and storage medium
本申请要求于2022年11月17日提交中国专利局、申请号为202211441398.3、申请名称为“一种时序预测优化方法、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the China Patent Office on November 17, 2022, with application number 202211441398.3 and application name “A Timing Prediction Optimization Method, Device and Storage Medium”, all contents of which are incorporated by reference in this application.
技术领域Technical Field
本申请涉及数据处理技术领域,尤其涉及一种时序预测优化方法、设备及存储介质。The present application relates to the field of data processing technology, and in particular to a time series prediction optimization method, device and storage medium.
背景技术Background technique
时序预测广泛应用于工业、农业、水务、金融等领域。现有的时序预测方案已经越来越多地用到深度学习、机器学习等神经网络模型。Time series forecasting is widely used in industries such as industry, agriculture, water services, and finance. Existing time series forecasting solutions have increasingly used neural network models such as deep learning and machine learning.
目前,这些模型通常是使用基于预测结果和实际测量结果而构建的平均绝对误差MAE来作为损失函数,实践发现,按照这种损失函数构建出的时序预测模型的性能不佳,预测结果的准确性不足。At present, these models usually use the mean absolute error (MAE) constructed based on the predicted results and the actual measurement results as the loss function. In practice, it is found that the performance of the time series prediction model constructed according to this loss function is poor and the accuracy of the prediction results is insufficient.
发明内容Summary of the invention
本申请的多个方面提供一种时序预测优化方法、设备及存储介质,用以优化时序预测模型的预测性能。Multiple aspects of the present application provide a time series prediction optimization method, device and storage medium to optimize the prediction performance of a time series prediction model.
本申请实施例提供一种时序预测优化方法,包括:The present application provides a time series prediction optimization method, including:
将样本特征序列输入在时序预测模型中所构建的特征转换模块,所述特征转换模块用于将接收到的序列转换为携带时变特征和时不变特征的转换后序列;Inputting the sample feature sequence into a feature conversion module constructed in the time series prediction model, wherein the feature conversion module is used to convert the received sequence into a converted sequence carrying time-varying features and time-invariant features;
将所述转换后序列输入在所述时序预测模型中所构建的预测模块,所述预测模块用于基于所述转换后序列携带的时变特征和时不变特征进行时序预测而产生预测序列;Inputting the converted sequence into a prediction module constructed in the time series prediction model, wherein the prediction module is used to perform time series prediction based on the time-varying features and the time-invariant features carried by the converted sequence to generate a prediction sequence;
为所述样本特征序列对应的时不变特征计算针对波动性的评价指标,以确定所述特征转换模块对应的第一损失函数值;Calculating an evaluation index for volatility for the time-invariant feature corresponding to the sample feature sequence to determine a first loss function value corresponding to the feature conversion module;
为所述预测序列计算基于动态时间规整DTW的评价指标,以确定所述预测模块对应的第二损失函数值;Calculating an evaluation index based on dynamic time warping (DTW) for the prediction sequence to determine a second loss function value corresponding to the prediction module;
基于所述第一损失函数值和所述第二损失函数值,对所述特征转换模块和所述预测模块进行联合调优,以更新所述时序预测模型中的相关模型参数。Based on the first loss function value and the second loss function value, the feature conversion module and the prediction module are jointly tuned to update relevant model parameters in the time series prediction model.
本申请实施例还提供一种时序预测优化方法,包括:The present application also provides a time series prediction optimization method, including:
接收时序预测请求;receiving a timing prediction request;
根据所述时序预测请求,获取历史特征序列; Acquire a historical feature sequence according to the time series prediction request;
将所述历史特征序列输入时序预测模型中的特征转换模块,以利用所述特征转换模块为所述历史特征序列生成转换后序列,所述特征转换模块用于从接收到的序列中提取时变特征和时不变特征以产生转换后序列;Inputting the historical feature sequence into a feature conversion module in a time series prediction model to generate a converted sequence for the historical feature sequence using the feature conversion module, wherein the feature conversion module is used to extract time-varying features and time-invariant features from the received sequence to generate a converted sequence;
将所述历史特征序列对应的转换后序列输入所述预测模块,以利用所述预测模块进行时序预测,而产生所述历史特征序列对应的预测序列;Inputting the converted sequence corresponding to the historical feature sequence into the prediction module, so as to use the prediction module to perform time series prediction and generate a prediction sequence corresponding to the historical feature sequence;
其中,所述预测模块以基于动态时间规整DTW的评价指标作为损失函数。The prediction module uses an evaluation index based on dynamic time warping (DTW) as a loss function.
本申请实施例还提供一种计算设备,包括存储器和处理器;The embodiment of the present application also provides a computing device, including a memory and a processor;
所述存储器用于存储一条或多条计算机指令;The memory is used to store one or more computer instructions;
所述处理器与所述存储器耦合,用于执行所述一条或多条计算机指令,以用于执行前述述的时序预测优化方法。The processor is coupled to the memory and is used to execute the one or more computer instructions to execute the aforementioned timing prediction optimization method.
本申请实施例还提供一种存储计算机指令的计算机可读存储介质,当所述计算机指令被一个或多个处理器执行时,致使所述一个或多个处理器执行前述的时序预测优化方法。An embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the aforementioned timing prediction optimization method.
在本申请实施例中,提出在时序预测模型中构建特征转换模块和预测模块,特征转换模块可用于将接收到的特征序列转换为携带时变特征和时不变特征的转换后序列,且其输出的转换后序列将作为预测模块的输入,预测模块可用于进行时序预测而产生预测序列。这样,通过特征转换模块可将时不变特征引入时序预测过程中,作为重要的影响因子。另外,还提出将针对时不变特征的波动性评价指标作为特征转换模块对应的第一损失函数,将基于动态时间规整DTW对预测序列的评价指标作为预测模块对应的第二损失函数,并至少基于这两种损失函数而对时序预测模型进行调优。这使得时不变特征的提取更加精准,而且可通过第二损失函数将DTW引入到时序预测过程中,作为另一种重要的影响因子,提升突变预测的准确性。因此,可有效优化时序预测模型的性能,提高预测准确度。In an embodiment of the present application, it is proposed to construct a feature conversion module and a prediction module in a time series prediction model. The feature conversion module can be used to convert the received feature sequence into a converted sequence carrying time-varying features and time-invariant features, and the converted sequence output by the module will be used as the input of the prediction module. The prediction module can be used to perform time series prediction and generate a prediction sequence. In this way, the time-invariant feature can be introduced into the time series prediction process as an important influencing factor through the feature conversion module. In addition, it is also proposed to use the volatility evaluation index for the time-invariant feature as the first loss function corresponding to the feature conversion module, and the evaluation index of the prediction sequence based on dynamic time warping DTW as the second loss function corresponding to the prediction module, and the time series prediction model is tuned based on at least these two loss functions. This makes the extraction of time-invariant features more accurate, and DTW can be introduced into the time series prediction process through the second loss function as another important influencing factor to improve the accuracy of mutation prediction. Therefore, the performance of the time series prediction model can be effectively optimized and the prediction accuracy can be improved.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
图1为本申请一示例性实施例提供的一种时序预测优化方法的流程示意图;FIG1 is a flow chart of a timing prediction optimization method provided by an exemplary embodiment of the present application;
图2为本申请一示例性实施例提供的一种时序预测模型的逻辑结构示意图;FIG2 is a schematic diagram of the logical structure of a time series prediction model provided by an exemplary embodiment of the present application;
图3为本申请一示例性实施例提供的一种特征转换模块的可选实现方式的示意图;FIG3 is a schematic diagram of an optional implementation of a feature conversion module provided by an exemplary embodiment of the present application;
图4为本申请一示例性实施例提供的另一种时序预测优化方法的流程示意图;FIG4 is a flow chart of another timing prediction optimization method provided by an exemplary embodiment of the present application;
图5为本申请另一示例性实施例提供的一种计算设备的结构示意图。FIG5 is a schematic diagram of the structure of a computing device provided by another exemplary embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请具体实施例及相应的附图对本申请技术方案进行清楚、完整地描述。显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做 出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solution and advantages of this application clearer, the technical solution of this application will be described clearly and completely in combination with the specific embodiments of this application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, ordinary technicians in this field will not be able to make any mistakes. All other embodiments obtained through creative work are within the scope of protection of this application.
目前,时序预测模型的性能不佳,预测结果的准确性不足。为此,本申请的一些实施例中:提出在时序预测模型中构建特征转换模块和预测模块,特征转换模块可用于将接收到的特征序列转换为携带时变特征和时不变特征的转换后序列,且其输出的转换后序列将作为预测模块的输入,预测模块可用于进行时序预测而产生预测序列。这样,通过特征转换模块可将时不变特征引入时序预测过程中,作为重要的影响因子。另外,还提出将针对时不变特征的波动性评价指标作为特征转换模块对应的第一损失函数,将基于动态时间规整DTW对预测序列的评价指标作为预测模块对应的第二损失函数,并至少基于这两种损失函数而对时序预测模型进行调优。这使得时不变特征的提取更加精准,而且可通过第二损失函数将DTW引入到时序预测过程中,作为另一种重要的影响因子,提升突变预测的准确性。因此,可有效优化时序预测模型的性能,提高预测准确度。At present, the performance of the time series prediction model is poor, and the accuracy of the prediction results is insufficient. To this end, in some embodiments of the present application: it is proposed to construct a feature conversion module and a prediction module in the time series prediction model, and the feature conversion module can be used to convert the received feature sequence into a converted sequence carrying time-varying features and time-invariant features, and the converted sequence output by it will be used as the input of the prediction module, and the prediction module can be used to perform time series prediction and generate a prediction sequence. In this way, the time-invariant feature can be introduced into the time series prediction process as an important influencing factor through the feature conversion module. In addition, it is also proposed to use the volatility evaluation index for the time-invariant feature as the first loss function corresponding to the feature conversion module, and the evaluation index of the prediction sequence based on dynamic time warping DTW as the second loss function corresponding to the prediction module, and the time series prediction model is tuned based on at least these two loss functions. This makes the extraction of time-invariant features more accurate, and DTW can be introduced into the time series prediction process through the second loss function as another important influencing factor to improve the accuracy of mutation prediction. Therefore, the performance of the time series prediction model can be effectively optimized and the prediction accuracy can be improved.
以下结合附图,详细说明本申请各实施例提供的技术方案。The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
图1为本申请一示例性实施例提供的一种时序预测优化方法的流程示意图,该方法可由数据处理装置执行,该数据处理装置可实现为软件和/或硬件的结合,该数据处理装置可集成在计算设备中。参考图1,该方法可包括:FIG1 is a flow chart of a method for optimizing time series prediction provided by an exemplary embodiment of the present application. The method may be executed by a data processing device, which may be implemented as a combination of software and/or hardware, and may be integrated in a computing device. Referring to FIG1 , the method may include:
步骤100、将样本特征序列输入在时序预测模型中所构建的特征转换模块,特征转换模块用于将接收到的序列转换为携带时变特征和时不变特征的转换后序列;Step 100: Input the sample feature sequence into a feature conversion module constructed in the time series prediction model, where the feature conversion module is used to convert the received sequence into a converted sequence carrying time-varying features and time-invariant features;
步骤101、将转换后序列输入在时序预测模型中所构建的预测模块,预测模块用于基于转换后序列携带的时变特征和时不变特征进行时序预测而产生预测序列;Step 101: input the converted sequence into a prediction module constructed in a time series prediction model, the prediction module is used to perform time series prediction based on the time-varying features and time-invariant features carried by the converted sequence to generate a prediction sequence;
步骤102、为样本特征序列对应的时不变特征计算针对波动性的评价指标,以确定特征转换模块对应的第一损失函数值;Step 102: Calculate an evaluation index for volatility for the time-invariant feature corresponding to the sample feature sequence to determine a first loss function value corresponding to the feature conversion module;
步骤103、为预测序列计算基于动态时间规整DTW的评价指标,以确定预测模块对应的第二损失函数值;Step 103: Calculate an evaluation index based on dynamic time warping (DTW) for the prediction sequence to determine a second loss function value corresponding to the prediction module;
步骤104、基于第一损失函数值和第二损失函数值,对特征转换模块和预测模块进行联合调优,以更新时序预测模型中的相关模型参数。Step 104: Based on the first loss function value and the second loss function value, jointly tune the feature conversion module and the prediction module to update relevant model parameters in the time series prediction model.
本实施例提供的时序预测优化方法可应用于各种需要进行时序预测的场景中,例如,只能水务、数字农业等场景,本实施例对应用场景不做限定。应当理解的是,在不同的应用场景中,作为预测依据的特征序列可能存在内容差别,最终产生的预测序列也可能存在内容差别,在序列内容方面均可根据场景需求而适应性设定,本实施例对此不做限定。其中,时序预测可理解为利用历史时间序列预测未来时间序列,例如,可利用历史12小时的温度预测来预测未来6小时的温度序列等。The time series prediction optimization method provided in this embodiment can be applied to various scenarios that require time series prediction, such as water conservancy, digital agriculture and other scenarios. This embodiment does not limit the application scenarios. It should be understood that in different application scenarios, the feature sequence used as the basis for prediction may have different contents, and the final prediction sequence may also have different contents. The sequence content can be adaptively set according to the needs of the scenario, and this embodiment does not limit this. Among them, time series prediction can be understood as using historical time series to predict future time series. For example, the temperature forecast of the past 12 hours can be used to predict the temperature series of the next 6 hours.
图2为本申请一示例性实施例提供的一种时序预测模型的逻辑结构示意图。参考图2,本实施例中,时序预测模块可包含特征转换模块和预测模块。应当理解的是,特征转换模块和预测模块均可采用可行的各种神经网络学习模型,例如,RNN、CNN、Transformer等,本实施例对特征转换模块和预测模块各自采用的模型类型不做限定。参考图2,特征 转换模块和预测模块串接,也即是,特征转换模块的输出结果将作为预测模块的输入。FIG2 is a schematic diagram of the logical structure of a time series prediction model provided by an exemplary embodiment of the present application. Referring to FIG2, in this embodiment, the time series prediction module may include a feature conversion module and a prediction module. It should be understood that both the feature conversion module and the prediction module may adopt various feasible neural network learning models, such as RNN, CNN, Transformer, etc. This embodiment does not limit the model type adopted by the feature conversion module and the prediction module. Referring to FIG2, the feature conversion module and the prediction module may adopt various feasible neural network learning models, such as RNN, CNN, Transformer, etc. The conversion module and the prediction module are connected in series, that is, the output result of the feature conversion module will be used as the input of the prediction module.
本实施例中,特征转换模块可用于将接收到的特征序列转换为携带有时变特征和时不变特征的转换后序列,而预测模块则可用于根据接收到的转换后序列进行时序预测,以产生预测序列。也即是,特征转换模块的输入可以包括历史特征序列,输出则包括转换后序列;而预测模块的输入可包括特征转换模块提供的转换后序列,输出则可包括预测序列。其中,预测模块中的时序预测逻辑可以采用单步时序预测逻辑也可采用多步时序预测逻辑,本实施例对此不做限定。另外,前述提及的时变特征是指随时间变化的特征,时不变特征则是只不随时间变化的特征。In this embodiment, the feature conversion module can be used to convert the received feature sequence into a converted sequence carrying time-varying features and time-invariant features, and the prediction module can be used to perform time series prediction based on the received converted sequence to generate a predicted sequence. That is, the input of the feature conversion module may include the historical feature sequence, and the output includes the converted sequence; and the input of the prediction module may include the converted sequence provided by the feature conversion module, and the output may include the predicted sequence. Among them, the time series prediction logic in the prediction module can adopt single-step time series prediction logic or multi-step time series prediction logic, which is not limited in this embodiment. In addition, the time-varying features mentioned above refer to features that change with time, and the time-invariant features are features that do not change with time.
以下先对时序预测模型的训练过程进行描述。The following first describes the training process of the time series prediction model.
参考图1,在步骤100中,可将样本特征序列输入在时序预测模型中所构建的特征转换模块。正如前文提及的,特征转换模块可将其接收到的特征序列转换为转换后序列,因此,在步骤100中,可利用特征转换序列而输出样本特征序列对应的转换后序列。其中,样本特征序列是指作为预测依据的历史特征序列,作为样本来说,样本特征序列通常关联有对应的样本未来序列,样本未来序列通常是基于样本特征序列进行时序预测后产生的预测序列所对应的真实序列。也即是,样本未来序列通常是真实采集值,同样,样本特征序列通常也是真实采集值。在模型训练过程中,时序预测模块可基于样本特征序列而产生预测序列,而样本特征序列关联的真实序列则可用于评价预测序列的准确性,从而指导对时序预测模型的调优工作。Referring to FIG. 1 , in step 100 , the sample feature sequence can be input into the feature conversion module constructed in the time series prediction model. As mentioned above, the feature conversion module can convert the feature sequence it receives into a converted sequence. Therefore, in step 100 , the feature conversion sequence can be used to output the converted sequence corresponding to the sample feature sequence. Among them, the sample feature sequence refers to the historical feature sequence used as the basis for prediction. As a sample, the sample feature sequence is usually associated with a corresponding sample future sequence. The sample future sequence is usually a real sequence corresponding to the predicted sequence generated after the time series prediction based on the sample feature sequence. That is, the sample future sequence is usually a real collection value, and similarly, the sample feature sequence is usually a real collection value. During the model training process, the time series prediction module can generate a predicted sequence based on the sample feature sequence, and the real sequence associated with the sample feature sequence can be used to evaluate the accuracy of the predicted sequence, thereby guiding the tuning of the time series prediction model.
图3为本申请一示例性实施例提供的一种特征转换模块的可选实现方式的示意图。在该可选实现方式中:特征转换模块可采用编码-解码模型,则特征转换模块的处理逻辑可以是:FIG3 is a schematic diagram of an optional implementation of a feature conversion module provided by an exemplary embodiment of the present application. In this optional implementation: the feature conversion module may adopt an encoding-decoding model, and the processing logic of the feature conversion module may be:
利用特征转换模块中的编码单元,将样本特征序列映射至时不变空间和时变空间,以分别提取出样本特征序列对应的时变特征和时不变特征;The encoding unit in the feature conversion module is used to map the sample feature sequence to the time-invariant space and the time-varying space, so as to respectively extract the time-varying features and the time-invariant features corresponding to the sample feature sequence;
将时变特征和时不变特征重构为融合序列;Reconstruct the time-varying features and the time-invariant features into a fusion sequence;
利用特征转换模块中的解码单元,对融合序列进行解码,以产生转换后序列。The fused sequence is decoded using the decoding unit in the feature conversion module to generate a converted sequence.
参考图3,Y_label[t-n:t-1]可表示样本特征序列,u[t-k:t-1]表示单个时变特征的维度,s[t-k:t-1]表示单个时不变特征的维度,应当理解的是,Y_label[t-n:t-1]中的每一个样本元素都可产生一个时变特征u和一个时不变特征s。ht可表示将时变特征和时不变特征进行重构而产生的融合序列,可以理解的是,融合序列中的元素与Y_label[t-n:t-1]中的元素对齐,融合序列中的单个元素为对Y_label[t-n:t-1]中的相应元素产生的时变特征u和时不变特征s进行重构而获得的结果。其中,一种示例性的重构逻辑可以是ht=【ST,UTT,S表示Y_label[t-n:t-1]产生的时不变特征组成的矩阵,U表示Y_label[t-n:t-1]产生的时变特征组成的矩阵。这样,通过对融合序列ht进行解码,即可产生出样本特征序列对应的转换后矩阵Y_t[t-n:t-1]。Referring to FIG3 , Y_label[tn:t-1] may represent a sample feature sequence, u[tk:t-1] represents the dimension of a single time-varying feature, and s[tk:t-1] represents the dimension of a single time-invariant feature. It should be understood that each sample element in Y_label[tn:t-1] may generate a time-varying feature u and a time-invariant feature s. ht may represent a fused sequence generated by reconstructing the time-varying feature and the time-invariant feature. It can be understood that the elements in the fused sequence are aligned with the elements in Y_label[tn:t-1], and the single element in the fused sequence is the result of reconstructing the time-varying feature u and the time-invariant feature s generated by the corresponding element in Y_label[tn:t-1]. Among them, an exemplary reconstruction logic may be ht=[S T ,U T ] T , S represents the matrix composed of the time-invariant features generated by Y_label[tn:t-1], and U represents the matrix composed of the time-varying features generated by Y_label[tn:t-1]. In this way, by decoding the fused sequence ht, the transformed matrix Y_t[tn:t-1] corresponding to the sample feature sequence can be generated.
另外,在该可选实现方式中,在将样本特征序列映射至时不变空间和时变空间之前, 编码单元还可先对样本特征序列进行标准化,之后,再将标准化后的样本特征序列映射至时不变空间和时变空间。例如,可将样本特征序列进行【-1,1】的标准化,当然,本实施例对标准化环节中所使用的范围并不做限定。同样,在对融合序列进行解码后,可将解码出的序列进行反标准化,以产生转换后序列。标准化环节可有效降低特征转换模型内部的计算量。In addition, in this optional implementation, before mapping the sample feature sequence to the time-invariant space and the time-varying space, The encoding unit may also first standardize the sample feature sequence, and then map the standardized sample feature sequence to the time-invariant space and the time-varying space. For example, the sample feature sequence may be standardized to [-1, 1]. Of course, this embodiment does not limit the range used in the standardization link. Similarly, after decoding the fused sequence, the decoded sequence may be de-standardized to generate a converted sequence. The standardization link can effectively reduce the amount of calculation inside the feature conversion model.
本实施例中,时不变特征中包含特征序列中各元素间的自相关性信息以及不随时间变化的其它方面的信息。这样,本实施例中,可将历史特征序列的自相关性信息等时不变特征引入到时序预测过程中,作为重要的影响因子,后续的预测模块可顺利捕捉到历史特征序列中的时不变特征,从而更加准确地进行时序预测。例如,若历史特征序列中的第5个和第6个元素值不随时间变化,且预测序列中的某个元素可由历史特征序列中的这两个元素推算出,则将历史特征序列中这两个元素对应的时不变特征引入时序预测过程后,可对预测序列带来正向影响,提高预测准确度。当然,这仅是示例性的。In this embodiment, the time-invariant features include the autocorrelation information between the elements in the feature sequence and other information that does not change with time. In this way, in this embodiment, the time-invariant features such as the autocorrelation information of the historical feature sequence can be introduced into the time series prediction process. As an important influencing factor, the subsequent prediction module can smoothly capture the time-invariant features in the historical feature sequence, thereby more accurately predicting the time series. For example, if the values of the 5th and 6th elements in the historical feature sequence do not change with time, and an element in the predicted sequence can be inferred from these two elements in the historical feature sequence, then after the time-invariant features corresponding to these two elements in the historical feature sequence are introduced into the time series prediction process, it can have a positive impact on the predicted sequence and improve the prediction accuracy. Of course, this is only exemplary.
继续参考图1,在步骤101中,可将转换后序列输入在时序预测模型中所构建的预测模块。正如前文提及的,预测模块可用于基于转换后序列携带的时变特征和时不变特征进行时序预测而产生预测序列。应当理解的是,实际应用中,预测模块的输入还可包含除特征转换模块提供的转换后序列之外的其它内容,例如,对样本特征序列中的变量存在影响的多模态数据等。例如,样本特征序列可以是为温度序列,则预测模块的输入除了可包括温度序列对应的转换后序列之外,还可包含对温度存在影响的天气数据、季节数据、地理位置数据、人为数据等多模态的数据,这些也可作为时序预测的依据。也即是,本实施例对预测模块的其它输入不做限定,可根据应用场景的需求而按需接入。Continuing to refer to FIG. 1, in step 101, the converted sequence can be input into the prediction module constructed in the time series prediction model. As mentioned above, the prediction module can be used to generate a prediction sequence by performing time series prediction based on the time-varying features and time-invariant features carried by the converted sequence. It should be understood that in practical applications, the input of the prediction module may also include other contents besides the converted sequence provided by the feature conversion module, for example, multimodal data that affects the variables in the sample feature sequence. For example, the sample feature sequence may be a temperature sequence, and the input of the prediction module may include, in addition to the converted sequence corresponding to the temperature sequence, weather data, seasonal data, geographic location data, human data and other multimodal data that affect the temperature, which can also serve as the basis for time series prediction. That is, this embodiment does not limit other inputs of the prediction module, and it can be accessed on demand according to the needs of the application scenario.
这样,在步骤101中,可产生样本特征序列对应的预测序列。In this way, in step 101, a prediction sequence corresponding to the sample feature sequence can be generated.
在此基础上,参考图1,在步骤102中,可为样本特征序列对应的时不变特征计算针对波动性的评价指标,以确定特征转换模块对应的第一损失函数值。在步骤103中,则可为预测序列计算基于动态时间规整DTW的评价指标,以确定预测模块对应的第二损失函数值。On this basis, referring to Figure 1, in step 102, an evaluation index for volatility can be calculated for the time-invariant feature corresponding to the sample feature sequence to determine the first loss function value corresponding to the feature conversion module. In step 103, an evaluation index based on dynamic time warping DTW can be calculated for the prediction sequence to determine the second loss function value corresponding to the prediction module.
本实施例中,可为特征转换模块配置第一损失函数,第一损失函数可采用针对时不变特征的波动性评价指标;还可为预测模块配置第二损失函数,第二损失函数则可采用基于动态时间规整DTW对预测序列的评价指标。In this embodiment, a first loss function can be configured for the feature conversion module, and the first loss function can adopt a volatility evaluation index for time-invariant features; a second loss function can also be configured for the prediction module, and the second loss function can adopt an evaluation index for the prediction sequence based on dynamic time warping DTW.
在一种示例性方案中:可将特征转换模块提取出的时不变特征的均方差,作为针对波动性的评价指标,也产生第一损失函数。这种情况下,第一损失函数可表征为:
In an exemplary solution, the mean square error of the time-invariant features extracted by the feature conversion module can be used as an evaluation index for volatility, and a first loss function is also generated. In this case, the first loss function can be characterized as:
其中,s(t-i)和s(t-i-1)为样本特征序列对应其中任意两个相邻的时不变特征,K为时不变特征的数量,通常与样本特征序列的序列长度一致。Among them, s(t-i) and s(t-i-1) are the time-invariant features corresponding to any two adjacent ones of the sample feature sequence, and K is the number of time-invariant features, which is usually consistent with the sequence length of the sample feature sequence.
在另一种示例性方案中:可为预测序列计算预计动态时间规整DTW的形状偏差和时 间偏差,以构建第二损失函数。第二损失函数可表征为:
LDTW=α1Lshape2Ltdi
In another exemplary embodiment, the shape deviation and time of the predicted dynamic time warping (DTW) may be calculated for the predicted sequence. The time deviation is used to construct the second loss function. The second loss function can be represented as:
L DTW = α 1 L shape + α 2 L tdi
其中,Lshape表示形状偏差,Ltdi则表示时间偏差。Among them, L shape represents the shape deviation, and L tdi represents the time deviation.
值得说明的是,本实施例中,关于动态时间规整DTW技术相关的知识可从现有及将来出现的公开资料中查询而知,本实施例中,只限定动态时间规整DTW的两个处理对象分别为预测队列和其对应的真实队列,而具体的动态时间规整逻辑可参见相关资料中的记载,在此不做过多展开说明。本实施例对DTW技术本身并未做出改变。It is worth noting that in this embodiment, the knowledge related to the dynamic time warping DTW technology can be found in the existing and future public information. In this embodiment, the two processing objects of the dynamic time warping DTW are limited to the prediction queue and its corresponding real queue, and the specific dynamic time warping logic can be found in the records in the relevant materials, which will not be explained in detail here. This embodiment does not change the DTW technology itself.
基于此,在该示例性方案中,为预测序列计算基于动态时间规整DTW的评价指标,以确定预测模块对应的第二损失函数值的过程,可以是:Based on this, in this exemplary solution, the process of calculating the evaluation index based on dynamic time warping DTW for the prediction sequence to determine the second loss function value corresponding to the prediction module may be:
对预测序列和其对应的真实序列进行动态时间规整处理,计算最短路径,生成双方之间的时间匹配关系;Perform dynamic time warping on the predicted sequence and its corresponding real sequence, calculate the shortest path, and generate the time matching relationship between the two;
基于时间匹配关系,计算动态时间规整处理后的预测序列和真实序列之间的形状偏差;Based on the time matching relationship, the shape deviation between the predicted sequence and the true sequence after dynamic time warping is calculated;
基于时间匹配关系,计算动态时间规整处理后的预测序列和真实序列之间的时间偏差;Based on the time matching relationship, the time deviation between the predicted sequence and the real sequence after dynamic time warping is calculated;
根据形状偏差和时间偏差,确定第二损失函数值。A second loss function value is determined based on the shape deviation and the time deviation.
可选地,一种形状偏差的计算方案可以是:针对预测序列中的每个元素,分别确定经过动态时间规整处理后其在真实序列中对应的匹配元素;分别为预测序列中的每个元素,计算其与相应的匹配元素之间的距离;计算距离之和的平方根,作为形状偏差。在该计算方案中,形状偏差可表征为:
Optionally, a shape deviation calculation scheme may be: for each element in the predicted sequence, determine the corresponding matching element in the real sequence after dynamic time warping; for each element in the predicted sequence, calculate the distance between it and the corresponding matching element; calculate the square root of the sum of the distances as the shape deviation. In this calculation scheme, the shape deviation can be characterized as:
其中,π为动态时间规整处理后的最短路径,Ypred[i]为样本特征序列中的第i个元素值,Ylabel[j]为相应的真实序列中的第j个元素值,i和j对齐。另外,为了能反向求导,还可对形状偏差进行log-sum-exp的数学转换。Among them, π is the shortest path after dynamic time warping, Y pred[i] is the value of the i-th element in the sample feature sequence, and Y label[j] is the value of the j-th element in the corresponding true sequence, and i and j are aligned. In addition, in order to reverse the derivation, the shape deviation can also be converted into log-sum-exp.
可选地,一种时间偏差的计算方案可以是:针对预测序列中的每个元素,分别确定经过动态时间规整处理后其在真实序列中对应的匹配元素;分别为预测序列中的每个元素,计算其与相应的匹配元素之间的时间差;计算时间差的均值平方和,作为时间偏差。在该计算方案中,时间偏差可表征为:
Optionally, a time deviation calculation scheme may be: for each element in the predicted sequence, determine the corresponding matching element in the real sequence after dynamic time warping; for each element in the predicted sequence, calculate the time difference between it and the corresponding matching element; calculate the mean square sum of the time differences as the time deviation. In this calculation scheme, the time deviation can be characterized as:
其中,π为动态时间规整处理后的最短路径,i为预测序列中第i个元素对应的时间,j为相应的真实序列中第j个元素对应的时间,i和j对齐。另外,为了能反向求导,还可对时间偏差进行log-sum-exp的数学转换 Among them, π is the shortest path after dynamic time warping, i is the time corresponding to the i-th element in the predicted sequence, j is the time corresponding to the j-th element in the corresponding real sequence, and i and j are aligned. In addition, in order to reverse the derivation, the time deviation can also be converted into log-sum-exp mathematically
值得说明的是,上述针对形状偏差和时间偏差提供的计算方案仅是示例性的,本实施例并不限于此,例如,除了采用距离之和的平方根,还可采用距离的均值方差等其它逻辑来计算形状偏差,除了采用均值平方和,还可采用对角线偏移量等其它逻辑来计算时间偏差,在此不做穷举。It is worth noting that the above-mentioned calculation scheme for shape deviation and time deviation is only exemplary, and the present embodiment is not limited thereto. For example, in addition to using the square root of the sum of distances, other logics such as the mean variance of distances can also be used to calculate shape deviation. In addition to using the mean square sum, other logics such as diagonal offset can also be used to calculate time deviation. These are not exhaustively listed here.
继续参考图1,在步骤104中,可基于第一损失函数值和第二损失函数值,对特征转换模块和预测模块进行联合调优,以更新时序预测模型中的相关模型参数。Continuing to refer to FIG. 1 , in step 104 , the feature conversion module and the prediction module may be jointly tuned based on the first loss function value and the second loss function value to update relevant model parameters in the time series prediction model.
这样,基于第一损失函数,可优化特征转换模块对时不变特征的提取性能,使得特征转换模块提取出的时不变特征的波动更平稳,从而更加准确地捕获时不变特征。而基于第二损失函数,则可使预测模块在时序预测过程中充分考虑时序规律性预测存在的偏差,尤其是时序突变情况下可能存在的滞后或偏差情况,从而更加准确地进行时序预测。In this way, based on the first loss function, the feature conversion module can optimize the extraction performance of the time-invariant features, so that the fluctuation of the time-invariant features extracted by the feature conversion module is more stable, thereby capturing the time-invariant features more accurately. Based on the second loss function, the prediction module can fully consider the deviations in the prediction of time series regularity during the time series prediction process, especially the lag or deviation that may exist in the case of time series mutation, so as to make time series prediction more accurate.
除了上述的第一损失函数和第二损失函数外,本实施例中还可在训练过程中为时序预测模型配置其它损失函数,一种典型的损失函数可以是平均绝对误差MAE,为此,本实施例中,还可为预测模块配置第三损失函数,第三损失函数采用针对预测序列的平均绝对误差MAE。第三损失函数可表征为:
In addition to the first loss function and the second loss function mentioned above, in this embodiment, other loss functions can be configured for the time series prediction model during the training process. A typical loss function can be the mean absolute error MAE. For this reason, in this embodiment, a third loss function can also be configured for the prediction module. The third loss function uses the mean absolute error MAE for the prediction sequence. The third loss function can be characterized as:
其中,Ypred[i]表示预测序列中的第i个元素值,Ylabel[i]表示相应的真实序列中的第i个元素值,n为预测序列的长度。Among them, Y pred[i] represents the i-th element value in the predicted sequence, Y label[i] represents the i-th element value in the corresponding true sequence, and n is the length of the predicted sequence.
这样,综合上述提及的三种损失函数,本实施例中,可对上述的三种损失函数进行组合,以产生混合损失函数。则混合损失函数可表征为:
Lloss=α1Lshape2Ltdi3LMAE1Ls
Thus, based on the three loss functions mentioned above, in this embodiment, the three loss functions mentioned above can be combined to generate a hybrid loss function. Then the hybrid loss function can be characterized as:
L loss = α 1 L shape + α 2 L tdi + α 3 L MAE + β 1 L s
在此基础上,本实施例中,可利用混合损失函数,对时序预测模型中的特征转换模块和预测模块进行联合调优,以联合优化特征转换模块和预测模块的性能。On this basis, in this embodiment, a hybrid loss function can be used to jointly tune the feature conversion module and the prediction module in the time series prediction model to jointly optimize the performance of the feature conversion module and the prediction module.
回到样本特征序列来说,可计算样本特征序列对应的预测序列与相应的真实序列之间的平均绝对误差MAE,以确定预测模块对应的第三损失函数值;对第一损失函数值、第二损失函数值和第三损失函数值进行加权求和,以对特征转换模块和预测模块进行联合调优。Back to the sample feature sequence, the mean absolute error MAE between the predicted sequence corresponding to the sample feature sequence and the corresponding true sequence can be calculated to determine the third loss function value corresponding to the prediction module; the first loss function value, the second loss function value and the third loss function value are weighted and summed to jointly optimize the feature conversion module and the prediction module.
另外,本实施例中,还可对混合损失函数进行梯度自动求导,以确定第一损失函数、第二损失函数和第三损失函数各自对应的权重值。在训练过程中,可将混合损失函数中的各个权重参数设置为可调权重参数,它们之间的和值小于1,且设为可导函数,这样,通过梯度自动求导技术,即可自动寻找出最终的权重值。而在验证模型时,混合损失函数中的这些权重值则可转为固定。其中,Ls可采用独立的权重参数,其权重参数可设定为1或者其它,而其它损失函数的权重系数可联合进行梯度自动求导。当然,这仅是优选地示例性方式,本实施例对此不做限定。In addition, in this embodiment, the gradient of the mixed loss function can also be automatically derived to determine the weight values corresponding to the first loss function, the second loss function, and the third loss function. During the training process, each weight parameter in the mixed loss function can be set as an adjustable weight parameter, the sum of which is less than 1, and is set as a differentiable function. In this way, the final weight value can be automatically found through the gradient automatic derivation technology. When verifying the model, these weight values in the mixed loss function can be fixed. Among them, Ls can use an independent weight parameter, and its weight parameter can be set to 1 or other, and the weight coefficients of other loss functions can be combined for gradient automatic derivation. Of course, this is only an exemplary method, and this embodiment does not limit this.
值得说明的是,上述是从单次迭代过程的角度来阐述了时序预测模型的训练方案,应 当理解的是,本实施例中,可使用若干样本特征序列,对时序预测模型进行多次迭代,以不对对时序预测模型进行调优,直至时序预测模型的性能达到指定要求再停止。也即是,本实施例中,可设定迭代周期、学习率等参数,并根据本实施例中自定义的第一损失函数和第二损失函数,对时序预测模型进行迭代调优,以完成对时序预测模型的训练。It is worth noting that the above is an explanation of the training scheme of the time series prediction model from the perspective of a single iteration process. It should be understood that in this embodiment, several sample feature sequences can be used to iterate the time series prediction model multiple times, so as not to tune the time series prediction model until the performance of the time series prediction model reaches the specified requirements and then stop. That is, in this embodiment, parameters such as iteration cycle and learning rate can be set, and the time series prediction model can be iteratively tuned according to the first loss function and the second loss function customized in this embodiment to complete the training of the time series prediction model.
在完成时序预测模型的训练后,可使用时序预测模型提供时序预测服务。After the time series prediction model is trained, you can use the time series prediction model to provide time series prediction services.
对此,本实施例中,还可接收时序预测请求,并根据时序预测请求,获取历史特征序列;将历史特征序列输入时序预测模型中的特征转换模块,以利用特征转换模块将历史特征序列转换为携带有时变特征和时不变特征的转换后序列;将历史特征序列对应的转换后序列输入预测模块,以利用预测模块进行时序预测,而产生历史特征序列对应的预测序列。其中,历史特征序列可直接携带在时序预测请求中,当然,也可从其它渠道获取到。基于前文对特征转换模块和预测模块的训练,特征转换序列可准确地从历史样本序列中提取出时变特征和时不变特征,这些特征通过转换后序列带入预测模块中,预测模块则可充分捕捉时不变特征以及动态时间规则DTW的相关指标对预测结果的影响,从而更加准确地进行时序预测,输出的预测序列的准确性更高。In this regard, in this embodiment, a time series prediction request can also be received, and according to the time series prediction request, a historical feature sequence can be obtained; the historical feature sequence is input into the feature conversion module in the time series prediction model, so as to use the feature conversion module to convert the historical feature sequence into a converted sequence carrying time-varying features and time-invariant features; the converted sequence corresponding to the historical feature sequence is input into the prediction module, so as to use the prediction module to perform time series prediction, and generate a prediction sequence corresponding to the historical feature sequence. Among them, the historical feature sequence can be directly carried in the time series prediction request, and of course, it can also be obtained from other channels. Based on the training of the feature conversion module and the prediction module in the previous text, the feature conversion sequence can accurately extract time-varying features and time-invariant features from the historical sample sequence, and these features are brought into the prediction module through the converted sequence. The prediction module can fully capture the influence of the time-invariant features and the relevant indicators of the dynamic time rule DTW on the prediction results, so as to more accurately perform time series prediction, and the output prediction sequence has higher accuracy.
综上,本实施例中,提出在时序预测模型中构建特征转换模块和预测模块,特征转换模块可用于将接收到的特征序列转换为携带时变特征和时不变特征的转换后序列,且其输出的转换后序列将作为预测模块的输入,预测模块可用于进行时序预测而产生预测序列。这样,通过特征转换模块可将时不变特征引入时序预测过程中,作为重要的影响因子。另外,还提出将针对时不变特征的波动性评价指标作为特征转换模块对应的第一损失函数,将基于动态时间规整DTW对预测序列的评价指标作为预测模块对应的第二损失函数,并至少基于这两种损失函数而对时序预测模型进行调优。这使得时不变特征的提取更加精准,而且可通过第二损失函数将DTW引入到时序预测过程中,作为另一种重要的影响因子,提升突变预测的准确性。因此,可有效优化时序预测模型的性能,提高预测准确度。In summary, in this embodiment, it is proposed to construct a feature conversion module and a prediction module in the time series prediction model. The feature conversion module can be used to convert the received feature sequence into a converted sequence carrying time-varying features and time-invariant features, and the converted sequence output by it will be used as the input of the prediction module. The prediction module can be used to perform time series prediction and generate a prediction sequence. In this way, the time-invariant feature can be introduced into the time series prediction process as an important influencing factor through the feature conversion module. In addition, it is also proposed to use the volatility evaluation index for the time-invariant feature as the first loss function corresponding to the feature conversion module, and the evaluation index of the prediction sequence based on dynamic time warping DTW as the second loss function corresponding to the prediction module, and the time series prediction model is tuned based on at least these two loss functions. This makes the extraction of time-invariant features more accurate, and DTW can be introduced into the time series prediction process through the second loss function as another important influencing factor to improve the accuracy of mutation prediction. Therefore, the performance of the time series prediction model can be effectively optimized and the prediction accuracy can be improved.
图4为本申请一示例性实施例提供的另一种时序预测优化方法的流程示意图。参考图4,该方法可包括:FIG4 is a flow chart of another timing prediction optimization method provided by an exemplary embodiment of the present application. Referring to FIG4 , the method may include:
步骤400、接收时序预测请求;Step 400: receiving a timing prediction request;
步骤401,根据时序预测请求,获取历史特征序列;Step 401, obtaining a historical feature sequence according to a time series prediction request;
步骤402、将历史特征序列输入时序预测模型中的特征转换模块,以利用特征转换模块为历史特征序列生成转换后序列,特征转换模块用于从接收到的序列中提取时变特征和时不变特征以产生转换后序列;Step 402: input the historical feature sequence into a feature conversion module in the time series prediction model, so as to generate a converted sequence for the historical feature sequence using the feature conversion module, wherein the feature conversion module is used to extract time-varying features and time-invariant features from the received sequence to generate a converted sequence;
步骤403、将历史特征序列对应的转换后序列输入预测模块,以利用预测模块进行时序预测,而产生历史特征序列对应的预测序列;Step 403: input the converted sequence corresponding to the historical feature sequence into the prediction module, so as to use the prediction module to perform time series prediction and generate a prediction sequence corresponding to the historical feature sequence;
其中,预测模块以基于动态时间规整DTW的评价指标作为损失函数。Among them, the prediction module uses the evaluation index based on dynamic time warping DTW as the loss function.
在本实施例中,提出了一种时序预测模型,其包含特征转换模块和预测模块,两个模 块的功能如上。通过特征转换模块可充分捕捉到历史特征序列中的时变特征和时不变特征,并通过转换后序列而带入预测模块中,这样,历史特征序列中的时变特征可将作为时序预测的影响因子,这可有效提高时序预测的准确性。In this embodiment, a time series prediction model is proposed, which includes a feature conversion module and a prediction module. The functions of the block are as above. The feature conversion module can fully capture the time-varying features and time-invariant features in the historical feature sequence, and bring them into the prediction module through the converted sequence. In this way, the time-varying features in the historical feature sequence can be used as the influencing factors of time series prediction, which can effectively improve the accuracy of time series prediction.
另外,预测模块还采用了基于动态时间规则的评价指标作为损失函数,这使得预测模块的时序预测过程可充分考虑时间规律性偏差,作为另一种重要的影响因子。尤其对于时序突变情况下的预测工作,可有效提高预测准确度。In addition, the prediction module also uses an evaluation index based on dynamic time rules as a loss function, which allows the time series prediction process of the prediction module to fully consider the time regularity deviation as another important influencing factor. Especially for the prediction work under the condition of time series mutation, it can effectively improve the prediction accuracy.
其中,本实施例中仅对时序预测模型的结构和模块功能存在要求,而对于具体的训练过程并不做限定。当然,本实施例中的时序预测模型可采用图1相关实施例中提供的训练方案来进行调优,但应当理解的是,本实施例并不限于此,能够保证本实施例所要求的模型结构和模块功能的训练方案均可。Among them, this embodiment only has requirements for the structure and module functions of the time series prediction model, and does not limit the specific training process. Of course, the time series prediction model in this embodiment can be tuned using the training scheme provided in the relevant embodiment of Figure 1, but it should be understood that this embodiment is not limited to this, and any training scheme that can ensure the model structure and module functions required by this embodiment can be used.
关于模型训练方案,可参考图1相关实施例中提供的示例性方案,为节省篇幅在此不再赘述。Regarding the model training scheme, please refer to the exemplary scheme provided in the relevant embodiment of Figure 1, which will not be described here in order to save space.
需要说明的是,在上述实施例及附图中的描述的一些流程中,包含了按照特定顺序出现的多个操作,但是应该清楚了解,这些操作可以不按照其在本文中出现的顺序来执行或并行执行,操作的序号如101、102等,仅仅是用于区分开各个不同的操作,序号本身不代表任何的执行顺序。另外,这些流程可以包括更多或更少的操作,并且这些操作可以按顺序执行或并行执行。需要说明的是,本文中的“第一”、“第二”等描述,是用于区分不同的损失函数等,不代表先后顺序,也不限定“第一”和“第二”是不同的类型。It should be noted that in some of the processes described in the above embodiments and the accompanying drawings, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or may be executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different loss functions, etc., and do not represent the order of precedence, nor do they limit "first" and "second" to be different types.
图5为本申请另一示例性实施例提供的一种计算设备的结构示意图。如图5所示,该计算设备包括:存储器50和处理器51。Fig. 5 is a schematic diagram of a computing device provided by another exemplary embodiment of the present application. As shown in Fig. 5 , the computing device includes: a memory 50 and a processor 51 .
处理器51,与存储器50耦合,用于执行存储器50中的计算机程序,以用于:The processor 51 is coupled to the memory 50 and is used to execute the computer program in the memory 50 to:
将样本特征序列输入在时序预测模型中所构建的特征转换模块,特征转换模块用于将接收到的序列转换为携带时变特征和时不变特征的转换后序列;Inputting the sample feature sequence into a feature conversion module constructed in the time series prediction model, the feature conversion module is used to convert the received sequence into a converted sequence carrying time-varying features and time-invariant features;
将转换后序列输入在时序预测模型中所构建的预测模块,预测模块用于基于转换后序列携带的时变特征和时不变特征进行时序预测而产生预测序列;The converted sequence is input into a prediction module constructed in the time series prediction model, and the prediction module is used to perform time series prediction based on the time-varying features and time-invariant features carried by the converted sequence to generate a prediction sequence;
为样本特征序列对应的时不变特征计算针对波动性的评价指标,以确定特征转换模块对应的第一损失函数值;Calculate an evaluation index for volatility for the time-invariant feature corresponding to the sample feature sequence to determine a first loss function value corresponding to the feature conversion module;
为预测序列计算基于动态时间规整DTW的评价指标,以确定预测模块对应的第二损失函数值;Calculate the evaluation index based on dynamic time warping (DTW) for the prediction sequence to determine the second loss function value corresponding to the prediction module;
基于第一损失函数值和第二损失函数值,对特征转换模块和预测模块进行联合调优,以更新时序预测模型中的相关模型参数。Based on the first loss function value and the second loss function value, the feature conversion module and the prediction module are jointly tuned to update relevant model parameters in the time series prediction model.
在一可选实施例中,处理器51在为预测序列计算基于动态时间规整DTW的评价指标,以确定预测模块对应的第二损失函数值的过程中,可用于:In an optional embodiment, the processor 51, in the process of calculating the evaluation index based on dynamic time warping (DTW) for the prediction sequence to determine the second loss function value corresponding to the prediction module, may be used to:
对预测序列和其对应的真实序列进行动态时间规整处理,计算最短路径,生成双方之间的时间匹配关系; Perform dynamic time warping on the predicted sequence and its corresponding real sequence, calculate the shortest path, and generate the time matching relationship between the two;
基于时间匹配关系,计算动态时间规整处理后的预测序列和真实序列之间的形状偏差;Based on the time matching relationship, the shape deviation between the predicted sequence and the true sequence after dynamic time warping is calculated;
基于时间匹配关系,计算动态时间规整处理后的预测序列和真实序列之间的时间偏差;Based on the time matching relationship, the time deviation between the predicted sequence and the real sequence after dynamic time warping is calculated;
根据形状偏差和时间偏差,确定第二损失函数值。A second loss function value is determined based on the shape deviation and the time deviation.
在一可选实施例中,处理器51在计算动态时间规整处理后的预测序列和真实序列之间的形状偏差的过程中,可用于:In an optional embodiment, the processor 51, in the process of calculating the shape deviation between the predicted sequence and the true sequence after the dynamic time warping process, may be used to:
针对预测序列中的每个元素,分别确定经过动态时间规整处理后其在真实序列中对应的匹配元素;For each element in the predicted sequence, determine the corresponding matching element in the real sequence after dynamic time warping processing;
分别为预测序列中的每个元素,计算其与相应的匹配元素之间的距离;For each element in the predicted sequence, calculate the distance between it and the corresponding matching element;
计算距离之和的平方根,作为形状偏差。The square root of the sum of the distances is calculated as the shape deviation.
在一可选实施例中,处理器51在计算动态时间规整处理后的预测序列和真实序列之间的时间偏差的过程中,可用于:In an optional embodiment, the processor 51, in the process of calculating the time deviation between the predicted sequence and the real sequence after the dynamic time warping process, may be used to:
针对预测序列中的每个元素,分别确定经过动态时间规整处理后其在真实序列中对应的匹配元素;For each element in the predicted sequence, determine the corresponding matching element in the real sequence after dynamic time warping processing;
分别为预测序列中的每个元素,计算其与相应的匹配元素之间的时间差;For each element in the predicted sequence, calculate the time difference between it and the corresponding matching element;
计算时间差的均值平方和,作为时间偏差。Calculate the mean square sum of the time differences as the time deviation.
在一可选实施例中,处理器51在基于第一损失函数值和第二损失函数值,对特征转换模块和预测模块进行联合调优,处理器51还可用于:In an optional embodiment, the processor 51 jointly tunes the feature conversion module and the prediction module based on the first loss function value and the second loss function value, and the processor 51 may also be used to:
计算预测序列与其对应的真实序列之间的平均绝对误差MAE,以确定预测模块对应的第三损失函数值;Calculate the mean absolute error (MAE) between the predicted sequence and its corresponding true sequence to determine the third loss function value corresponding to the prediction module;
对第一损失函数值、第二损失函数值和第三损失函数值进行加权求和,以对特征转换模块和预测模块进行联合调优。The first loss function value, the second loss function value, and the third loss function value are weightedly summed to jointly tune the feature conversion module and the prediction module.
在一可选实施例中,处理器51还可用于:In an optional embodiment, the processor 51 may also be configured to:
对第一损失函数、第二损失函数和第三损失函数分别配置权重参数后进行组合,以产生混合损失函数;The first loss function, the second loss function, and the third loss function are respectively configured with weight parameters and then combined to generate a mixed loss function;
对混合损失函数进行梯度自动求导,以确定第一损失函数、第二损失函数和第三损失函数各自对应的权重值。The gradient of the mixed loss function is automatically derived to determine the weight values corresponding to the first loss function, the second loss function, and the third loss function.
在一可选实施例中,特征转换模块采用编码-解码模型,处理器51还可用于:In an optional embodiment, the feature conversion module adopts an encoding-decoding model, and the processor 51 can also be used to:
利用特征转换模块中的编码单元,将样本特征序列映射至时不变空间和时变空间,以分别提取出样本特征序列对应的时变特征和时不变特征;The encoding unit in the feature conversion module is used to map the sample feature sequence to the time-invariant space and the time-varying space, so as to respectively extract the time-varying features and the time-invariant features corresponding to the sample feature sequence;
将时变特征和时不变特征重构为融合序列;Reconstruct the time-varying features and the time-invariant features into a fusion sequence;
利用特征转换模块中的解码单元,对融合序列进行解码,以产生转换后序列。The fused sequence is decoded using the decoding unit in the feature conversion module to generate a converted sequence.
在一可选实施例中,处理器51在为样本特征序列对应的时不变特征计算针对波动性的评价指标的过程中,可用于: In an optional embodiment, the processor 51, in the process of calculating the evaluation index for volatility for the time-invariant feature corresponding to the sample feature sequence, may be used to:
计算样本特征序列对应的时不变特征的均方差,作为针对波动性的评价指标。The mean square error of the time-invariant features corresponding to the sample feature sequence is calculated as an evaluation indicator for volatility.
在一可选实施例中,时不变特征中包含自相关信息。In an optional embodiment, the time-invariant features include autocorrelation information.
在一可选实施例中,处理器51在完成时序预测模型的调优工作后,还可用于:In an optional embodiment, after completing the tuning of the time series prediction model, the processor 51 may also be used to:
接收时序预测请求;receiving a timing prediction request;
根据时序预测请求,获取历史特征序列;Obtain historical feature sequences based on time series prediction requests;
将历史特征序列输入时序预测模型中的特征转换模块,以利用特征转换模块将历史特征序列转换为携带有时变特征和时不变特征的转换后序列;Inputting the historical feature sequence into a feature conversion module in the time series prediction model, so as to utilize the feature conversion module to convert the historical feature sequence into a converted sequence carrying time-varying features and time-invariant features;
将历史特征序列对应的转换后序列输入预测模块,以利用预测模块进行时序预测,而产生历史特征序列对应的预测序列。The converted sequence corresponding to the historical feature sequence is input into the prediction module, so as to use the prediction module to perform time series prediction and generate a prediction sequence corresponding to the historical feature sequence.
在另一些可能的涉及中,基于图5所示的计算设备,该计算设备中的处理器51还可用于执行存储器50中的计算机程序,以用于:In some other possible aspects, based on the computing device shown in FIG. 5 , the processor 51 in the computing device may also be used to execute the computer program in the memory 50 to:
接收时序预测请求;receiving a timing prediction request;
根据时序预测请求,获取历史特征序列;Obtain historical feature sequences based on time series prediction requests;
将历史特征序列输入时序预测模型中的特征转换模块,以利用特征转换模块为历史特征序列生成转换后序列,特征转换模块用于从接收到的序列中提取时变特征和时不变特征以产生转换后序列;Inputting the historical feature sequence into a feature conversion module in the time series prediction model to generate a converted sequence for the historical feature sequence using the feature conversion module, wherein the feature conversion module is used to extract time-varying features and time-invariant features from the received sequence to generate a converted sequence;
将历史特征序列对应的转换后序列输入预测模块,以利用预测模块进行时序预测,而产生历史特征序列对应的预测序列;Inputting the converted sequence corresponding to the historical feature sequence into the prediction module, so as to use the prediction module to perform time series prediction and generate a prediction sequence corresponding to the historical feature sequence;
其中,预测模块以基于动态时间规整DTW的评价指标作为损失函数。Among them, the prediction module uses the evaluation index based on dynamic time warping DTW as the loss function.
进一步,如图5所示,该计算设备还包括:通信组件52、电源组件53等其它组件。图5中仅示意性给出部分组件,并不意味着计算设备只包括图5所示组件。Furthermore, as shown in Fig. 5, the computing device also includes other components such as a communication component 52 and a power component 53. Fig. 5 only schematically shows some components, which does not mean that the computing device only includes the components shown in Fig. 5.
值得说明的是,上述关于计算设备各实施例中的技术细节,可参考方法的实施例中的相关描述,为节省篇幅,在此不再赘述,但这不应造成本申请保护范围的损失。It is worth noting that the technical details in the above-mentioned embodiments of the computing device can refer to the relevant description in the embodiment of the method. In order to save space, they will not be repeated here, but this should not cause loss of the protection scope of this application.
相应地,本申请实施例还提供一种存储有计算机程序的计算机可读存储介质,计算机程序被执行时能够实现上述方法实施例中可由计算设备执行的各步骤。Accordingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed, can implement the steps that can be executed by a computing device in the above method embodiment.
上述图5中的存储器,用于存储计算机程序,并可被配置为存储其它各种数据以支持在计算平台上的操作。这些数据的示例包括用于在计算平台上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。The memory in FIG. 5 is used to store computer programs and can be configured to store various other data to support operations on the computing platform. Examples of such data include instructions for any application or method operating on the computing platform, contact data, phone book data, messages, pictures, videos, etc. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
上述图5中的通信组件,被配置为便于通信组件所在设备和其他设备之间有线或无线方式的通信。通信组件所在设备可以接入基于通信标准的无线网络,如WiFi,2G、3G、4G/LTE、5G等移动通信网络,或它们的组合。在一个示例性实施例中,通信组件经由广 播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。The communication component in FIG. 5 is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G/LTE, 5G and other mobile communication networks, or a combination thereof. In an exemplary embodiment, the communication component is connected to a wireless network via a broadband connection. The broadcast channel receives a broadcast signal or broadcast related information from an external broadcast management system. In an exemplary embodiment, the communication component further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
上述图5中的电源组件,为电源组件所在设备的各种组件提供电力。电源组件可以包括电源管理系统,一个或多个电源,及其他与为电源组件所在设备生成、管理和分配电力相关联的组件。The power supply assembly in Figure 5 provides power to various components of the device where the power supply assembly is located. The power supply assembly may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply assembly is located.
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to the flowchart and/or block diagram of the method, device (system) and computer program product according to the embodiment of the present application. It should be understood that each process and/or box in the flowchart and/or block diagram, and the combination of the process and/or box in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for realizing the function specified in one process or multiple processes in the flowchart and/or one box or multiple boxes in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPU), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、 动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带式磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), Dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
以上所述仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。 The above is only the embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (13)

  1. 一种时序预测优化方法,包括:A time series prediction optimization method, comprising:
    将样本特征序列输入在时序预测模型中所构建的特征转换模块,所述特征转换模块用于将接收到的序列转换为携带时变特征和时不变特征的转换后序列;Inputting the sample feature sequence into a feature conversion module constructed in the time series prediction model, wherein the feature conversion module is used to convert the received sequence into a converted sequence carrying time-varying features and time-invariant features;
    将所述转换后序列输入在所述时序预测模型中所构建的预测模块,所述预测模块用于基于所述转换后序列携带的时变特征和时不变特征进行时序预测而产生预测序列;Inputting the converted sequence into a prediction module constructed in the time series prediction model, wherein the prediction module is used to perform time series prediction based on the time-varying features and the time-invariant features carried by the converted sequence to generate a prediction sequence;
    为所述样本特征序列对应的时不变特征计算针对波动性的评价指标,以确定所述特征转换模块对应的第一损失函数值;Calculating an evaluation index for volatility for the time-invariant feature corresponding to the sample feature sequence to determine a first loss function value corresponding to the feature conversion module;
    为所述预测序列计算基于动态时间规整DTW的评价指标,以确定所述预测模块对应的第二损失函数值;Calculating an evaluation index based on dynamic time warping (DTW) for the prediction sequence to determine a second loss function value corresponding to the prediction module;
    基于所述第一损失函数值和所述第二损失函数值,对所述特征转换模块和所述预测模块进行联合调优,以更新所述时序预测模型中的相关模型参数。Based on the first loss function value and the second loss function value, the feature conversion module and the prediction module are jointly tuned to update relevant model parameters in the time series prediction model.
  2. 根据权利要求1所述的方法,所述为所述预测序列计算基于动态时间规整DTW的评价指标,以确定所述预测模块对应的第二损失函数值,包括:According to the method of claim 1, the step of calculating an evaluation index based on dynamic time warping (DTW) for the prediction sequence to determine a second loss function value corresponding to the prediction module comprises:
    对所述预测序列和其对应的真实序列进行动态时间规整处理,计算最短路径,生成双方之间的时间匹配关系;Performing dynamic time warping on the predicted sequence and its corresponding real sequence, calculating the shortest path, and generating a time matching relationship between the two;
    基于所述时间匹配关系,计算动态时间规整处理后的所述预测序列和所述真实序列之间的形状偏差;Based on the time matching relationship, calculating the shape deviation between the predicted sequence and the real sequence after dynamic time warping processing;
    基于所述时间匹配关系,计算动态时间规整处理后的所述预测序列和所述真实序列之间的时间偏差;Based on the time matching relationship, calculating the time deviation between the predicted sequence and the real sequence after dynamic time warping processing;
    根据所述形状偏差和所述时间偏差,确定所述第二损失函数值。The second loss function value is determined according to the shape deviation and the time deviation.
  3. 根据权利要求2所述的方法,所述计算动态时间规整处理后的所述预测序列和所述真实序列之间的形状偏差,包括:According to the method of claim 2, the calculating of the shape deviation between the predicted sequence and the true sequence after dynamic time warping processing comprises:
    针对所述预测序列中的每个元素,分别确定经过动态时间规整处理后其在所述真实序列中对应的匹配元素;For each element in the predicted sequence, determine the corresponding matching element in the real sequence after dynamic time warping processing;
    分别为所述预测序列中的每个元素,计算其与相应的匹配元素之间的距离;For each element in the predicted sequence, respectively, calculate the distance between it and the corresponding matching element;
    计算距离之和的平方根,作为所述形状偏差。The square root of the sum of the distances is calculated as the shape deviation.
  4. 根据权利要求2所述的方法,所述计算动态时间规整处理后的所述预测序列和所述真实序列之间的时间偏差,包括:According to the method of claim 2, the step of calculating the time deviation between the predicted sequence and the real sequence after dynamic time warping processing comprises:
    针对所述预测序列中的每个元素,分别确定经过动态时间规整处理后其在所述真实序列中对应的匹配元素;For each element in the predicted sequence, determine the corresponding matching element in the real sequence after dynamic time warping processing;
    分别为所述预测序列中的每个元素,计算其与相应的匹配元素之间的时间差;For each element in the predicted sequence, respectively, calculate the time difference between it and the corresponding matching element;
    计算时间差的均值平方和,作为所述时间偏差。The mean square sum of the time differences is calculated as the time deviation.
  5. 根据权利要求1所述的方法,所述基于所述第一损失函数值和所述第二损失函数值,对所述特征转换模块和所述预测模块进行联合调优,还包括: According to the method of claim 1, the jointly optimizing the feature conversion module and the prediction module based on the first loss function value and the second loss function value further comprises:
    计算所述预测序列与其对应的真实序列之间的平均绝对误差MAE,以确定所述预测模块对应的第三损失函数值;Calculating the mean absolute error (MAE) between the predicted sequence and its corresponding true sequence to determine a third loss function value corresponding to the prediction module;
    对所述第一损失函数值、所述第二损失函数值和所述第三损失函数值进行加权求和,以对所述特征转换模块和所述预测模块进行联合调优。A weighted sum is performed on the first loss function value, the second loss function value, and the third loss function value to jointly tune the feature conversion module and the prediction module.
  6. 根据权利要求5所述的方法,还包括:The method according to claim 5, further comprising:
    对第一损失函数、第二损失函数和第三损失函数分别配置权重参数后进行组合,以产生混合损失函数;The first loss function, the second loss function, and the third loss function are respectively configured with weight parameters and then combined to generate a mixed loss function;
    对所述混合损失函数进行梯度自动求导,以确定所述第一损失函数、所述第二损失函数和所述第三损失函数各自对应的权重值。Automatically derive the gradient of the hybrid loss function to determine the weight values corresponding to the first loss function, the second loss function, and the third loss function.
  7. 根据权利要求1所述的方法,所述特征转换模块采用编码-解码模型,所述方法还包括:According to the method of claim 1, the feature conversion module adopts an encoding-decoding model, and the method further comprises:
    利用所述特征转换模块中的编码单元,将样本特征序列映射至时不变空间和时变空间,以分别提取出所述样本特征序列对应的时变特征和时不变特征;Mapping the sample feature sequence to a time-invariant space and a time-varying space using the encoding unit in the feature conversion module, so as to respectively extract the time-varying features and the time-invariant features corresponding to the sample feature sequence;
    将所述时变特征和所述时不变特征重构为融合序列;reconstructing the time-varying features and the time-invariant features into a fused sequence;
    利用所述特征转换模块中的解码单元,对所述融合序列进行解码,以产生所述转换后序列。The fused sequence is decoded by using a decoding unit in the feature conversion module to generate the converted sequence.
  8. 根据权利要求1所述的方法,所述为所述样本特征序列对应的时不变特征计算针对波动性的评价指标,包括:According to the method of claim 1, the step of calculating an evaluation index for volatility for the time-invariant features corresponding to the sample feature sequence comprises:
    计算所述样本特征序列对应的时不变特征的均方差,作为所述针对波动性的评价指标。The mean square error of the time-invariant features corresponding to the sample feature sequence is calculated as the evaluation index for volatility.
  9. 根据权利要求1所述的方法,所述时不变特征中包含自相关信息。According to the method of claim 1, the time-invariant features contain autocorrelation information.
  10. 根据权利要求1所述的方法,在完成所述时序预测模型的调优工作后,所述方法还包括:According to the method of claim 1, after completing the tuning of the time series prediction model, the method further comprises:
    接收时序预测请求;receiving a timing prediction request;
    根据所述时序预测请求,获取历史特征序列;Acquire a historical feature sequence according to the time series prediction request;
    将所述历史特征序列输入所述时序预测模型中的特征转换模块,以利用所述特征转换模块将所述历史特征序列转换为携带有时变特征和时不变特征的转换后序列;Inputting the historical feature sequence into a feature conversion module in the time series prediction model, so as to utilize the feature conversion module to convert the historical feature sequence into a converted sequence carrying time-varying features and time-invariant features;
    将所述历史特征序列对应的转换后序列输入所述预测模块,以利用所述预测模块进行时序预测,而产生所述历史特征序列对应的预测序列。The converted sequence corresponding to the historical feature sequence is input into the prediction module, so as to use the prediction module to perform time series prediction and generate a prediction sequence corresponding to the historical feature sequence.
  11. 一种时序预测优化方法,包括:A time series prediction optimization method, comprising:
    接收时序预测请求;receiving a timing prediction request;
    根据所述时序预测请求,获取历史特征序列;Acquire a historical feature sequence according to the time series prediction request;
    将所述历史特征序列输入时序预测模型中的特征转换模块,以利用所述特征转换模块为所述历史特征序列生成转换后序列,所述特征转换模块用于从接收到的序列中 提取时变特征和时不变特征以产生转换后序列;The historical feature sequence is input into a feature conversion module in a time series prediction model, so as to generate a converted sequence for the historical feature sequence using the feature conversion module, wherein the feature conversion module is used to convert the received sequence into a converted sequence. Extracting time-varying features and time-invariant features to generate a transformed sequence;
    将所述历史特征序列对应的转换后序列输入所述预测模块,以利用所述预测模块进行时序预测,而产生所述历史特征序列对应的预测序列;Inputting the converted sequence corresponding to the historical feature sequence into the prediction module, so as to use the prediction module to perform time series prediction and generate a prediction sequence corresponding to the historical feature sequence;
    其中,所述预测模块以基于动态时间规整DTW的评价指标作为损失函数。The prediction module uses an evaluation index based on dynamic time warping (DTW) as a loss function.
  12. 一种计算设备,包括存储器和处理器;A computing device comprising a memory and a processor;
    所述存储器用于存储一条或多条计算机指令;The memory is used to store one or more computer instructions;
    所述处理器与所述存储器耦合,用于执行所述一条或多条计算机指令,以用于执行权利要求1-11任一项所述的时序预测优化方法。The processor is coupled to the memory and is used to execute the one or more computer instructions to execute the timing prediction optimization method described in any one of claims 1-11.
  13. 一种存储计算机指令的计算机可读存储介质,当所述计算机指令被一个或多个处理器执行时,致使所述一个或多个处理器执行权利要求1-11任一项所述的时序预测优化方法。 A computer-readable storage medium storing computer instructions, when the computer instructions are executed by one or more processors, causes the one or more processors to execute the timing prediction optimization method described in any one of claims 1-11.
PCT/CN2023/131132 2022-11-17 2023-11-10 Time series perdition optimization method, device, and storage medium WO2024104276A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211441398.3A CN118052310A (en) 2022-11-17 2022-11-17 Time sequence prediction optimization method, device and storage medium
CN202211441398.3 2022-11-17

Publications (1)

Publication Number Publication Date
WO2024104276A1 true WO2024104276A1 (en) 2024-05-23

Family

ID=91052657

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/131132 WO2024104276A1 (en) 2022-11-17 2023-11-10 Time series perdition optimization method, device, and storage medium

Country Status (2)

Country Link
CN (1) CN118052310A (en)
WO (1) WO2024104276A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118396658B (en) * 2024-06-26 2024-09-20 浙江口碑网络技术有限公司 Sales prediction method, sales prediction device, electronic equipment, storage medium and program product

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200074274A1 (en) * 2018-08-28 2020-03-05 Beijing Jingdong Shangke Information Technology Co., Ltd. System and method for multi-horizon time series forecasting with dynamic temporal context learning
CN112053004A (en) * 2020-09-14 2020-12-08 胜斗士(上海)科技技术发展有限公司 Method and apparatus for time series prediction
CN112949836A (en) * 2021-04-08 2021-06-11 北京航空航天大学 Method for carrying out regression prediction on-line migration learning on time-varying distribution data
CN113689026A (en) * 2021-07-13 2021-11-23 上海眼控科技股份有限公司 Meteorological data prediction method, equipment and storage medium
CN114330863A (en) * 2021-12-23 2022-04-12 中国电信股份有限公司 Time series prediction processing method, device, storage medium and electronic device
CN114511159A (en) * 2022-04-20 2022-05-17 广东电网有限责任公司佛山供电局 Power load probability prediction method and system based on conditional variational self-encoder
US20220321394A1 (en) * 2021-03-31 2022-10-06 Equifax Inc. Techniques for prediction models using time series data

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200074274A1 (en) * 2018-08-28 2020-03-05 Beijing Jingdong Shangke Information Technology Co., Ltd. System and method for multi-horizon time series forecasting with dynamic temporal context learning
CN112053004A (en) * 2020-09-14 2020-12-08 胜斗士(上海)科技技术发展有限公司 Method and apparatus for time series prediction
US20220321394A1 (en) * 2021-03-31 2022-10-06 Equifax Inc. Techniques for prediction models using time series data
CN112949836A (en) * 2021-04-08 2021-06-11 北京航空航天大学 Method for carrying out regression prediction on-line migration learning on time-varying distribution data
CN113689026A (en) * 2021-07-13 2021-11-23 上海眼控科技股份有限公司 Meteorological data prediction method, equipment and storage medium
CN114330863A (en) * 2021-12-23 2022-04-12 中国电信股份有限公司 Time series prediction processing method, device, storage medium and electronic device
CN114511159A (en) * 2022-04-20 2022-05-17 广东电网有限责任公司佛山供电局 Power load probability prediction method and system based on conditional variational self-encoder

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LIM BRYAN; ARIK SERCAN Ö; LOEFF NICOLAS; PFFISTER TOMAS: "Temporal Fusion Transformers for interpretable multi-horizon time series forecasting", INTERNATIONAL JOURNAL OF FORECASTING, NORTH-HOLLAND, AMSTERDAM, NL, vol. 37, no. 4, 16 June 2021 (2021-06-16), AMSTERDAM, NL , pages 1748 - 1764, XP086781356, ISSN: 0169-2070, DOI: 10.1016/j.ijforecast.2021.03.012 *

Also Published As

Publication number Publication date
CN118052310A (en) 2024-05-17

Similar Documents

Publication Publication Date Title
CN108364085B (en) Takeout delivery time prediction method and device
JP6817426B2 (en) Yield prediction system and method for machine learning-based semiconductor manufacturing
EP3043447B1 (en) Distribution transformer heavy loading and overloading mid-term and short-term pre-warning analytics model
WO2020087974A1 (en) Model generation method and device
WO2024104276A1 (en) Time series perdition optimization method, device, and storage medium
CN108460679B (en) Data analysis method of deep network intelligent investment system integrating attention mechanism
CN113342842A (en) Semantic query method and device based on metering knowledge and computer equipment
CN114331542A (en) Method and device for predicting charging demand of electric vehicle
CN112200465B (en) Electric power AI method and system based on multimedia information intelligent analysis
CN111008870A (en) Regional logistics demand prediction method based on PCA-BP neural network model
CN116522912B (en) Training method, device, medium and equipment for package design language model
CN112015870B (en) Data uploading method and device
CN116109007B (en) Power generation power determination method, server and storage medium
CN110222877A (en) A kind of load prediction system and load forecasting method based on customized neural network
CN102916851B (en) A kind of network flow prediction method and device
CN114707667A (en) Data-driven automatic model training and application system
US20170337644A1 (en) Data driven invocation of realtime wind market forecasting analytics
Jerome et al. Forecasting and anomaly detection on application metrics using lstm
Ma et al. Big data enabled anomaly user detection in mobile wireless networks
CN105701114B (en) The operating method and solution hunting system of solution hunting system
CN118278822B (en) Working data acquisition method and system based on image data analysis and electronic equipment
CN118245238B (en) Heterogeneous computing power equipment selection method and device apparatus, medium, product, and system
CN108536811A (en) Interactive voice determining method of path based on machine learning and device, storage medium, terminal
CN115905543A (en) Text processing method and device
CN117933446A (en) Wind power generation prediction method, device, network equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23890710

Country of ref document: EP

Kind code of ref document: A1