CN117235469A - Data prediction method, device, storage medium and equipment - Google Patents

Data prediction method, device, storage medium and equipment Download PDF

Info

Publication number
CN117235469A
CN117235469A CN202311125356.3A CN202311125356A CN117235469A CN 117235469 A CN117235469 A CN 117235469A CN 202311125356 A CN202311125356 A CN 202311125356A CN 117235469 A CN117235469 A CN 117235469A
Authority
CN
China
Prior art keywords
data
time sequence
prediction
coding
position coding
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202311125356.3A
Other languages
Chinese (zh)
Inventor
魏建平
黄振港
刘子奇
张志强
周俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
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 Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202311125356.3A priority Critical patent/CN117235469A/en
Publication of CN117235469A publication Critical patent/CN117235469A/en
Pending legal-status Critical Current

Links

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The specification discloses a data prediction method, a device, a storage medium and equipment, wherein the method comprises the following steps: firstly, time sequence data of a target transaction in a first preset time length are acquired, then the time sequence data are input into a pre-trained position coding model to obtain position coding data, wherein the position coding data comprise first position codes and second position codes corresponding to the time sequence data, the second position codes are used for indicating position indication information of prediction data of the target transaction, the prediction data are transaction data of the target transaction in a second preset time length after the first preset time length is predicted, the second preset time length is the next preset time length adjacent to the first preset time length, and finally the time sequence data and the position coding data are input into the pre-trained time sequence prediction model to be predicted to obtain prediction data corresponding to the target transaction.

Description

