CN117807384A - Prediction method and device, storage medium and electronic equipment - Google Patents

Prediction method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN117807384A
CN117807384A CN202211145313.7A CN202211145313A CN117807384A CN 117807384 A CN117807384 A CN 117807384A CN 202211145313 A CN202211145313 A CN 202211145313A CN 117807384 A CN117807384 A CN 117807384A
Authority
CN
China
Prior art keywords
prediction
data
time
historical
real
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
CN202211145313.7A
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun 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 Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202211145313.7A priority Critical patent/CN117807384A/en
Publication of CN117807384A publication Critical patent/CN117807384A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

The invention discloses a prediction method, a prediction device, a storage medium and electronic equipment. The method comprises the following steps: acquiring offline data of a predicted object, real-time data at the current moment and a predicted result at the historical moment; and processing the offline data, the real-time data and the prediction results of the historical time based on the prediction model corresponding to the current time to obtain the current prediction results of the prediction object. The real-time data can include real-time regulation data of a predicted object, the real-time data at the current moment is predicted, the accuracy of a predicted result can be improved, and the predicted result at the historical moment is used as priori information, so that the interference of local data on the predicted result is reduced, and the accuracy of the predicted result is improved. Furthermore, by setting different prediction models in different time periods and calling the prediction model corresponding to the current moment at the current moment, the prediction pertinence and accuracy of the prediction model are improved.

Description

Prediction method and device, storage medium and electronic equipment
Technical Field
The invention relates to the technical field of intelligent supply chains, in particular to a prediction method, a prediction device, a storage medium and electronic equipment.
Background
Time Series (TS) predictions are information that uses data of a past period of Time to predict a future period of Time. In many business scenarios, some timing predictions need to be made, such as predicting future sales, GMV, number of users, etc.
In the process of realizing the invention, the prior art is found to have at least the following technical problems: the current time sequence prediction method has poor real-time prediction accuracy.
Disclosure of Invention
The invention provides a prediction method, a prediction device, a storage medium and electronic equipment, so as to improve the accuracy of real-time prediction.
According to an aspect of the present invention, there is provided a prediction method including:
acquiring offline data of a predicted object, real-time data at the current moment and a predicted result at the historical moment;
and processing the offline data, the real-time data and the prediction results of the historical time based on the prediction model corresponding to the current time to obtain the current prediction results of the prediction object.
Optionally, the prediction model includes a feature extraction module and a cyclic prediction module;
the processing the offline data, the real-time data and the prediction result of the historical moment based on the prediction model corresponding to the current moment to obtain the current prediction result of the prediction object comprises the following steps:
Inputting the offline data and the real-time data to the feature extraction module to obtain object features;
and inputting the object characteristics and the prediction results of the historical time to the cyclic prediction module to obtain the current prediction results of the predicted object.
Optionally, the feature extraction module includes a first feature extraction module and a second feature extraction module, where the first feature extraction module and the second feature extraction module are arranged in parallel;
the step of inputting the offline data and the real-time data to the feature extraction module to obtain object features includes:
and respectively inputting the offline data and the real-time data to the first feature extraction module and the second feature extraction module to obtain a first object feature and a second object feature, wherein the first object feature and the second object feature are fused to obtain the object feature.
Optionally, the training process of the prediction model includes:
sampling data in historical data of a predicted object in a preset historical time period before a current time period, and determining training data;
and training the prediction model to be trained based on the training data to obtain the prediction model of the current period.
Optionally, the data sampling is performed in the historical data of the predicted object in a preset historical time period before the current time period, and the determining the training data includes:
determining sampling probability of the historical data based on time information of the historical data under the condition that the number of the historical data in a preset historical time period is smaller than or equal to the preset number, and performing replaced sampling on each historical data based on the sampling probability of each historical data to determine training data;
and under the condition that the number of the historical data in the preset historical time period is larger than the preset number, randomly sampling the historical data to determine training data.
Optionally, the method further comprises:
obtaining a prediction result of a history prediction model corresponding to the history time for each time and an actual result of the corresponding time, and determining a loss function based on the prediction result and the actual result of the same time;
and training the prediction model to be trained based on the loss function.
Optionally, the prediction object is a sold article, and the prediction result is sales of the sold article in a future period.
According to another aspect of the present invention, there is provided a prediction apparatus including:
The data acquisition module is used for acquiring offline data of a predicted object, real-time data at the current moment and a predicted result of the historical moment;
and the prediction module is used for processing the offline data, the real-time data and the prediction results of the historical time based on the prediction model corresponding to the current time to obtain the current prediction results of the prediction object.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the prediction method of any one of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to execute a prediction method according to any one of the embodiments of the present invention.
According to the technical scheme, the offline data, the real-time data and the prediction results of the historical moment of the prediction object are obtained, the prediction results of the offline data, the real-time data and the historical moment are processed based on the prediction model corresponding to the current moment, and therefore the high-precision real-time prediction results can be obtained, wherein the real-time data can comprise real-time regulation and control data of the prediction object, the real-time data of the current moment is predicted, accuracy of the prediction results can be improved, and the prediction results of the historical moment are used as priori information, interference of local data on the prediction results is reduced, and accuracy of the prediction results is improved. Furthermore, by setting different prediction models in different time periods and calling the prediction model corresponding to the current moment at the current moment, the prediction pertinence and accuracy of the prediction model are improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and 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 prediction method provided by an embodiment of the present invention;
FIG. 2 is a schematic diagram of a prediction model according to an embodiment of the present invention;
FIG. 3 is a flow chart of a prediction method provided by an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a prediction model according to an embodiment of the present invention;
FIG. 5 is a schematic flow diagram of a prediction apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Fig. 1 is a flowchart of a prediction method provided in an embodiment of the present invention, where the present embodiment is applicable to a case of predicting a predicted object in real time, the method may be performed by a prediction apparatus, and the prediction apparatus may be implemented in the form of hardware and/or software, and the prediction apparatus may be configured in an electronic device such as a computer or a server. As shown in fig. 1, the method includes:
s110, acquiring offline data of a predicted object, real-time data at the current moment and a predicted result of a historical moment.
S120, processing the offline data, the real-time data and the prediction results of the historical time based on the prediction model corresponding to the current time to obtain the current prediction results of the prediction object.
In this embodiment, the prediction object is predicted in real time, and the type of the prediction object and the prediction scene of the prediction object are not limited. And setting different prediction models under different prediction scenes to obtain a prediction result under the corresponding prediction scenes.
In some embodiments, the prediction object is a sold item, the prediction result is a sales amount of the sold item in a future period, and the prediction model may be a sales amount prediction model. By predicting sales of the sold goods in the future time period in real time, timely and accurate stock preparation is facilitated according to the predicted sales, and the situations of insufficient stock caused by insufficient stock preparation and stock remainder caused by excessive stock preparation are avoided. The sold items may include, but are not limited to, physical items, or virtual items of data resources, etc.
The offline data of the prediction object may be data of the prediction object which does not change with time, the real-time data of the prediction object is data of which there is an association relation to the prediction result of the prediction object and which changes with time, and the real-time data of the prediction object is data of the current time. Taking the predicted object as the sold item as an example, the offline data may include, but is not limited to, item attribute data, historical time series characteristic data, etc., wherein the item attribute data includes, but is not limited to, item type, place of production, manufacturer, item weight, size, color, etc. The historical timing characteristic data may be historical sales statistics. The real-time data comprises, but is not limited to, meteorological data, flow characteristic data, pit characteristic data, operation strategy data and the like, wherein the meteorological data is acquired at the current moment and comprises the meteorological data at the current moment and/or the meteorological data of a future period; the flow characteristic data may be an accessed amount of the prediction object before the current time; the pit characteristic data may be pit data for displaying the predicted object, where the pit is used for displaying information such as an image, a link address, etc. of the predicted object, and the pit characteristic data may include, but is not limited to, a pit position, a pit rank, a pit size, a display time period, etc. acquired at the current time. The operational policy data may be a sales policy of the current time forecast object including, but not limited to, sales price, place of sales, offers, etc.
It should be noted that the real-time data and the offline data of different types of prediction objects may be different, and the real-time data and the offline data of the same prediction object may be different in different prediction scenes. And determining corresponding real-time data and offline data according to the predicted object and the predicted scene of the predicted object.
The prediction result of the historical moment is a prediction result obtained by predicting the prediction object through real-time data and offline data of the historical moment. Taking the sales prediction scene of the sold articles as an example, the prediction result of the prediction object can be the predicted sales including different time periods in the future, and correspondingly, the prediction result of the historical moment can be the predicted sales of the time period to which the current moment belongs. In some embodiments, the predicted outcome of the predicted object may include a predicted sales for a plurality of time periods in the future, including, for example, a predicted sales for one hour in the future, a predicted sales for two hours in the future, a predicted sales for the day, a predicted sales for the next day, and the like, and the predicted outcome of the historical time may include a predicted sales for a plurality of time periods in the future after the current time predicted at the historical time.
In some embodiments, the prediction results of the historical time may include prediction results of a plurality of historical time, for example, including a prediction result of a previous hour, a prediction result of a previous two hours, a prediction result of a previous day, and the like, and by acquiring the prediction results of a plurality of historical time, accuracy of the prior information is improved, and accuracy of the prediction result of the current time is further improved. The prediction result of the historical time may be in the form of a vector or a matrix, which is not limited.
And the prediction result of the historical moment is used as priori information, and the prediction process of the current moment is assisted, so that the accuracy of the prediction result of the current moment is improved.
In this embodiment, a prediction model of each period is preset to predict the prediction object in the period, where the duration of each period may be predetermined, and exemplary, each period may be 1 hour or one day, etc., which is not limited. And calling the latest prediction model at the current moment, or determining the period to which the current moment belongs, calling the prediction model corresponding to the period to which the current moment belongs, and processing the obtained offline data, real-time data and the prediction result of the historical moment based on the called prediction model to obtain the prediction result output by the prediction model.
According to the technical scheme provided by the embodiment, the offline data, the real-time data and the prediction results of the historical moment of the prediction object are obtained, the prediction results of the offline data, the real-time data and the historical moment are processed based on the prediction model corresponding to the current moment, and therefore the high-precision real-time prediction results can be obtained, wherein the real-time data can comprise the real-time regulation and control data of the prediction object, the real-time data of the current moment is predicted, accuracy of the prediction results can be improved, and the prediction results of the historical moment are used as priori information, interference of local data on the prediction results is reduced, and accuracy of the prediction results is improved. Furthermore, by setting different prediction models in different time periods and calling the prediction model corresponding to the current moment at the current moment, the prediction pertinence and accuracy of the prediction model are improved.
On the basis of the embodiment, the prediction model comprises a feature extraction module and a cyclic prediction module; the feature extraction module is used for extracting features of the input information, and the cyclic prediction module is connected with the feature extraction module and is used for carrying out cyclic prediction processing on the feature information extracted by the feature extraction module and the prediction result of the historical moment to obtain the current prediction result of the prediction object. Referring to fig. 2, fig. 2 is a schematic structural diagram of a prediction model according to an embodiment of the present invention.
The feature extraction module may be a network block, for example, may include, but is not limited to, a convolutional network block, a transform network block, etc., and the cyclic prediction module may be a cyclic neural network block, including, but not limited to, an RNN (Recurrent Neural Network, cyclic neural network) network block, an LSTM (Long Short-Term Memory) artificial neural network) network block, etc.
Correspondingly, the offline data, the real-time data and the prediction result of the historical moment are processed based on the prediction model corresponding to the current moment to obtain the current prediction result of the prediction object, and the method comprises the following steps: inputting the offline data and the real-time data to the feature extraction module to obtain object features; and inputting the object characteristics and the prediction results of the historical time to the cyclic prediction module to obtain the current prediction results of the predicted object.
Before the offline data and the real-time data are input, the offline data and the real-time data may be preprocessed, where the preprocessing may include converting the offline data and the real-time data into vector data, where the vector data may be an ebedding vector, for example, the offline data and the real-time data may be vector-converted in advance through a preset coding model, and the converted offline data vector and real-time data vector are combined into input information, where the input information may be in the form of an input vector or a data matrix, and input to a feature extraction module of the prediction model.
The cycle prediction module processes the feature information extracted by the feature extraction module and the prediction result of the historical moment, and the accuracy of the prediction result of the current moment is improved by combining the prediction result of the historical moment. Meanwhile, the feature extraction module is arranged to perform feature extraction on the real-time data and the offline data at the current moment to obtain relevant feature information at the current moment, and the cyclic prediction module is arranged to combine the relevant feature information at the current moment with the prediction result at the historical moment to obtain the prediction result, so that the feature information at the current moment and the feature information at the historical moment are considered, the comprehensiveness of the information is improved, and the accuracy of the prediction result is further improved.
In some embodiments, the prediction result of the history time input at the cyclic prediction module is a prediction result of the history time before a preset time point, where the preset time point may be a time point for dividing a prediction period, for example, the prediction period is one day, and the preset time point is 24:00. In some embodiments, the input information of the feature extraction module includes offline data, real-time data at the current time, and a prediction result of a historical time before the current time after a preset time point. Illustratively, the input information of the feature extraction module includes offline data, real-time data of the current time and prediction results of each historical time in the current day, and the input information at the loop prediction module includes the feature information extracted by the feature extraction module and the prediction results of the historical time before the current day (e.g., the prediction results of yesterday to today).
On the basis of the embodiment, the feature extraction module comprises a first feature extraction module and a second feature extraction module, and the first feature extraction module and the second feature extraction module are arranged in parallel; the first feature extraction module and the second feature extraction module are arranged in parallel and are respectively connected with the cyclic prediction module, and feature information respectively extracted by the first feature extraction module and the second feature extraction module is fused and then is used as object features to be input into the cyclic prediction module.
Correspondingly, inputting the offline data and the real-time data to the feature extraction module to obtain object features, including: and respectively inputting the offline data and the real-time data to the first feature extraction module and the second feature extraction module to obtain a first object feature and a second object feature, wherein the first object feature and the second object feature are fused to obtain the object feature. The network blocks of the first feature extraction module and the second feature extraction module are different in type, feature extraction is carried out on input information through the network blocks of different types to obtain different first object features and second object features, and the first object features and the second object features are fused to obtain object features with more comprehensive feature information.
In some embodiments, the first feature extraction module is configured to extract feature information of the input data itself, and the second feature extraction module is configured to extract interactive feature data between the input data. By arranging the different first feature extraction modules and the second feature extraction modules, the comprehensiveness of the obtained object features is improved, and the accuracy of the prediction result is further improved. The fusing of the first object feature and the second object feature may be to perform feature combination on the first object feature and the second object feature to form a feature vector.
Alternatively, the first feature extraction module may be a DNN (Deep Neural Networks, deep neural network) network block and the second feature extraction module may be an FM network block.
According to the technical scheme, the feature extraction is respectively carried out on the input real-time data and the offline time through the feature extraction modules of different types, and the object features respectively extracted by the feature extraction modules of different types are combined to obtain final object features, so that the comprehensiveness of the extracted feature information is improved. And the object characteristics corresponding to the current moment and the prediction results of the historical moment are combined through the cyclic prediction module, and cyclic prediction is carried out, so that the accuracy of the prediction results is improved.
On the basis of the above embodiment, the corresponding prediction model is trained separately in each period, where the training process of the prediction model includes: sampling data in historical data of a predicted object in a preset historical time period before a current time period, and determining training data; and training the prediction model to be trained based on the training data to obtain the prediction model of the current period.
In this embodiment, by determining the training data in the preset historical time period before each time period, that is, the training data used for training each prediction model includes the training data in the newly added time period, the training data is updated, and the prediction accuracy of the prediction model obtained by training is ensured.
Optionally, the data sampling is performed in the history data of the predicted object in a preset history period before the current period, and the determining the training data includes: and under the condition that the number of the historical data in the preset historical time period is larger than the preset number, randomly sampling the historical data to determine the preset number of training data. In order to ensure the training accuracy of the prediction model, the amount of training data needs to be ensured, wherein the preset amount may be determined according to the training requirement, which is not limited herein. And randomly sampling historical data in a preset historical time period to obtain training data meeting a preset quantity so as to train the prediction model.
In some embodiments, for long tail products, the number of pin moves is small within a preset history period, and the fact that the number of history data within the preset history period is greater than the preset number cannot be satisfied, results in the situation that the sampled data is small. Optionally, the data sampling is performed in the history data of the predicted object in a preset history period before the current period, and the determining the training data includes: and under the condition that the number of the historical data in the preset historical time period is smaller than or equal to the preset number, determining the sampling probability of the historical data based on the time information of the historical data, and sampling the historical data again based on the sampling probability of each historical data to determine the training data.
And determining the sampling probability of the historical data according to the time information of each historical data, wherein the time information of the historical data can be the corresponding selling time of the historical data, and the sampling probability is inversely related to the time length from the time information of the historical data to the current moment, namely the sampling probability of a historical sample which is closer to the current moment is larger. By setting sampling probability for each historical data and simultaneously sampling each historical data again, the historical data of different objects are guaranteed to have the same weight, and the extracted training data is prevented from tilting towards the objects with more historical data.
The determination mode of the training data in the embodiment ensures the equalization of the extracted historical data and avoids the condition that objects with more historical data are sampled in a large proportion.
And training the prediction model by the training data obtained by sampling, so as to obtain a prediction model of the current period, and carrying out prediction processing on each prediction object in the current period.
In the above embodiment, the method further comprises: obtaining a prediction result of a history prediction model corresponding to the history time for each time and an actual result of the corresponding time, and determining a loss function based on the prediction result and the actual result of the same time; and training the prediction model to be trained based on the loss function.
And in the historical period, processing the offline time and the real-time data of the predicted object at the historical moment based on the historical model to obtain a predicted result of the predicted object at the historical moment. At the current time, an actual result of the predicted object may be obtained that matches the predicted result at the historical time. For example, the historical time may be 10:00, the predicted result of the historical time may be a predicted sales of the predicted object of 11:00, and the current time may be 11:00, and accordingly, an actual sales of 11:00, that is, an actual result, may be obtained.
In the embodiment, the loss function is determined through the prediction result and the actual result at the same time, and the network parameters of the prediction model of the current period are adjusted based on the loss function, so that the requirement for training data in the training process of the prediction model of the current period is reduced, meanwhile, the processing process of sample data in the training process of the prediction model of the current period is reduced, the network parameters of the prediction model of the current period are adjusted directly based on the loss function, and the training efficiency of the prediction model is improved.
It should be noted that, the prediction model to be trained may be trained based on the prediction result of the history model on the history data and the loss function determined by the corresponding actual result, and then the prediction model may be further trained by the training data obtained by sampling, so as to obtain the prediction model. The prediction model can be trained based on the training data obtained by sampling, and then the prediction model to be trained is trained based on the prediction result of the historical data by the historical model and a loss function determined by the corresponding actual result, so as to obtain the prediction model; this is not limited thereto.
On the basis of the embodiment, the embodiment of the invention also provides a preferable example of the prediction method, wherein the prediction scene is the sales prediction of the sold objects. Referring to fig. 3, fig. 3 is a process schematic diagram of a prediction method according to an embodiment of the present invention. An offline model training process and a real-time prediction process are included in fig. 3.
And collecting real-time data and offline data of the prediction object, and training a prediction model and predicting sales of the prediction object based on the prediction model. The real-time data of each channel is collected, service is calculated in real time through the Flink, and characteristics are processed and stored in a database. The real-time data has real-time value, and timely correction is given to future predictions. The offline features can be extracted and stored at any time through spark calculation and Hive number bin implementation.
For the prediction model including three parts of the DNN model, the FM model and the RNN model, refer to fig. 4, and fig. 4 is a schematic structural diagram of a prediction model provided by an embodiment of the present invention. The input information of the model comprises real-time data of the predicted object and offline data, wherein taking the predicted object as a sales product as an example, the real-time data comprises one or more of accumulated sales volume characteristics, sales promotion characteristics, real-time weather, pit ranking characteristics, regulation characteristics of operators on the predicted object and the like every hour up to the current moment, the offline data comprises one or more of time sequence characteristics in a historical period, predicted object attributes and the like, and the time sequence characteristics can comprise statistical values of sales volumes of 3 days, 7 days, 14 days and the like in the past, and statistical characteristics (mean and standard deviation) of accumulated sales volume occupation ratios.
Data sampling is performed for a historical period of time (e.g., the past 90 days) prior to the current time, resulting in training data. An exemplary portion of the items are sold historically too little, for example, using a sample of sales for the past 90 days to train, and some items are only sold for a few times for the past 90 days, which results in insufficient learning of the item's characteristics during training, resulting in inaccurate predictions of the item. We oversample to a predicted number, e.g., 90, for each item sold less than 90 days. The sampling probability of each sample is:
wherein m is a certain sku selling number, dis i The date of sale for the item is the number of days from today, so that samples closer to today are more easily taken. Therefore, each article is guaranteed to occupy the same weight in the training sample, and the articles with more vending times cannot be inclined.
Training the model by sampling the obtained training data. On this basis, the prediction model can be trained based on the residuals predicted at time t each time before time t. And determining a loss function at any time before the time t, namely, a predicted result of the historical time and an actual result of the corresponding time, so as to adjust model parameters of the prediction model.
One model is trained for each time period. For example, at 12 points, according to the accumulated sales quantity, real-time weather and other data characteristics of each moment before 12 points, the accumulated sales quantity prediction of 12 points in the past per hour is obtained, the predicted residual of the accumulated sales quantity of 12 points in the past per hour, namely the loss function, is obtained, and the predicted residual is put into the characteristics of the current moment to train a new model. In the prediction stage, prediction is made according to the characteristics newly taken on the same day. Thus, if the model is trained once an hour, there will be 24 models, which are more accurate than just one model prediction.
In the prediction stage of the model, real-time data and offline data are input into an FM model and a DNN model in the prediction model, and a prediction result of a prediction object at the current moment is obtained. In some embodiments, vector conversion operations, such as ebadd operations, are performed on high-dimensional sparse feature data in real-time data and offline data, the high-dimensional sparse feature data is converted into dense vectors, and the dense vectors obtained by conversion are respectively input to a prediction model. Accordingly, non-high-dimensional sparse feature data in the real-time data and the offline data may be directly input to the predictive model (not shown in fig. 4). In some embodiments, the input information of the FM model and the DNN model further includes a prediction result of the historical time of day.
FM model output function y FM DNN model output function y DNN . The FM model and the DNN model are arranged in parallel, and correspondingly, the feature extraction module comprises the FM model and the DNN model which are arranged in parallel, and an output prediction function of the feature extraction module is as follows: y is DeepFM =y FM +y DNN And inputs the output prediction function into the RNN model.
The RNN model receives an additional input, namely a prediction of the historical moment, which may be a prediction of the sales on the current day from the previous day, x in fig. 4, which is to avoid the problem of inaccurate estimation of the cumulative sales on the whole day from the hours just after the cluster has been opened.
The first neuron input of the RNN loop structure is h 1 =W 1 *x 1 +W DM *(y DNN +y FM ) The inputs to each of the remaining neurons are: h is a t =W h *h t-1 +W DM *(y DNN +y FM ) Final output: y is t =σ(W h *h t +b t ). Wherein W is 1 、W h 、W DM Is a network parameter in the RNN loop structure. The RNN model outputs a predicted sales of the current time to the predicted object over a future period.
Referring to fig. 4, in a preferred example of the prediction method provided in this embodiment, the prediction model includes three parts, namely, a DNN model (i.e., a first feature extraction module), an FM model (i.e., a second feature extraction module), and an RNN model (i.e., a cyclic prediction module), where the DNN model and the FM model are disposed in parallel and are respectively connected to the RNN model. The method comprises the steps of taking offline data of a predicted object and real-time data at the current moment as information to be processed, converting high-dimensional sparse feature data in the information to be processed into dense vectors, taking non-high-dimensional sparse feature data in the dense vectors and the information to be processed as input information, and respectively inputting the dense vectors and the non-high-dimensional sparse feature data into a DNN model and an FM model for feature extraction. DNN model outputs first object feature y DNN The FM model outputs the second object features y respectively FM First object feature y DNN Second object feature y FM And taking the prediction result of the historical moment as input information of the RNN model, and performing cyclic prediction processing by the RNN model to obtain the current prediction result of the prediction object, namely the prediction sales of the prediction object in a future period.
Fig. 5 is a schematic structural diagram of a prediction apparatus according to an embodiment of the present invention. As shown in fig. 5, the apparatus includes:
a data obtaining module 210, configured to obtain offline data of a prediction object, real-time data at a current time, and a prediction result of a historical time;
and the prediction module 220 is configured to process the offline data, the real-time data, and the prediction result at the historical time based on the prediction model corresponding to the current time, so as to obtain a current prediction result of the prediction object.
On the basis of the above embodiment, optionally, the prediction model includes a feature extraction module and a cyclic prediction module;
the prediction module 220 includes:
the feature extraction unit is used for inputting the offline data and the real-time data into the feature extraction module to obtain object features;
and the prediction unit is used for inputting the object characteristics and the prediction results of the historical time to the cyclic prediction module to obtain the current prediction results of the prediction object.
On the basis of the above embodiment, optionally, the feature extraction module includes a first feature extraction module and a second feature extraction module, where the first feature extraction module and the second feature extraction module are disposed in parallel;
the feature extraction unit is used for inputting the offline data and the real-time data to the first feature extraction module and the second feature extraction module respectively to obtain a first object feature and a second object feature, wherein the first object feature and the second object feature are fused to obtain the object feature.
On the basis of the above embodiment, optionally, the apparatus further includes: a model training module;
the model training module comprises:
the training data determining unit is used for sampling data in the historical data of the predicted object in a preset historical time period before the current time period and determining training data;
the first model training unit is used for training the prediction model to be trained based on the training data to obtain the prediction model of the current period.
Optionally, the training data determining unit is configured to:
determining sampling probability of the historical data based on time information of the historical data under the condition that the number of the historical data in a preset historical time period is smaller than or equal to the preset number, and performing replaced sampling on each historical data based on the sampling probability of each historical data to determine training data;
And under the condition that the number of the historical data in the preset historical time period is larger than the preset number, randomly sampling the historical data to determine training data.
Optionally, the model training module further includes:
the second model training unit is used for acquiring the prediction results of the history prediction model corresponding to the history time for each time and the actual results of the corresponding time, and determining a loss function based on the prediction results and the actual results of the same time; and training the prediction model to be trained based on the loss function.
On the basis of the embodiment, optionally, the prediction object is a sold article, and the prediction result is sales of the sold article in a future period.
The prediction device provided by the embodiment of the invention can execute the prediction method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 6, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as the predictive method.
In some embodiments, the prediction method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the prediction method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the prediction method in any other suitable way (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
The computer program used to implement the predictive methods of the invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores computer instructions for causing a processor to execute a prediction method, the method comprising:
acquiring offline data of a predicted object, real-time data at the current moment and a predicted result at the historical moment; and processing the offline data, the real-time data and the prediction results of the historical time based on the prediction model corresponding to the current time to obtain the current prediction results of the prediction object.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method of prediction, comprising:
acquiring offline data of a predicted object, real-time data at the current moment and a predicted result at the historical moment;
and processing the offline data, the real-time data and the prediction results of the historical time based on the prediction model corresponding to the current time to obtain the current prediction results of the prediction object.
2. The method according to claim 1, wherein the prediction model comprises a feature extraction module and a cyclic prediction module;
the processing the offline data, the real-time data and the prediction result of the historical moment based on the prediction model corresponding to the current moment to obtain the current prediction result of the prediction object comprises the following steps:
inputting the offline data and the real-time data to the feature extraction module to obtain object features;
and inputting the object characteristics and the prediction results of the historical time to the cyclic prediction module to obtain the current prediction results of the predicted object.
3. The method of claim 2, wherein the feature extraction module comprises a first feature extraction module and a second feature extraction module, the first feature extraction module and the second feature extraction module being disposed in parallel;
The step of inputting the offline data and the real-time data to the feature extraction module to obtain object features includes:
and respectively inputting the offline data and the real-time data to the first feature extraction module and the second feature extraction module to obtain a first object feature and a second object feature, wherein the first object feature and the second object feature are fused to obtain the object feature.
4. The method of claim 1, wherein the training process of the predictive model comprises:
sampling data in historical data of a predicted object in a preset historical time period before a current time period, and determining training data;
and training the prediction model to be trained based on the training data to obtain the prediction model of the current period.
5. The method of claim 4, wherein the data sampling in the historical data of the predicted object for a preset historical period of time prior to the current period of time, determining training data, comprises:
determining sampling probability of the historical data based on time information of the historical data under the condition that the number of the historical data in a preset historical time period is smaller than or equal to the preset number, and performing replaced sampling on each historical data based on the sampling probability of each historical data to determine training data;
And under the condition that the number of the historical data in the preset historical time period is larger than the preset number, randomly sampling the historical data to determine training data.
6. The method according to claim 4, wherein the method further comprises:
obtaining a prediction result of a history prediction model corresponding to the history time for each time and an actual result of the corresponding time, and determining a loss function based on the prediction result and the actual result of the same time;
and training the prediction model to be trained based on the loss function.
7. The method of claim 1, wherein the predictive object is a sold item and the predictive outcome is a sales of the sold item during a future time period.
8. A prediction apparatus, comprising:
the data acquisition module is used for acquiring offline data of a predicted object, real-time data at the current moment and a predicted result of the historical moment;
and the prediction module is used for processing the offline data, the real-time data and the prediction results of the historical time based on the prediction model corresponding to the current time to obtain the current prediction results of the prediction object.
9. An electronic device, the electronic device comprising:
At least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the prediction method of any one of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to perform the prediction method of any one of claims 1-7.
CN202211145313.7A 2022-09-20 2022-09-20 Prediction method and device, storage medium and electronic equipment Pending CN117807384A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211145313.7A CN117807384A (en) 2022-09-20 2022-09-20 Prediction method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211145313.7A CN117807384A (en) 2022-09-20 2022-09-20 Prediction method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117807384A true CN117807384A (en) 2024-04-02

Family

ID=90420514

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211145313.7A Pending CN117807384A (en) 2022-09-20 2022-09-20 Prediction method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117807384A (en)

Similar Documents

Publication Publication Date Title
CN108304354B (en) Prediction model training method and device, storage medium and electronic equipment
CN114723966B (en) Multi-task recognition method, training method, device, electronic equipment and storage medium
CN116307215A (en) Load prediction method, device, equipment and storage medium of power system
CN116489038A (en) Network traffic prediction method, device, equipment and medium
CN114119989A (en) Training method and device for image feature extraction model and electronic equipment
CN114037059A (en) Pre-training model, model generation method, data processing method and data processing device
CN117332896A (en) New energy small time scale power prediction method and system for multilayer integrated learning
CN117332897A (en) Artificial intelligent driven new energy small time scale power interpolation integrated prediction method
CN116228301A (en) Method, device, equipment and medium for determining target user
CN115907926A (en) Commodity recommendation method and device, electronic equipment and storage medium
CN117807384A (en) Prediction method and device, storage medium and electronic equipment
CN115640871A (en) Wind speed prediction method and device, electronic equipment and storage medium
CN114331379B (en) Method for outputting task to be handled, model training method and device
CN117808848B (en) Identification tracking method and device, electronic equipment and storage medium
CN113362304B (en) Training method of definition prediction model and method for determining definition level
CN113821722B (en) Data processing method, recommending device, electronic equipment and medium
CN117808545A (en) Attention mechanism-based multitasking method, device, equipment and medium
CN118134590A (en) Information transmission method, device, equipment and storage medium
CN117573983A (en) Recommendation method and device of financing scheme, electronic equipment and storage medium
CN117493690A (en) Data pushing method and device, electronic equipment and storage medium
CN115858621A (en) User behavior prediction method and device, electronic equipment and storage medium
CN117195104A (en) Resource classification method, device, electronic equipment and storage medium
CN115512188A (en) Multi-target detection method, device, equipment and medium
CN115017145A (en) Data expansion method, device and storage medium
CN116192608A (en) Cloud mobile phone fault prediction method, device 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