Data prediction method, device, storage medium and equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a data prediction method, a device, a storage medium, and a device.
Background
The time series data refers to time series data, is a data sequence recorded according to a unified index according to time sequence, and is a very common data type. In the related art, a time series model is constructed for predicting important data such as sales of commodities, demand of funds, and the like by performing time series analysis on the time series data. However, in the existing time series model, the influence of the position code on the model prediction is not emphasized, and rough position codes such as absolute position code, relative position code and time stamp code are still used, so that the characteristics of time series data are not fully considered.
Disclosure of Invention
According to the data prediction method, the device, the storage medium and the equipment, the independent position coding model is constructed, position coding and position coding prediction are performed based on time sequence characteristics in time sequence data, and then data prediction is performed based on the position coding data and the time sequence data, so that accuracy and stability of data prediction can be effectively improved. The technical scheme is as follows:
in a first aspect, embodiments of the present disclosure provide a data prediction method, the method including:
acquiring time sequence data of a target transaction within a first preset time length;
inputting the time sequence data into a pre-trained position coding model to obtain position coding data, wherein the position coding data comprises a first position code and a second position code corresponding to the time sequence data, the second position code is used for indicating position indication information of predicted data of the target transaction, the predicted data is transaction data of the target transaction in a second preset duration after the first preset duration is predicted, and the second preset duration is the next preset duration adjacent to the first preset duration;
and inputting the time sequence data and the position coding data into a pre-trained time sequence prediction model to obtain prediction data corresponding to the target transaction.
In a second aspect, embodiments of the present disclosure provide a method for training a position-coding model, the method including:
constructing a sample training data set, wherein the sample training data comprises sample time sequence data and a real position code corresponding to the sample time sequence data;
and carrying out learning training on the sample training data based on a preset model training algorithm to obtain a trained position coding model.
In a third aspect, embodiments of the present disclosure provide a data prediction apparatus, the apparatus including:
the data acquisition module is used for acquiring time sequence data of the target transaction within a first preset duration;
the position coding module is used for inputting the time sequence data into a pre-trained position coding model to obtain position coding data, the position coding data comprise a first position code and a second position code corresponding to the time sequence data, the second position code is used for indicating position indication information of prediction data of the target transaction, the prediction data are transaction data of the target transaction in a second preset time length after the first preset time length is predicted, and the second preset time length is the next preset time length adjacent to the first preset time length;
And the data prediction module is used for inputting the time sequence data and the position coding data into a pre-trained time sequence prediction model to obtain the prediction data corresponding to the target transaction.
In a fourth aspect, embodiments of the present disclosure provide a position-coding model training apparatus, the apparatus including:
the sample construction module is used for constructing a sample training data set, wherein the sample training data comprises sample time sequence data and a real position code corresponding to the sample time sequence data;
and the model training module is used for learning and training the sample training data based on a preset model training algorithm to obtain a trained position coding model.
In a fifth aspect, the present description embodiments provide a computer program product storing at least one instruction adapted to be loaded by a processor and to perform the above-described method steps.
In a sixth aspect, the present description provides a storage medium storing a computer program adapted to be loaded by a processor and to perform the above-mentioned method steps.
In a seventh aspect, embodiments of the present disclosure provide an electronic device, which may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the above-mentioned method steps.
The technical scheme provided by some embodiments of the present specification has the following beneficial effects:
by adopting the data prediction method provided by the embodiment of the specification, firstly, the time sequence data of the target transaction in the first preset time length is acquired, then the time sequence data is input into a pre-trained position coding model to obtain position coding data, wherein the position coding data comprises first position coding and second position coding corresponding to the time sequence data, the second position coding is used for indicating position indication information of the predicted data of the target transaction, the predicted data is transaction data of the target transaction in the second preset time length after the first preset time length is predicted, the second preset time length is the next preset time length adjacent to the first preset time length, finally, the time sequence data and the position coding data are input into a pre-trained time sequence prediction model to be predicted, the predicted data corresponding to the target transaction are obtained, the position coding and the position coding are predicted through an independent position coding model, the relation between the time sequence characteristics and the time sequence positions is fully refined, and then the time sequence data is predicted based on the position coding data and the time sequence data, and the accuracy and the stability of the time sequence data can be effectively improved.
Drawings
In order to more clearly illustrate the embodiments of the present description or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present description, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a data prediction method according to an embodiment of the present disclosure;
FIG. 2 is a system configuration diagram of a data prediction method according to an embodiment of the present disclosure;
fig. 3 is a flow chart of a data prediction method according to an embodiment of the present disclosure;
fig. 4 is a flow chart of a data prediction method according to an embodiment of the present disclosure;
fig. 5 is a flow chart of a data prediction method according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a data prediction device according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of a training device for a position coding model according to an embodiment of the present disclosure;
fig. 8 is a block diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
The technical solutions of the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is apparent that the described embodiments are only some embodiments of the present specification, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are intended to be within the scope of the present disclosure.
In the description of the present specification, it should be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. In the description of the present specification, it should be noted that, unless expressly specified and limited otherwise, "comprise" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may include other steps or elements not listed or inherent to such process, method, article, or apparatus. The specific meaning of the terms in this specification will be understood by those of ordinary skill in the art in the light of the specific circumstances. In addition, in the description of the present specification, unless otherwise indicated, "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
The following is a detailed description of embodiments in connection with the examples of the present specification. The implementations described in the following exemplary examples do not represent all implementations consistent with the present specification. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present description as detailed in the accompanying claims. The flow diagrams depicted in the figures are exemplary only and are not necessarily to be taken in the order shown. For example, some steps are juxtaposed and there is no strict order of logic, so the actual order of execution is variable.
Fig. 1 is a schematic flow chart of a data prediction method according to an embodiment of the present disclosure. In the embodiments in the present specification, the data prediction method is applied to a data prediction apparatus or an electronic device configured with the data prediction apparatus. The following details about the flow shown in fig. 1, the data prediction method specifically may include the following steps:
s102, acquiring time sequence data of a target transaction in a first preset time length;
in the embodiment of the present specification, first, time sequence data of a target transaction within a first preset duration is acquired.
The target transaction refers to a transaction for generating time series data, and can be funds, stocks, store transaction amounts and the like.
The first preset duration is a preset time length, for example, the first preset duration may be thirty days, and then time sequence data of the target transaction within thirty days is obtained.
It should be noted that, the time sequence data is transaction data generated by the target transaction within a first preset duration. For example, when the target transaction is a fund, the transaction data may be a daily purchase amount of the fund, and the first preset duration may be ten days, and the time sequence data includes daily purchase amounts of the fund corresponding to ten consecutive days respectively.
Preferably, the time sequence data not only comprises transaction data generated by the target transaction within a first preset time period, but also comprises covariate data corresponding to the transaction data.
S104, inputting time sequence data into a pre-trained position coding model to obtain position coding data, wherein the position coding data comprises a first position code and a second position code corresponding to the time sequence data, the second position code is used for indicating position indication information of predicted data of a target transaction, the predicted data is transaction data of the target transaction in a second preset time length after the first preset time length is predicted, and the second preset time length is the next preset time length adjacent to the first preset time length;
In the embodiment of the present disclosure, time-series data of a first preset duration corresponding to the obtained target transaction is input to a pre-trained position coding model, so as to obtain corresponding position coding data. The position coding data comprise a first position code and a second position code corresponding to time sequence data, the second position code is used for indicating position indication information of prediction data corresponding to a target transaction, the prediction data are transaction data with second preset duration obtained after the time sequence data with first preset duration are predicted, and the second preset duration is the next preset duration adjacent to the first preset duration.
It is understood that the position-coding model is a deep learning model for position-coding and position-coding prediction with respect to time-series data having time-series characteristics. It may be understood that in the embodiment of the present disclosure, the time sequence data is data generated by the target transaction within the first preset duration, and the time sequence data is input into the position coding model to obtain corresponding position coding data, where the position coding data includes not only a first position code corresponding to the time sequence data of the first preset duration, but also a second position code corresponding to the predicted data within the second preset duration. The first position code is a position code corresponding to time sequence data generated by a position code model according to time sequence characteristics contained in the time sequence data, and the second position code is a position code corresponding to prediction data generated by predicting the time sequence characteristics contained in the time sequence data.
The first position code is used for indicating position indication information corresponding to time sequence data of a first preset duration, and the second position code is used for indicating position indication information corresponding to prediction data of a second preset duration. The position indication information is used for representing the time sequence data and the associated information of the corresponding time sequence position, for example, the position indication information can indicate that the time sequence data has a maximum value in friday and a minimum value in friday, and the data prediction can be assisted based on the position indication information.
In one embodiment, the time sequence data is input into a pre-trained position coding model, the position coding model performs feature extraction processing on the time sequence data to obtain time sequence features corresponding to the time sequence data, and the position coding data is generated based on the extracted time sequence features.
In one embodiment, the time sequence data includes transaction data corresponding to the target transaction and covariate data corresponding to the transaction data, where the covariate data is transaction scenario data corresponding to the target transaction.
S106, inputting the time sequence data and the position coding data into a pre-trained time sequence prediction model to obtain the prediction data corresponding to the target transaction.
In the embodiment of the present disclosure, after obtaining position-coded data based on a position-coded model, the time-series data and the position-coded data are input into a pre-trained time-series prediction model, and the time-series prediction model predicts and obtains prediction data of a second preset duration based on the time-series data of the first preset duration and the corresponding position-coded data. The second preset time period is a preset time period adjacent to the first preset time period.
In one embodiment, after inputting the time sequence data and the position coding data into the pre-trained time sequence prediction model, the time sequence prediction model performs feature coding processing on the time sequence data and the position coding data respectively to obtain time sequence data features corresponding to the time sequence data and position coding features corresponding to the position coding data, and then performs data prediction according to the time sequence data features and the position coding features to obtain prediction data of a second preset duration corresponding to the target transaction.
In one embodiment, the position coding features include a first position coding feature corresponding to the time sequence data and a second position coding feature corresponding to the predicted data, and when data prediction is performed based on the time sequence data feature and the position coding feature, feature fusion processing is performed on the time sequence data feature and the first position coding feature to obtain a fused data feature, and then data prediction is performed according to the fused data feature and the second position coding feature to obtain predicted data of a second preset duration corresponding to the target transaction.
Preferably, before data prediction is performed according to the fused data feature and the second position coding feature, feature enhancement processing is performed on the fused data feature based on a self-attention mechanism, so as to obtain an enhanced fused data feature. And then, carrying out data prediction based on the enhanced fusion data characteristic and the second position coding characteristic to obtain prediction data of a second preset duration corresponding to the target transaction.
Preferably, before the data prediction is performed according to the fused data feature and the second position coding feature, feature enhancement processing is performed on the fused data feature and the second position coding feature based on an attention mechanism, so as to obtain the enhanced fused data feature and the enhanced second position coding feature. And then, carrying out data prediction based on the enhanced fusion data characteristic and the second position coding characteristic to obtain prediction data of a second preset duration corresponding to the target transaction.
The time series prediction model is a deep learning model for predicting time series data. The time series prediction model may predict and generate predicted data of a second preset duration based on the time series data of the first preset duration.
In a possible embodiment, the time sequence prediction model can be trained in combination with the position coding model, and the position coding model and the time sequence prediction model can be trained separately.
Referring to fig. 2, a system structure diagram of a data prediction method according to an embodiment of the present disclosure is provided. As shown in fig. 2, the method includes a pre-trained position coding model and a time sequence prediction model, wherein the position coding model is used for extracting time sequence characteristics in time sequence data, generating a first position code corresponding to the time sequence data and a second position code corresponding to the prediction data according to the time sequence characteristics, and the time sequence prediction model is used for performing data prediction according to the time sequence data and the position code data to obtain prediction data of a second preset duration.
In the embodiment of the specification, firstly, time sequence data of a target transaction in a first preset time length is acquired, then the time sequence data is input into a pre-trained position coding model to obtain position coding data, wherein the position coding data comprises a first position code and a second position code corresponding to the time sequence data, the second position code is used for indicating position indication information of prediction data of the target transaction, the prediction data is transaction data of the target transaction in a second preset time length after the first preset time length is predicted, the second preset time length is next preset time length adjacent to the first preset time length, finally, the time sequence data and the position coding data are input into a pre-trained time sequence prediction model to be predicted to obtain prediction data corresponding to the target transaction, the position coding and the position coding are performed on the time sequence data through an independent position coding model, the relation between time sequence characteristics and time sequence positions is fully refined, and then data prediction is performed on the basis of the position coding data and the time sequence data, and the accuracy and the stability of the time sequence data prediction can be effectively improved.
Referring to fig. 3, a flow chart of a data prediction method provided in an embodiment of the present disclosure is shown, where the data prediction method may include the following steps:
S202, acquiring time sequence data of a target transaction in a first preset time length;
in the embodiment of the present disclosure, the step S202 is referred to the detailed description of the step S102 in another embodiment of the present disclosure, and will not be repeated here.
S204, performing feature extraction processing on the time sequence data to obtain time sequence features corresponding to the time sequence data;
in the embodiment of the present disclosure, feature extraction processing is performed on the time sequence data of the first preset duration, so as to obtain a time sequence feature corresponding to the time sequence data.
The time sequence characteristic can be one or more of a periodic characteristic, a seasonal characteristic and a trend characteristic.
S206, generating position coding data based on the time sequence characteristics;
in the embodiment of the present specification, after extracting the timing characteristics corresponding to the timing data, the corresponding position-coded data is generated from the timing characteristics. The position coding data comprise a first position code corresponding to time sequence data of a first preset time length and a second position code corresponding to prediction data of a second preset time length, wherein the prediction data are transaction data corresponding to target transactions of the second preset time length to be predicted.
It should be noted that the time sequence features are data features included in the time sequence data of the first preset duration. The timing characteristics may include characteristics derived from time stamps, characteristics derived from timing values, and characteristics derived from attribute variables.
Wherein the time stamp derived features include time features, boolean features, time difference features. The time characteristic is an event date, such as a year, quarter, month, day of the week, etc., to which the data value corresponds. The boolean characteristics refer to whether the date to which the data value corresponds is a holiday, morning, evening, etc. The time difference feature refers to the time difference of a data value from the first recorded data value, or from the last recorded data value, or from any given data value.
Features derived from the time series values include hysteresis features, sliding window statistics, extended Sichuan statistics. Hysteresis characteristics refer to the high correlation of data values with yesterday, last week and last month and last year. The sliding window statistical feature refers to the statistical features such as the mean, the maximum, the minimum, the standard deviation, the variation coefficient and the like of each data value in one window period. The extended window statistics refers to statistics of the whole sequence of time series data.
Features derived from attribute variables include continuity variable features and category variable features. The continuous variable feature is a feature of a continuous variable accompanying time series data, and for example, when the time series data is stock data, there are also features accompanying a volume, a volume ratio, an opening price, and the like, in addition to a closing price. Category type variable characteristics refer to some fixed type information.
Alternatively, the timing characteristics may also be characteristics based on the statistical, spectral and time domains. The timing characteristics based on the statistical domain include Maximum (Maximum), minimum (Minimum), mean (Mean), median (Median), skewness (Skewness), kurtosis, histogram (Histogram), quartile range (Interquartile Range), absolute error Mean (Mean Absolute Deviation), median absolute error (Median Absolute Deviation), root Mean Square (Root Mean Square), standard deviation (Standard Deviation), variance (Variance), empirical distribution function percentile (Empirical Distribution Function Percentile Count), empirical distribution function Slope (ECDF Slope), and the like. Spectral domain based timing characteristics include fast fourier transform (Fast Fourier Transform), fourier transform average coefficient (FFT Mean Coefficient), wavelet transform (Wavelet Transform), wavelet absolute mean (Wavelet Absolute Mean), wavelet standard deviation (Wavelet Standard Deviation), wavelet Variance (Wavelet Variance), spectral distance (Spectral Distance), spectral fundamental frequency (Spectral Fundamental Frequency), spectral maximum frequency (Spectral Maximum Frequency), spectral intermediate frequency (Spectral Median Frequency), spectral maximum peak (Spectral Maximum Peaks), and the like. Time domain based features include Autocorrelation (autocorrection), centroid (Centroid), differential Mean (Mean Differences), differential absolute Mean (Mean Absolute Differences), differential median (Median Differences), differential absolute median (Median Absolute Differences), sum of differential absolute values (Sum of Absolute Differences), entropy (Entropy), peak-to-trough distance (Peak to Peak Distance), curve coverage (Area Under the Curve), maximum peak number (The Number of Maximum Peaks), minimum peak number (The Number of Minimum Peaks), zero crossing rate (Zero Crossing Rate), and the like.
In one embodiment, the time sequence data includes transaction data corresponding to the target transaction and covariate data corresponding to the transaction data, where the covariate data is transaction scenario data corresponding to the target transaction. The transaction data is transaction data corresponding to the target transaction, the covariate data is one or more data which is related to the target transaction and can influence the transaction data, for example, the target transaction is a fund buying amount, the transaction data is a fund buying amount on the same day, and the covariate data can be data such as the date on the same day, the day of the week, whether the date is a holiday or not, and the like.
S208, performing feature coding processing on the time sequence data and the position coding data respectively to obtain time sequence data features corresponding to the time sequence data and position coding features corresponding to the position coding data;
in the embodiment of the present disclosure, after obtaining the position-coded data, feature extraction processing is performed on the time-series data and the position-coded data of the first preset duration based on the pre-trained time-series prediction model, so as to obtain time-series data features corresponding to the time-series data and position-coded features corresponding to the position-coded data.
In one embodiment, the position-coding features include a first position-coding feature corresponding to time-series data of a first preset duration and a second position-coding feature corresponding to predicted data of a second preset duration.
S210, data prediction is carried out based on the time sequence data characteristics and the position coding characteristics, and prediction data corresponding to the target transaction is obtained.
In this embodiment of the present disclosure, the time sequence data feature is a data feature corresponding to time sequence data of a first preset duration, and the position coding feature includes a first position coding feature corresponding to time sequence data of the first preset duration and a second position coding feature corresponding to predicted data of a second preset duration, and then data prediction is performed based on the time sequence data feature, the first position coding feature and the second position coding feature, so that predicted data of the second preset duration corresponding to the target transaction can be obtained.
In one embodiment, the position coding feature includes a first position coding feature corresponding to the time sequence data and a second position coding feature corresponding to the predicted data, and then performing data prediction based on the time sequence data feature and the position coding feature to obtain the predicted data corresponding to the target transaction, which may include: and carrying out feature fusion processing on the time sequence data features and the first position coding features to obtain fused data features after fusion, and carrying out data prediction based on the fused data features and the second position coding features to obtain prediction data corresponding to the target transaction.
It can be understood that the time sequence data feature and the first position coding feature are data features derived based on time sequence data of a first preset duration, have a certain association relationship, perform feature fusion processing on the time sequence data feature and the first position coding feature to form a fusion data feature corresponding to the time sequence data of the first preset duration, and predict the prediction data based on the fusion data feature and a second position coding feature corresponding to the prediction data of a second preset duration, so that accuracy and stability of data prediction can be effectively improved.
Preferably, before data prediction is performed according to the fused data feature and the second position coding feature, feature enhancement processing is performed on the fused data feature based on a self-attention mechanism, so as to obtain an enhanced fused data feature. And then, carrying out data prediction based on the enhanced fusion data characteristic and the second position coding characteristic to obtain prediction data of a second preset duration corresponding to the target transaction.
Preferably, before the data prediction is performed according to the fused data feature and the second position coding feature, feature enhancement processing is performed on the fused data feature and the second position coding feature based on an attention mechanism, so as to obtain the enhanced fused data feature and the enhanced second position coding feature. And then, carrying out data prediction based on the enhanced fusion data characteristic and the second position coding characteristic to obtain prediction data of a second preset duration corresponding to the target transaction.
In the embodiment of the specification, firstly, time sequence data of a target transaction in a first preset time period is obtained, then feature extraction processing is carried out on the time sequence data to obtain time sequence features corresponding to the time sequence data, position coding data is generated based on the time sequence features, finally feature coding processing is carried out on the time sequence data and the position coding data respectively to obtain time sequence data features corresponding to the time sequence data and position coding features corresponding to the position coding data, data prediction is carried out based on the time sequence data features and the position coding features to obtain prediction data corresponding to the target transaction, position coding and position coding prediction are carried out on the time sequence data through an independent position coding model, the relation between the time sequence data and the time sequence positions is fully refined, and then data prediction is carried out based on the position coding data and the time sequence data, so that the accuracy and the stability of the time sequence data prediction can be effectively improved.
Referring to fig. 4, a flow chart of a data prediction method provided in the embodiment of the present disclosure is shown, where the data prediction method may include the following steps:
s302, acquiring time sequence data of a target transaction in a first preset time length;
in the embodiment of the present disclosure, the step S302 is referred to in another embodiment of the present disclosure for detailed description of the step S102, which is not repeated here.
S304, performing feature extraction processing on the time sequence data to obtain time sequence features corresponding to the time sequence data;
in the embodiment of the present disclosure, the step S304 is referred to in another embodiment of the present disclosure for detailed description of the step S204, which is not repeated here.
S306, generating position coding data based on the time sequence characteristics;
in the embodiment of the present disclosure, the step S306 is referred to in another embodiment of the present disclosure for detailed description of the step S206, which is not repeated here.
S308, respectively performing feature coding processing on the time sequence data and the position coding data to obtain time sequence data features corresponding to the time sequence data and position coding features corresponding to the position coding data;
in the embodiment of the present disclosure, step S308 is referred to in another embodiment of the present disclosure for detailed description of step S208, which is not repeated here.
S310, performing feature fusion processing on the time sequence data features and the first position coding features to obtain fused data features after fusion;
in this embodiment of the present disclosure, the position-coding features include a first position-coding feature corresponding to the time-series data and a second position-coding feature corresponding to the prediction data, and after obtaining the time-series data feature, the first position-coding feature, and the second position-coding feature, feature fusion processing is performed on the time-series data feature and the first position-coding feature, so as to obtain a fused data feature after fusion.
S312, data prediction is carried out based on the fusion data characteristics and the second position coding characteristics, and prediction data corresponding to the target transaction is obtained.
It can be understood that the time sequence data feature and the first position coding feature are data features derived based on time sequence data of a first preset duration, have a certain association relationship, perform feature fusion processing on the time sequence data feature and the first position coding feature to form a fusion data feature corresponding to the time sequence data of the first preset duration, and predict the prediction data based on the fusion data feature and a second position coding feature corresponding to the prediction data of a second preset duration, so that accuracy and stability of data prediction can be effectively improved.
Preferably, before data prediction is performed according to the fused data feature and the second position coding feature, feature enhancement processing is performed on the fused data feature based on a self-attention mechanism, so as to obtain an enhanced fused data feature. And then, carrying out data prediction based on the enhanced fusion data characteristic and the second position coding characteristic to obtain prediction data of a second preset duration corresponding to the target transaction.
Preferably, before the data prediction is performed according to the fused data feature and the second position coding feature, feature enhancement processing is performed on the fused data feature and the second position coding feature based on an attention mechanism, so as to obtain the enhanced fused data feature and the enhanced second position coding feature. And then, carrying out data prediction based on the enhanced fusion data characteristic and the second position coding characteristic to obtain prediction data of a second preset duration corresponding to the target transaction.
In the embodiment of the specification, firstly, time sequence data of a target transaction within a first preset duration is acquired, then, feature extraction processing is carried out on the time sequence data to obtain time sequence features corresponding to the time sequence data, position coding data is generated based on the time sequence features, finally, feature coding processing is carried out on the time sequence data and the position coding data respectively to obtain time sequence data features corresponding to the time sequence data and position coding features corresponding to the position coding data, feature fusion processing is carried out on the time sequence data features and the first position coding features to obtain fused data features, data prediction is carried out based on the fused data features and the second position coding features to obtain prediction data corresponding to the target transaction, position coding and position coding prediction are carried out on the time sequence data through an independent position coding model, the relation between the time sequence data and the time sequence positions is fully refined, and then, data prediction is carried out based on the position coding data and the time sequence data, and accuracy and stability of time sequence data prediction can be effectively improved.
Fig. 5 is a schematic flow chart of a training method of a position coding model according to an embodiment of the present disclosure. In the embodiments in the present specification, the position-coding model training method is applied to a position-coding model training apparatus or an electronic device configured with the position-coding model training apparatus. The following details about the flowchart shown in fig. 5, the method for training the position coding model specifically may include the following steps:
S402, a sample training data set is constructed, wherein the sample training data comprises sample time sequence data and a real position code corresponding to the sample time sequence data;
in the embodiment of the present specification, the sample training data is used for training a position coding model, wherein the sample time series data is used as input data of the position coding model, and the real position coding is used for providing supervision for output corresponding to the sample time series data so as to adjust model parameters according to the supervision.
S404, learning and training the sample training data based on a preset model training algorithm to obtain a trained position coding model.
In the embodiment of the present disclosure, after a sample training data set is obtained, learning and training are performed on the sample training data according to a preset model training algorithm, so as to obtain a trained position coding model. The preset model training algorithm is an algorithm for learning time sequence characteristics in the sample time sequence data.
Preferably, the pre-set model training algorithm includes, but is not limited to, a Prophet algorithm, a fourier transform algorithm, a decomposition prediction algorithm.
Alternatively, the preset model training algorithm may be other unsupervised algorithms that can learn timing characteristics.
In one embodiment, sample time sequence position features in sample time sequence data are extracted based on a preset model training algorithm, a prediction position code corresponding to the sample time sequence data is generated according to the sample time sequence position features, model parameters of a position code model are adjusted based on differences between the preset position code and a real position code, iterative training is performed based on each sample training data in a sample training data set until the position code model converges, and a trained position code model is obtained.
In the embodiment of the specification, a sample training data set is constructed, and then learning and training are performed on the sample training data based on a preset model training algorithm, so that a position coding model capable of extracting time sequence characteristics in time sequence data and generating position coding data according to the time sequence characteristics is obtained.
Fig. 6 is a schematic structural diagram of a data prediction apparatus according to an embodiment of the present disclosure. As shown in fig. 6, the data prediction apparatus 1 may be implemented as all or a part of an electronic device by software, hardware, or a combination of both. According to some embodiments, the data prediction apparatus 1 includes a data acquisition module 11, a position encoding module 12, and a data prediction module 13, and specifically includes:
the data acquisition module 11 is configured to acquire time sequence data of a target transaction within a first preset duration;
the position coding module 12 is configured to input the time-series data into a pre-trained position coding model to obtain position coding data, where the position coding data includes a first position code and a second position code corresponding to the time-series data, the second position code is used to indicate position indication information of predicted data of the target transaction, the predicted data is transaction data of the target transaction within a second preset time period after the first preset time period is predicted, and the second preset time period is a next preset time period adjacent to the first preset time period;
And the data prediction module 13 is configured to input the time sequence data and the position coding data into a pre-trained time sequence prediction model, so as to obtain prediction data corresponding to the target transaction.
Optionally, the position coding module 12 is specifically configured to:
performing feature extraction processing on the time sequence data to obtain time sequence features corresponding to the time sequence data;
the position-coded data is generated based on the timing characteristics.
Optionally, the time sequence data includes transaction data corresponding to the target transaction and covariate data corresponding to the transaction data, where the covariate data is transaction scene data corresponding to the target transaction.
Optionally, the data prediction module 13 is specifically configured to:
respectively carrying out feature coding processing on the time sequence data and the position coding data to obtain time sequence data features corresponding to the time sequence data and position coding features corresponding to the position coding data;
and carrying out data prediction based on the time sequence data characteristics and the position coding characteristics to obtain prediction data corresponding to the target transaction.
Optionally, the position-coding feature includes a first position-coding feature corresponding to the time-series data and a second position-coding feature corresponding to the predicted data, and the data prediction module 13 is specifically configured to, when executing the data prediction based on the time-series data feature and the position-coding feature to obtain the predicted data corresponding to the target transaction:
Performing feature fusion processing on the time sequence data features and the first position coding features to obtain fused data features after fusion;
and carrying out data prediction based on the fusion data characteristic and the second position coding characteristic to obtain prediction data corresponding to the target transaction.
Optionally, the data prediction module 13 is further configured to:
and carrying out feature enhancement processing on the fusion data features based on a self-attention mechanism to obtain enhanced fusion data features.
In the embodiment of the specification, firstly, time sequence data of a target transaction in a first preset time length is acquired, then the time sequence data is input into a pre-trained position coding model to obtain position coding data, wherein the position coding data comprises a first position code and a second position code corresponding to the time sequence data, the second position code is used for indicating position indication information of prediction data of the target transaction, the prediction data is transaction data of the target transaction in a second preset time length after the first preset time length is predicted, the second preset time length is next preset time length adjacent to the first preset time length, finally, the time sequence data and the position coding data are input into a pre-trained time sequence prediction model to be predicted to obtain prediction data corresponding to the target transaction, the position coding and the position coding are performed on the time sequence data through an independent position coding model, the relation between time sequence characteristics and time sequence positions is fully refined, and then data prediction is performed on the basis of the position coding data and the time sequence data, and the accuracy and the stability of the time sequence data prediction can be effectively improved.
It should be noted that, in the data prediction apparatus provided in the foregoing embodiment, only the division of the foregoing functional modules is used as an example when the data prediction method is executed, and in practical application, the foregoing functional allocation may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the data prediction apparatus and the data prediction method embodiment provided in the foregoing embodiments belong to the same concept, which embody the detailed implementation process in the method embodiment, and are not described herein again.
The foregoing embodiment numbers of the present specification are merely for description, and do not represent advantages or disadvantages of the embodiments.
Fig. 7 is a schematic structural diagram of a training device for a position coding model according to an embodiment of the present disclosure. As shown in fig. 7, the position-coding model training device 2 may be implemented as all or a part of the electronic apparatus by software, hardware, or a combination of both. According to some embodiments, the position-coding model training device 2 comprises a sample construction module 21 and a model training module 22, and specifically comprises:
a sample construction module 21, configured to construct a sample training data set, where the sample training data includes sample time sequence data and a true position code corresponding to the sample time sequence data;
The model training module 22 is configured to learn and train the sample training data based on a preset model training algorithm, so as to obtain a trained position coding model.
Optionally, the model training module 22 is specifically configured to:
extracting sample time sequence position features in the sample time sequence data based on the preset model training algorithm;
generating a prediction position code corresponding to the sample time sequence data according to the sample time sequence position characteristics;
adjusting model parameters of a position coding model based on a difference between the preset position coding and the real position coding;
and performing iterative training based on each sample training data in the sample training data set until the position coding model converges, and obtaining the trained position coding model.
Optionally, the preset model training algorithm includes any one of a Prophet algorithm, a fourier transform algorithm and a decomposition prediction algorithm.
In the embodiment of the specification, a sample training data set is constructed, and then learning and training are performed on the sample training data based on a preset model training algorithm, so that a position coding model capable of extracting time sequence characteristics in time sequence data and generating position coding data according to the time sequence characteristics is obtained.
It should be noted that, when the position coding model training device provided in the above embodiment performs the data prediction method, only the division of the above functional modules is used for illustration, and in practical application, the above functional allocation may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the position coding model training device and the position coding model training method provided in the above embodiments belong to the same concept, which embody detailed implementation procedures in the method embodiments, and are not described herein again.
The foregoing embodiment numbers of the present specification are merely for description, and do not represent advantages or disadvantages of the embodiments.
The embodiment of the present disclosure further provides a computer storage medium, where the computer storage medium may store a plurality of instructions, where the instructions are adapted to be loaded by a processor and executed by the processor to perform the data prediction method in the embodiment shown in fig. 1 to 5, and the specific execution process may refer to the specific description of the embodiment shown in fig. 1 to 5, which is not repeated herein.
The present disclosure further provides a computer program product, where at least one instruction is stored, where the at least one instruction is loaded by the processor and executed by the processor to perform the data prediction method according to the embodiment shown in fig. 1 to 5, and the specific execution process may refer to the specific description of the embodiment shown in fig. 1 to 5, which is not repeated herein.
Referring to fig. 8, a block diagram of an electronic device according to an embodiment of the present disclosure is provided. The electronic device in this specification may include one or more of the following: processor 110, memory 120, input device 130, output device 140, and bus 150. The processor 110, the memory 120, the input device 130, and the output device 140 may be connected by a bus 150.
Processor 110 may include one or more processing cores. The processor 110 connects various parts within the overall terminal using various interfaces and lines, performs various functions of the terminal 100 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and invoking data stored in the memory 120. Alternatively, the processor 110 may be implemented in at least one hardware form of digital signal processing (digital signal processing, DSP), field-programmable gate array (field-programmable gate array, FPGA), programmable logic array (programmable logic Array, PLA). The processor 110 may integrate one or a combination of several of a central processor (central processing unit, CPU), an image processor (graphics processing unit, GPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for being responsible for rendering and drawing of display content; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the processor 110 and may be implemented solely by a single communication chip.
The memory 120 may include a random access memory (random Access Memory, RAM) or a read-only memory (ROM). Optionally, the memory 120 includes a non-transitory computer readable medium (non-transitory computer-readable storage medium). Memory 120 may be used to store instructions, programs, code, sets of codes, or sets of instructions.
The input device 130 is configured to receive input instructions or data, and the input device 130 includes, but is not limited to, a keyboard, a mouse, a camera, a microphone, or a touch device. The output device 140 is used to output instructions or data, and the output device 140 includes, but is not limited to, a display device, a speaker, and the like. In the embodiment of the present disclosure, the input device 130 may be a temperature sensor for acquiring an operation temperature of the terminal. The output device 140 may be a speaker for outputting audio signals.
In addition, those skilled in the art will appreciate that the configuration of the terminal illustrated in the above-described figures does not constitute a limitation of the terminal, and the terminal may include more or less components than illustrated, or may combine certain components, or may have a different arrangement of components. For example, the terminal further includes components such as a radio frequency circuit, an input unit, a sensor, an audio circuit, a wireless fidelity (wireless fidelity, WIFI) module, a power supply, a bluetooth module, and the like, which are not described herein again.
In the embodiment of the present specification, the execution subject of each step may be the terminal described above. Optionally, the execution subject of each step is an operating system of the terminal. The operating system may be an android system, an IOS system, or other operating systems, which embodiments of the present specification are not limited to.
In the electronic device of fig. 8, the processor 110 may be configured to invoke the data prediction program stored in the memory 120 and execute to implement the data prediction methods as described in the various method embodiments of the present description.
In the embodiment of the specification, firstly, time sequence data of a target transaction in a first preset time length is acquired, then the time sequence data is input into a pre-trained position coding model to obtain position coding data, wherein the position coding data comprises a first position code and a second position code corresponding to the time sequence data, the second position code is used for indicating position indication information of prediction data of the target transaction, the prediction data is transaction data of the target transaction in a second preset time length after the first preset time length is predicted, the second preset time length is next preset time length adjacent to the first preset time length, finally, the time sequence data and the position coding data are input into a pre-trained time sequence prediction model to be predicted to obtain prediction data corresponding to the target transaction, the position coding and the position coding are performed on the time sequence data through an independent position coding model, the relation between time sequence characteristics and time sequence positions is fully refined, and then data prediction is performed on the basis of the position coding data and the time sequence data, and the accuracy and the stability of the time sequence data prediction can be effectively improved.
It will be clear to a person skilled in the art that the solution according to the present description can be implemented by means of software and/or hardware. "Unit" and "module" in this specification refer to software and/or hardware capable of performing a specific function, either alone or in combination with other components, such as Field programmable gate arrays (Field-Programmable Gate Array, FPGAs), integrated circuits (Integrated Circuit, ICs), etc.
It should be noted that, for simplicity of description, the foregoing method embodiments are all expressed as a series of action combinations, but it should be understood by those skilled in the art that the present description is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present description. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required in the specification.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in this specification, it should be understood that the disclosed apparatus may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, such as the division of the units, merely a logical function division, and there may be additional manners of dividing the actual implementation, such as multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some service interface, device or unit indirect coupling or communication connection, electrical or otherwise.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present specification may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
Those of ordinary skill in the art will appreciate that all or a portion of the steps in the various methods of the above embodiments may be performed by hardware associated with a program that is stored in a computer readable memory, which may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing is merely exemplary embodiments of the present specification and is not intended to limit the scope of the present specification. It is intended that all equivalent variations and modifications as taught herein fall within the scope of the present disclosure. Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure herein. This specification is intended to cover any variations, uses, or adaptations of the specification following, in general, the principles of the specification and including such departures from the present disclosure as come within known or customary practice within the art to which the specification pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the specification being indicated by the following claims.

Claims (14)

1. A method of data prediction, the method comprising:
acquiring time sequence data of a target transaction within a first preset time length;
inputting the time sequence data into a pre-trained position coding model to obtain position coding data, wherein the position coding data comprises a first position code and a second position code corresponding to the time sequence data, the second position code is used for indicating position indication information of predicted data of the target transaction, the predicted data is transaction data of the target transaction in a second preset duration after the first preset duration is predicted, and the second preset duration is the next preset duration adjacent to the first preset duration;
and inputting the time sequence data and the position coding data into a pre-trained time sequence prediction model to obtain prediction data corresponding to the target transaction.
2. The method of claim 1, the inputting the time series data into the pre-trained position-coding model to obtain position-coding data, comprising:
performing feature extraction processing on the time sequence data to obtain time sequence features corresponding to the time sequence data;
the position-coded data is generated based on the timing characteristics.
3. The method of claim 1, the timing data comprising transaction data corresponding to the target transaction and covariate data corresponding to the transaction data, the covariate data being transaction context data corresponding to the target transaction.
4. The method of claim 1, the inputting the time series data and the position coding data into a pre-trained time series prediction model to obtain the prediction data corresponding to the target transaction, comprising:
respectively carrying out feature coding processing on the time sequence data and the position coding data to obtain time sequence data features corresponding to the time sequence data and position coding features corresponding to the position coding data;
and carrying out data prediction based on the time sequence data characteristics and the position coding characteristics to obtain prediction data corresponding to the target transaction.
5. The method of claim 4, the position-coding features comprising first position-coding features corresponding to the temporal data and second position-coding features corresponding to the prediction data;
the data prediction based on the time sequence data characteristic and the position coding characteristic is performed to obtain prediction data corresponding to the target transaction, and the method comprises the following steps:
Performing feature fusion processing on the time sequence data features and the first position coding features to obtain fused data features after fusion;
and carrying out data prediction based on the fusion data characteristic and the second position coding characteristic to obtain prediction data corresponding to the target transaction.
6. The method according to claim 5, wherein before the predicting data based on the fused data feature and the second position-coding feature to obtain the predicted data corresponding to the target transaction, further comprising:
and carrying out feature enhancement processing on the fusion data features based on a self-attention mechanism to obtain enhanced fusion data features.
7. A method of training a position-coding model, comprising:
constructing a sample training data set, wherein the sample training data comprises sample time sequence data and a real position code corresponding to the sample time sequence data;
and carrying out learning training on the sample training data based on a preset model training algorithm to obtain a trained position coding model.
8. The method of claim 7, wherein the training the sample training data based on the preset model training algorithm to obtain a trained position coding model comprises:
Extracting sample time sequence position features in the sample time sequence data based on the preset model training algorithm;
generating a prediction position code corresponding to the sample time sequence data according to the sample time sequence position characteristics;
adjusting model parameters of a position coding model based on a difference between the preset position coding and the real position coding;
and performing iterative training based on each sample training data in the sample training data set until the position coding model converges, and obtaining the trained position coding model.
9. The method according to any one of claims 7 or 8, wherein the preset model training algorithm comprises any one of a propset algorithm, a fourier transform algorithm, and a decomposition prediction algorithm.
10. A data prediction apparatus comprising:
the data acquisition module is used for acquiring time sequence data of the target transaction within a first preset duration;
the position coding module is used for inputting the time sequence data into a pre-trained position coding model to obtain position coding data, the position coding data comprise a first position code and a second position code corresponding to the time sequence data, the second position code is used for indicating position indication information of prediction data of the target transaction, the prediction data are transaction data of the target transaction in a second preset time length after the first preset time length is predicted, and the second preset time length is the next preset time length adjacent to the first preset time length;
And the data prediction module is used for inputting the time sequence data and the position coding data into a pre-trained time sequence prediction model to obtain the prediction data corresponding to the target transaction.
11. A position-coding model training device, comprising:
the sample construction module is used for constructing a sample training data set, wherein the sample training data comprises sample time sequence data and a real position code corresponding to the sample time sequence data;
and the model training module is used for learning and training the sample training data based on a preset model training algorithm to obtain a trained position coding model.
12. A storage medium having stored thereon a computer program, which when executed by a processor performs the steps of the method according to any of claims 1-6 or 7-9.
13. An electronic device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the steps of the method according to any of claims 1-6 or 7-9.
14. A computer program product having stored thereon at least one instruction, which when executed by a processor, implements the steps of the method of any of claims 1 to 6 or 7 to 9.
CN202311125356.3A 2023-09-01 2023-09-01 Data prediction method, device, storage medium and equipment Pending CN117235469A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311125356.3A CN117235469A (en) 2023-09-01 2023-09-01 Data prediction method, device, storage medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311125356.3A CN117235469A (en) 2023-09-01 2023-09-01 Data prediction method, device, storage medium and equipment

Publications (1)

Publication Number Publication Date
CN117235469A true CN117235469A (en) 2023-12-15

Family

ID=89083567

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311125356.3A Pending CN117235469A (en) 2023-09-01 2023-09-01 Data prediction method, device, storage medium and equipment

Country Status (1)

Country Link
CN (1) CN117235469A (en)

Similar Documents

Publication Publication Date Title
CN110353675B (en) Electroencephalogram signal emotion recognition method and device based on picture generation
CN108520324A (en) Method and apparatus for generating information
JP7520142B2 (en) Method for identifying sigma-line patterns and electronic device
CN112163558A (en) Time series data feature extraction method, device, equipment and storage medium
CN105335595A (en) Feeling-based multimedia processing
CN108256626A (en) The Forecasting Methodology and device of time series
US20140279815A1 (en) System and Method for Generating Greedy Reason Codes for Computer Models
CN117113087A (en) Model training method, device, electronic equipment and storage medium
Srikanth et al. A novel three-dimensional deep learning algorithm for classification of power system faults
CN113869599A (en) Fish epidemic disease development prediction method, system, equipment and medium
WO2021047376A1 (en) Data processing method, data processing apparatus and related devices
CN117235469A (en) Data prediction method, device, storage medium and equipment
CN107918584A (en) Information generating system, device, method and computer-readable recording medium
CN112489675A (en) Multi-channel blind source separation method and device, machine readable medium and equipment
CN110019940A (en) A kind of video display method for pushing and device
CN116910549A (en) Model training method, device, computer equipment and storage medium
CN116186541A (en) Training method and device for recommendation model
CN115424725A (en) Data analysis method and device, storage medium and processor
CN115496993A (en) Target detection method, device and equipment based on frequency domain fusion and storage medium
CN114415115A (en) Target signal frequency automatic optimization method for assisting direction of arrival positioning
CN113742593A (en) Method and device for pushing information
CN113782217A (en) Human health condition grading method and device
CN108734693B (en) Method and apparatus for generating information
CN112419216A (en) Image interference removing method and device, electronic equipment and computer readable storage medium
CN116911431A (en) Data flow prediction model training method, device, storage medium and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination