Prediction model training method, device, computer equipment and storage medium
By dynamically adjusting the online training speed of the prediction model, combining current and historical flow data, the problem of difficulty in taking into account both performance and stability in intelligent scenarios in the existing technology is solved, and the continuous and efficient prediction of the prediction model is achieved.
Patent Information
- Application Number
- CN202110610089.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-01
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2041-06-01
AI Technical Summary
In the prior art, when assisting in the training of prediction models, it is difficult to take into account both prediction performance and prediction stability, resulting in a decrease in prediction effect in intelligent scenarios.
By obtaining the current flow data and the online prediction model, determine the degree value of concept drift, and conduct online training based on this degree value, combine the historical flow data sampling to obtain the target flow data, dynamically adjust the learning speed to avoid catastrophic forgetting, and ensure the prediction model real-time performance and stability.
It effectively improves the prediction performance and stability of the prediction model, so that it can continuously meet the needs of intelligent scenarios and improve the prediction effect.
Smart Images

Figure CN113344196B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a prediction model training method, device, computer equipment and storage medium. Background Art
[0002] In the construction of smart city projects, a large number of artificial intelligence models may be used to construct various intelligent scenarios, such as pedestrian flow prediction, vehicle flow prediction, air quality prediction and monitoring and early warning. The input data processed by these models are usually generated in the form of streams. As the time and environment of data generation change, the distribution of data and the information reflected will also change. This phenomenon that the distribution or information carried changes over time is called concept drift. The concept drift of data will cause the performance of artificial intelligence models to decline, resulting in the inability of static artificial intelligence models to continuously meet the prediction needs in intelligent scenarios, thereby affecting the prediction effect of artificial intelligence models.
[0003] In the related art, when the concept drift of reference data is used to assist in training the prediction model, it is not possible to take into account both the prediction performance and the prediction stability, thereby affecting the online prediction effect of the prediction model. Summary of the invention
[0004] The present disclosure aims to solve one of the technical problems in the related art at least to some extent.
[0005] To this end, the purpose of the present invention is to propose a training method, device, computer equipment and storage medium for a prediction model, which can take into account the learning speed of the prediction model for new knowledge and avoid the occurrence of catastrophic forgetting, effectively improve the prediction performance and prediction stability of the prediction model, so that the prediction model can continuously meet the prediction needs in intelligent scenarios and improve the prediction effect of the prediction model.
[0006] To achieve the above-mentioned purpose, the prediction model training method proposed in the first aspect of the present disclosure includes: obtaining current stream data and an online prediction model; if concept drift occurs in the current stream data, determining the degree of concept drift; and based on the degree of concept drift, online training the online prediction model in combination with the current stream data and target stream data to obtain a target prediction model; wherein the target stream data is sampled from multiple historical stream data.
[0007] The training method of the prediction model proposed in the embodiment of the first aspect of the present disclosure determines the training timing of the online prediction model training by combining the degree value of the concept drift, thereby supporting the online learning process. If the degree of concept drift of the current streaming data is large, the online training process is made to have a faster model learning speed, so that the model can quickly master the new knowledge represented by the streaming data that produces the concept drift, so as to ensure the online real-time performance of the prediction model; if the degree of concept drift of the current streaming data is small, the online training process is made to maintain a relatively low learning rate to prevent the occurrence of catastrophic forgetting, thereby comprehensively taking into account the learning speed of the prediction model for new knowledge and the stable performance of the prediction model, so that the prediction model can continuously meet the prediction needs in the intelligent scene and improve the prediction effect of the prediction model.
[0008] To achieve the above-mentioned purpose, the training device of the prediction model proposed in the second aspect of the embodiment of the present disclosure includes: an acquisition module, used to acquire current stream data and an online prediction model; a first determination module, used to determine the degree of concept drift when concept drift occurs in the current stream data; and a training module, used to perform online training on the online prediction model according to the degree of concept drift, in combination with the current stream data and the target stream data, to obtain a target prediction model; wherein the target stream data is sampled from multiple historical stream data.
[0009] The training device of the prediction model proposed in the embodiment of the second aspect of the present disclosure determines the training timing of the online prediction model training by combining the degree value of the concept drift, thereby supporting the online learning process. If the degree of concept drift of the current streaming data is large, the online training process is made to have a faster model learning speed, so that the model can quickly master the new knowledge represented by the streaming data that produces the concept drift, so as to ensure the online real-time performance of the prediction model; if the degree of concept drift of the current streaming data is small, the online training process is made to maintain a relatively low learning rate to prevent the occurrence of catastrophic forgetting, thereby comprehensively taking into account the learning speed of the prediction model for new knowledge and the stable performance of the prediction model, so that the prediction model can continuously meet the prediction needs in the intelligent scene and improve the prediction effect of the prediction model.
[0010] The third aspect embodiment of the present disclosure proposes a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the training method of the prediction model proposed in the first aspect embodiment of the present disclosure is implemented.
[0011] The fourth aspect embodiment of the present disclosure proposes a non-temporary computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the training method of the prediction model proposed in the first aspect embodiment of the present disclosure.
[0012] The fifth aspect embodiment of the present disclosure proposes a computer program product. When the instruction processor in the computer program product executes, it performs the training method of the prediction model proposed in the first aspect embodiment of the present disclosure.
[0013] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description or learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0015] Figure 1 It is a flowchart of a training method of a prediction model proposed in an embodiment of the present disclosure;
[0016] Figure 2 It is a schematic diagram of the architecture of a training device for a prediction model proposed in an embodiment of the present disclosure;
[0017] Figure 3 is a flowchart of a training method for a prediction model proposed in another embodiment of the present disclosure;
[0018] Figure 4 is a flowchart of a training method for a prediction model proposed in another embodiment of the present disclosure;
[0019] Figure 5 is a flowchart of a training method for a prediction model proposed in another embodiment of the present disclosure;
[0020] Figure 6 is a schematic diagram of the architecture of a training device for a prediction model proposed in another embodiment of the present disclosure;
[0021] Figure 7 It is a structural schematic diagram of a training device for a prediction model proposed in an embodiment of the present disclosure;
[0022] Figure 8 is a schematic diagram of the structure of a training device for a prediction model proposed in another embodiment of the present disclosure;
[0023] Fig. 9 A block diagram of an exemplary computer device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0024] Embodiments of the present disclosure are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present disclosure, and are not to be construed as limitations of the present disclosure. On the contrary, the embodiments of the present disclosure include all changes, modifications, and equivalents that fall within the spirit and connotation of the appended claims.
[0025] Figure 1 It is a flowchart of a training method for a prediction model proposed in an embodiment of the present disclosure.
[0026] It should be noted that the executor of the prediction model training method of this embodiment is the prediction model training device, which can be implemented by software and / or hardware. The device can be configured in an electronic device, and the electronic device may include but is not limited to a terminal, a server, etc.
[0027] Among them, the artificial intelligence model used for pedestrian flow prediction, vehicle flow prediction, air quality prediction, monitoring and early warning in smart city scenarios can be called a prediction model, and the artificial intelligence model can be, for example, a neural network model, a machine learning model, etc., without limitation.
[0028] In the embodiments of the present disclosure, a prediction model training method is provided to solve the technical problem in the related art that when the concept drift of the reference data is used to assist in training the prediction model, the prediction performance and prediction stability cannot be taken into account, thereby affecting the online prediction effect of the prediction model. The method can take into account the learning speed of the prediction model for new knowledge and avoid the occurrence of catastrophic forgetting, effectively improve the prediction performance and prediction stability of the prediction model, so that the prediction model can continuously meet the prediction needs in the intelligent scenario and improve the prediction effect of the prediction model.
[0029] like Figure 1 As shown, the training method of the prediction model includes:
[0030] S101: Obtain current stream data and online prediction model.
[0031] Among them, the prediction model used in the online environment for pedestrian flow prediction, vehicle flow prediction, air quality prediction, monitoring and early warning in smart city scenarios can be called an online prediction model, that is, the online prediction model is a prediction model that has been deployed in the scenario and performs corresponding prediction tasks.
[0032] Among them, the current stream data can be the stream data collected at the current time point. The stream data refers to data generated in the form of a stream, and as the time and environment of data generation change, the distribution of the data and the information reflected will also change. The stream data can be used as the input of the online prediction model to trigger it to perform the corresponding prediction task. In the embodiment of the present disclosure, it can support dynamic collection of current stream data, support online training of the online prediction model directly according to the degree of concept drift of the current stream data, and use the continuously acquired current stream data and the target stream data obtained by sampling the historical stream data to form a new stream data of the training sample to trigger the online training of the prediction model, ensure the prediction performance ability of the online prediction model, and control the training speed of the online prediction model.
[0033] S102: If concept drift occurs in the current stream data, determine the degree of concept drift.
[0034] After obtaining the current stream data and the online prediction model, it is possible to determine in real time whether concept drift occurs in the current stream data. If concept drift occurs in the current stream data, the degree of concept drift is determined. The degree of concept drift indicates the degree of concept drift in the current stream data.
[0035] For example, the current stream data can be compared with multiple historical stream data to obtain the changes between the current stream data and multiple historical stream data, and then the changes can be quantified to obtain the degree of concept drift. The degree of concept drift is compared with a set concept drift degree threshold, and the comparison result is used to determine whether to trigger online training of the prediction model.
[0036] That is to say, the embodiments of the present disclosure determine the training timing of the online prediction model training by combining the degree value of the concept drift, thereby supporting the online learning process. If the degree of concept drift of the current streaming data is large, the online training process can have a faster model learning speed, so that the model can quickly master the new knowledge represented by the streaming data that produces the concept drift, so as to ensure the online real-time performance of the prediction model; and if the degree of concept drift of the current streaming data is small, the online training process can maintain a relatively low learning rate to prevent the occurrence of catastrophic forgetting, thereby comprehensively considering the learning speed of the prediction model for new knowledge and the stability performance of the prediction model.
[0037] S103: According to the degree value of the concept drift, the online prediction model is trained online in combination with the current stream data and the target stream data to obtain a target prediction model; wherein the target stream data is sampled from a plurality of historical stream data.
[0038] After determining the degree value of the concept drift, the online prediction model can be adaptively triggered to perform online training in combination with the current stream data and the target stream data according to the degree value of the concept drift to obtain the target prediction model.
[0039] Among them, the prediction model obtained by training can be called the target prediction model.
[0040] Among them, historical stream data can be understood as: corresponding to a current time point with the current stream data. Before the current time point, usually with the passage of time, streaming data will be continuously generated in the real scene, so the multiple stream data accumulated between the current time points can be called historical stream data.
[0041] In this embodiment, the training timing of the online prediction model training is determined by combining the degree value of the concept drift, so as to support the online learning process. If the degree of concept drift of the current streaming data is large, the online training process is made to have a faster model learning speed, so that the model can quickly master the new knowledge represented by the streaming data that produces the concept drift, so as to ensure the online real-time performance of the prediction model; if the degree of concept drift of the current streaming data is small, the online training process is made to maintain a relatively low learning rate to prevent the occurrence of catastrophic forgetting, so as to comprehensively take into account the learning speed of the prediction model for new knowledge and the stability performance of the prediction model, so that the prediction model can continuously meet the prediction needs in the intelligent scene and improve the prediction effect of the prediction model.
[0042] The following are examples: Figure 2 As shown, Figure 2 The following embodiments of the present disclosure can be combined with the following embodiments: Figure 2 As shown, there is no limitation on this.
[0043] Data pool: can be used to store all historical flow data.
[0044] Real-time data unit: a unit for online real-time streaming data input. The real-time data unit can receive real-time streaming data input and input the real-time streaming data into the inference service unit for model inference. At the same time, the received real-time streaming data is also input into the data drift monitoring unit to calculate whether concept drift occurs in the real-time streaming data.
[0045] Replay buffer pool: used to store the latest multiple historical flow data. The multiple historical flow data can specifically be part of the flow data of all the historical flow data in the above data pool. The online learning module can sample the target flow data from the replay buffer pool to perform online training of the prediction model.
[0046] Sample stream data for training: can be randomly selected from the data pool to perform offline training on the initial prediction model, and then push the trained prediction model to the model warehouse.
[0047] Model training: The initial prediction model is trained offline using the sample streams used for training, and the trained prediction model is pushed to the model warehouse. In the actual prediction scenario, the latest prediction model in the model warehouse is pushed to the inference service unit for online prediction. The prediction model used by the inference service unit when providing inference services can be called an online prediction model.
[0048] Data drift detection dataset: Receives current streaming data and caches it to determine whether concept drift occurs and the degree of concept drift. It also refers to the degree of concept drift to assist in online learning of online prediction models.
[0049] Concept drift assessment module: uses the current stream data received by the data drift monitoring unit to calculate the degree of concept drift of the current stream data relative to the historical stream data, so as to determine whether the degree of concept drift of the current stream data is greater than the concept drift degree threshold.
[0050] Online learning module: online data of the data pool, playback cache pool, degree of concept drift, online training of the prediction model, and transmission of the trained prediction model to the model warehouse. At the same time, the current streaming data used for online learning is synchronized to the playback cache pool.
[0051] Model warehouse: stores prediction models obtained through offline training and prediction models obtained through online training.
[0052] Inference service unit: obtains the latest prediction model from the model warehouse, uses the latest prediction model to perform model inference on online data, and outputs the prediction results.
[0053] Figure 3 is a flowchart of a training method for a prediction model proposed in another embodiment of the present disclosure, for Figure 3 The description of Figure 2 ,include:
[0054] S301: Obtain current stream data and online prediction model.
[0055] The above can be used Figure 2 The model training unit in the data pool uses all the historical stream data in the data pool to perform offline model training to obtain a prediction model, which will serve as the model basis for subsequent online training. At the same time, the model training unit will transfer the prediction model to the model warehouse.
[0056] By the above Figure 2The reasoning service unit in obtains the latest prediction model from the model warehouse and uses it as the reasoning model of the system.
[0057] S302: If concept drift occurs in the current stream data, determine the degree of concept drift.
[0058] The real-time data unit may input the received real-time stream data into the data drift monitoring unit to calculate whether the real-time stream data has concept drift, and if the current stream data has concept drift, determine the degree of concept drift.
[0059] S303: If the value of the degree of concept drift is greater than or equal to the concept drift degree threshold, target flow data is sampled from the historical flow data stored in the playback buffer pool according to the set rules.
[0060] For example, the current flow data and historical flow data can be compared to detect the degree of data drift. Assuming that the judgment threshold value of drift detection is set to Th (this Th can be called the concept drift degree threshold), if the drift detection output (the drift detection output can specifically be that the degree value of the concept drift is greater than or equal to the concept drift degree threshold) Th, then the target flow data is sampled from the historical flow data stored in the playback cache pool with reference to the set rules.
[0061] S304: Perform online training on the online prediction model according to the current stream data and the target stream data.
[0062] Optionally, the online prediction model may be trained online a first set number of times based on the current stream data and the target stream data, wherein the first set number of times is a maximum value within a set number range.
[0063] Among them, if the degree value of the concept drift of the current stream data is greater than or equal to the concept drift degree threshold, it can trigger direct online training of the online prediction model and train a set number of times, which can be called the first set number of times.
[0064] For example, if the degree value of the concept drift of the current streaming data is greater than or equal to the concept drift degree threshold, the online prediction model can be directly triggered to perform online training, and the number of training iterations is Inc_Train_Num (the number of training iterations is Inc_Train_Num, which can be called the first set number), thereby effectively ensuring that the prediction model can quickly respond to changes in the distribution of streaming data.
[0065] The first set number of times mentioned above is the maximum value in the set number of times range.
[0066] S305: If the value of the degree of concept drift is less than the threshold value of the degree of concept drift, the current stream data is stored in the playback buffer pool, and it is determined whether the amount of stream data stored in the playback buffer pool meets the set condition.
[0067] For example, if the drift detection output (the drift detection output may specifically be a concept drift degree value) is less than the concept drift degree threshold Th, the current stream data may be stored in the playback buffer pool, and the amount of stream data stored in the playback buffer pool may be determined.
[0068] S306: If the data volume does not meet the set condition, the current stream data is continuously acquired and the data volume is dynamically updated.
[0069] The setting condition may be that the amount of data has reached the maximum amount of data that can be stored in the playback buffer pool, and there is no restriction on this.
[0070] That is to say, if the degree value of the concept drift of the current stream data is less than the concept drift degree threshold, the current stream data will be stored in the playback cache pool, and the amount of stream data stored in the playback cache pool will be determined in real time. If the data amount does not reach the maximum data amount that the playback cache pool can store, the current stream data will continue to be obtained and the data amount will be dynamically updated.
[0071] S307: If the data volume meets the set conditions, target stream data is sampled from the historical stream data stored in the playback buffer pool according to the set rules, and the online prediction model is trained online according to the target stream data.
[0072] When determining the amount of streaming data stored in the playback buffer pool in real time, if the amount of data reaches the maximum amount of data that the playback buffer pool can store, the target streaming data is sampled from the historical streaming data stored in the playback buffer pool according to the set rules, and the online prediction model is trained online based on the target streaming data.
[0073] For example, if the degree value of the concept drift detected in the current stream data is less than the concept drift degree threshold, then after the playback buffer pool is full, the target stream data is sampled from the historical stream data stored in the playback buffer pool, and the target stream data is input into the online learning module to perform online training on the online prediction model, and iteratively update the online prediction model to ensure the effectiveness of the online prediction model.
[0074] Optionally, in some embodiments, the online prediction model can be trained online a second set number of times based on the target flow data, wherein the second set number of times is less than the first set number of times, and the second set number of times is calculated based on the maximum value, minimum value, degree of concept drift, and concept drift degree threshold within the set number range.
[0075] In the embodiment of the present disclosure, when the degree of concept drift of the current stream data is less than the concept drift degree threshold, the online training is triggered by the data volume. Considering that the degree of concept drift of the current stream data is small, the number of training iterations Inc_Train_Num can be appropriately reduced. The number of iterations Inc_Train_Num in this case can be called the second set number. The calculation method of the second set number can be specifically referred to as follows.
[0076] For example, in the above Figure 2 In the online learning module shown in , the online prediction model is trained online using the data set and repeated Inc_Train_Num times. In the disclosed embodiment, the technical features of the playback cache pool and the addition of unknown labels can also be introduced to assist in increasing the training stability of the online prediction model, reducing the number of model retraining times, and improving training efficiency.
[0077] In the disclosed embodiment, it also supports putting the latest received current stream data for training into the playback cache pool in real time, and putting the target prediction model obtained by online training into the model warehouse to meet subsequent scenario requirements.
[0078] In this embodiment, since the online prediction model is triggered to be trained online according to the degree of concept drift, the trigger mechanism of online training is more flexible and applicable, and the model performance degradation caused by the concept drift of the stream data can be avoided in time, and the prediction performance and prediction stability of the prediction model can be effectively improved, so that the prediction model can continuously meet the prediction needs in the intelligent scene and improve the prediction effect of the prediction model. If the degree of concept drift of the current stream data is large, the online prediction model can be directly triggered to be trained online, so that the prediction model can effectively respond to the changes in the distribution of the stream data. If the degree of concept drift of the current stream data is small, after the replay buffer pool is full, the target stream data is sampled from the historical stream data stored in the replay buffer pool, and the target stream data is input into the online learning module to train the online prediction model online, iterate and update the online prediction model, and ensure the effect of the online prediction model. When the degree of concept drift of the current stream data is small, the online training triggered by the data volume can appropriately reduce the number of training iterations considering that the degree of concept drift of the current stream data is small, thereby ensuring the stability of the prediction model training.
[0079] For example, receiving current streaming data for inference and obtaining real results based on business feedback;
[0080] (1) Based on the current stream data, calculate the degree of concept drift relative to the historical stream data and record it as Concept_drift_value, and determine whether the degree of concept drift of the current stream data is greater than or equal to the concept drift degree threshold. If the degree of concept drift of the current stream data is large, go to step (4), otherwise go to step (2).
[0081] (2) Determine whether the playback buffer pool meets the quantity requirement of online learning. If so, proceed to step (4); otherwise, proceed to step (1).
[0082] (3) Calculate the number of online training times Inc_Train_Num, where Inc_Train_max and Inc_Train_min represent the maximum number of iterations (the maximum value within the set number range) and the minimum number of iterations (the minimum value within the set number range) of online training, respectively.
[0083] (31) If the degree of concept drift of the current stream data is large, Inc_Train_Num = Inc_Train_max, so as to speed up the learning process.
[0084] (32) If the degree of concept drift of the current stream data is small, the learning speed of online training is reduced, and the number of training iterations can be calculated by using Inc_Train_Num = (Inc_Train_max-Inc_Train_min)*Concept_drift_value / Th+Inc_Train_Min.
[0085] (4) Online training process: Sample from the playback buffer pool to obtain the target stream data, mix the target stream data with the current stream data, and perform online training on the online prediction model.
[0086] (5) After repeating step (5) Inc_Train_Num times, the trained target prediction model is pushed into the model warehouse.
[0087] (6) The current stream data received in this round is added to the replay buffer pool, and the data that first enters the replay buffer pool is deleted according to the first-in-first-out principle to ensure that the total number of samples in the replay buffer pool remains unchanged.
[0088] (7) Return to step (1).
[0089] That is to say, in the embodiments of the present disclosure, after training to obtain the target prediction model, it supports storing the current stream data in the replay cache pool and deleting the first stream data in the replay cache pool, wherein the storage order corresponding to the first stream data is before the storage order corresponding to other stream data, and the first stream data and other stream data together constitute the stream data stored in the replay cache pool, so as to achieve that after the online training is completed, the latest stream data is stored in the replay cache pool in a timely manner, and according to the first-in-first-out principle, the most "outdated" historical stream data is deleted, thereby ensuring that the total amount of sample stream data in the replay cache pool remains unchanged and ensuring the feature characterization capability of the sample stream data in the replay cache pool.
[0090] Figure 4 is a flowchart of a training method for a prediction model proposed in another embodiment of the present disclosure, for Figure 4 The description of Figure 2 ,include:
[0091] S401: Determine a weight according to the amount of streaming data stored in the playback buffer pool and the storage time corresponding to the historical streaming data.
[0092] S402: From the historical stream data stored in the playback buffer pool, a set number of historical stream data is obtained based on selection probability sampling and used as target stream data, and the ratio between the set number and the number of current stream data is a preset value.
[0093] The selection probability may be specifically set according to the weight corresponding to the historical flow data, and details may be referred to the following description.
[0094] That is to say, this embodiment takes into account that in real prediction scenarios, due to factors such as the data volume and data sampling of the newer stream data, the distribution deviation between the newer stream data and the historical stream data may be large, and thus provides a weighted playback cache pool strategy to avoid online prediction model jitter, which is more conducive to the security and stability of the online prediction model in real prediction scenarios.
[0095] For example, using the latest current flow data received online to mix with historical flow data to perform online training of the online prediction model can effectively alleviate the deviation caused by the distribution jitter of the latest current flow data received. Therefore, in the embodiment of the present disclosure, a weighted replay buffer pool can be used to store historical flow data, and during the online training process, a set number of historical flow data can be randomly sampled according to the weight of the stored historical flow data and used as target flow data, and combined with the current flow data to train the prediction model online.
[0096] In the disclosed embodiment, the ratio between the number of newer stream data and the number of historical stream data in the training data for online learning can also be adaptively controlled (the ratio can be represented by parameter α). The size of α determines whether the online training of the online prediction model is more inclined to the model effect or the stability of the model. It can be adaptively set according to the needs of the actual prediction scenario, and there is no restriction on this.
[0097] The amount of data for online learning samples: the amount of newer stream data = 1: α;
[0098] Among them, when α is small, online learning will rely more on historical streaming data, so as to obtain better model stability. When α is large, online learning will rely more on newer streaming data, so as to make the online performance of the target prediction model better.
[0099] In the application embodiment, the ratio between the number of newer stream data and the number of historical stream data in the online learning training data train_set can be configured to be 1:9, that is, α=0.1. The amount of training data for online learning can be 1 / 20 of the amount of data that can be stored in the playback cache pool, and there is no restriction on this.
[0100] In the embodiment of the present disclosure, the method of setting the selection probability according to the weight corresponding to the historical flow data can be illustrated as follows:
[0101] Weighted experience replay means that when extracting samples, the most valuable samples are given priority, but you cannot only extract the most valuable ones, otherwise it will cause overfitting. The higher the value, the greater the probability of being extracted, and the lowest value also has a certain probability of being extracted.
[0102] In the disclosed embodiment, when performing an online learning task, considering that newer stream data is more valuable to the learning of the online prediction model, the newer stream data can be configured to have a higher probability of being extracted.
[0103] Assume that the number of samples that can be cached in the playback buffer pool is N, and the historical stream data in the playback buffer pool is sorted according to their corresponding storage time, denoted as x i , where i∈[1, N], the smaller i is, the closer the historical data is to the current time point. Assume that the decrease rate of the weight corresponding to the historical data is γ=(1-1 / N), then the historical data x i The probability of being sampled (selection probability) is:
[0104] ε i =Aγ i ;
[0105] Where A is the normalization factor:
[0106]
[0107] Therefore, the historical stream data stored in the playback buffer pool of the embodiment of the present disclosure includes the earliest historical stream data x N The selection probability is approximately 1 / θ of the latest historical stream data x1, where e is a natural constant. This method is used to set the weight of historical stream data. The probability of early historical stream data being sampled will not be reduced due to changes in the amount of data cached in the replay buffer pool. At the same time, this method makes the sampled weight of historical stream data gradually decrease as the amount of data increases over time. This method can be effectively used to perform weighted sampling of historical stream data in the replay buffer pool in scenarios with concept drift.
[0108] Therefore, in the embodiment of the present disclosure, a weighted replay buffer pool is used to store historical flow data, and the historical flow data obtained from the replay buffer pool based on probability sampling is mixed with a small amount of newer flow data received online in real time to form a new online training data set. While ensuring that the online prediction model continuously learns new knowledge from new samples, the old knowledge that has been mastered in the past is consolidated, thereby improving the performance of the online prediction model and the training stability.
[0109] Figure 5 is a flowchart of a training method for a prediction model proposed in another embodiment of the present disclosure, for Figure 5 The description of Figure 2 ,include:
[0110] S501: Obtain the annotation label corresponding to the current stream data.
[0111] S502: Obtain at least one prediction label supported by the online prediction model.
[0112] S503: If the annotated label belongs to at least one predicted label, the online prediction model is trained online according to the degree value of the concept drift in combination with the current stream data and the target stream data.
[0113] S504: If the annotated label does not belong to at least one predicted label, then according to the degree value of the concept drift, the online prediction model is updated and trained offline in combination with the current stream data and the target stream data.
[0114] That is to say, the embodiments of the present disclosure also support adding several label cache locations during the training of the original online prediction model, to ensure that when receiving real-time current stream data, if the annotated label corresponding to the current stream data is a label not supported by the original online prediction model, the online prediction model can still continue the online training process, thereby reducing the number of retraining times of the online prediction model and improving the training efficiency, so that the training method of the prediction model in the embodiments of the present disclosure can be widely applied to classification problems in which the type of label corresponding to the stream data changes.
[0115] For example, see also Figure 6 , Figure 6 is a schematic diagram of the architecture of a training device for a prediction model proposed in another embodiment of the present disclosure, Figure 5 The description of the illustrated embodiment can be described as follows:
[0116] During the online training process of the classification problem, the annotated label corresponding to the current stream data may be a prediction label that is not supported by the current online prediction model. Therefore, in the embodiment of the present disclosure, in order to make the output of the online prediction model conform to the classification number of the newer stream data and enable the online prediction model to effectively meet the needs of real business scenarios for online model services, when the original online prediction model is initially trained, a number of label cache locations (with a size of max_label_buffer_size) can be added to the output category of the online prediction model in advance. When the annotated label does not belong to the prediction label currently supported by the online prediction model, the annotated label can be directly associated with the reserved label cache location without modifying the output of the online prediction model, so that the model can be directly trained online. After processing the label cache location, the target stream data in the playback cache pool is used to train the online prediction model to obtain the target prediction model.
[0117] Use historical stream data, set label_buffer_size to max_label_buffer_size, and train the online prediction model; sample the target stream data from the playback buffer pool; merge it with the received current stream data to form an online training data set. For classification problems, additional processing of unknown data labels is required. The steps are as follows:
[0118] If the annotated label is not an unknown label (that is, the annotated label belongs to at least one prediction label supported by the online prediction model), online training is performed directly.
[0119] If the annotated label is an unknown label (ie, the annotated label does not belong to at least one prediction label supported by the online prediction model), the number of unknown labels is calculated as unklabel_len, and the number of unknown labels is compared with the number of label cache locations label_buffer_size.
[0120] When label_buffer_size < unklabel_len, that is, the label buffer position is not sufficient to hold all the unknown labels, online training is directly performed.
[0121] When label_buffer_size > unklabel_len, the unknown labels unklabel_len are sequentially encoded, and the label buffer position size is updated to label_buffer_size = label_buffer_size - unklabel_len.
[0122] Using the online training dataset, online training is performed based on the latest online prediction model, the model parameters are updated, and it is saved as the online prediction model. If the number of iterations meets the set number, it ends to obtain the target prediction model. If the number of iterations does not meet the set number, the online prediction model is retrained, label_buffer_size is set to max_label_buffer_size, and online training is performed.
[0123] An application example for the embodiments of the present disclosure may be as follows:
[0124] Suppose the prediction task performed by the online prediction model is the classification of urban governance events. This online prediction model can be specifically, for example, an event classification model. The event classification model, according to the incoming event content and the event location, predicts the departments that need to be dispatched for the event, and gives the top three departments that best meet the conditions in descending order of the predicted probability. The event distribution (content and the target departments to be dispatched) will change with time and environment. Therefore, the event classification model will monitor the data drift situation in real time and trigger online training immediately when the drift occurs.
[0125] In the embodiments of the present disclosure, a text classification algorithm can be adopted. To handle the emerging unknown labels, when training the event classification model, several label buffer positions (with a size of label_buffer_size) are added in advance to the output categories of the event classification model. When new labels appear, the new labels can be directly associated with the reserved label buffer positions without modifying the event classification model output, enabling the event classification model to directly perform online training. After the event classification model receives a certain amount of new samples each time, the new samples are mixed with the data randomly sampled from the replay cache pool for online training.
[0126] The main parameters of event classification online learning are shown in Table 1 below:
[0127] Table 1
[0128] parameter Value Replay buffer pool size (N) 20000 Data drift detection pool size 100 Latest: Online training data ratio (α) 0.1 Concept Drift Detection Algorithm MMD Concept drift threshold (Th) 0.01 Maximum number of online training iterations (Inc_Train_max) 5 Minimum number of online training iterations (Inc_Train_min) 1 Maximum number of unknown label locations (max_label_buffer_size) 5
[0129] Through experiments, we found that on drifted data, compared with quantitatively retraining the event classification model using the full amount of data, the top3 accuracy of the original event classification model dropped by about 8.7%. By adding unknown label cache to the original event classification model in advance and sampling from the cache pool during training, the top3 accuracy of the online learning event classification model on drifted data is 2.1% higher than that of the original event classification model. The specific experimental results on drifted data are shown in Table 2 below:
[0130] Table 2
[0131]
[0132]
[0133] Result analysis:
[0134] Using a static event classification model, you can perform continuous reasoning on online data, but the performance of the event classification model will gradually deteriorate over time.
[0135] After receiving every 1,000 pieces of data, the event classification model is retrained using the latest full data: Due to the continuous introduction of newer streaming data, its online performance is significantly improved compared to the static event classification model. However, since the event classification model is trained using full data, the calculation time for a single event classification model update is longer.
[0136] By updating the online event classification model and adding unknown label cache, the training time can be greatly reduced. At the same time, the performance of the event classification model is comparable to that of retraining with the full data.
[0137] Based on the update of the online event classification model, a weighted replay cache pool is introduced. Due to the increase in data processing work, the update time of a single event classification model increases. The introduction of the cache pool data increases the stability of the event classification model, and the performance of the event classification model is improved to a certain extent compared with the online update method.
[0138] Assuming that the prediction task performed by the online prediction model is parking lot flow prediction, the online prediction model can be specifically, for example, a parking lot flow prediction model, which uses the parking lot inflow and outflow data of the previous 24 hours to predict the inflow and outflow situation in the next 2 hours.
[0139] The disclosed embodiment can use a neural network model for time series prediction, and the granularity of the traffic data is one data point every half hour, that is, the input of the parking lot traffic prediction model is 48 consecutive time series points, and the output is 4 consecutive time series points. On the basis of the original parking lot traffic prediction model, online training is performed every half hour, using the latest training sample (that is, the latest 52 data points, of which the first 48 points are used as the parking lot traffic prediction model input, and the last 4 are used as the parking lot traffic prediction model output) and 127 samples randomly sampled from the playback buffer pool (each sample is composed of 52 consecutive time series data points, the first 48 points are used as the parking lot traffic prediction model input, and the last 4 are used as the parking lot traffic prediction model output) to form a training set for online training. During the training process, a larger learning rate and a smaller number of training iterations are used to enable the parking lot traffic prediction model to quickly learn the current data distribution.
[0140] The main parameters of the online learning of the traffic flow prediction model are shown in Table 3:
[0141] Table 3
[0142] parameter Value Replay buffer pool size (N) 20000 Data drift detection pool size 1000 Latest: Online training data ratio (α) 1 / 64 Concept Drift Detection Algorithm ADWin Concept drift threshold (Th) 0.002 Maximum number of online training iterations (Inc_Train_max) 5 Minimum number of online training iterations (Inc_Train_min) 1
[0143] The experiment on the drifted data found that the online learning parking lot flow prediction model had lower RMSE and MAE evaluation indicators than the original parking lot flow prediction model. The specific experimental results on the drifted data are shown in Table 4 below:
[0144] Table 4
[0145]
[0146]
[0147] Result analysis:
[0148] The static parking lot flow prediction model can perform continuous inference on online data, but its performance will gradually decline over time.
[0149] T+3 days full update: Every 3 days, the parking lot flow prediction model is retrained using full data. The effect of the parking lot flow prediction model is better than the static parking lot flow prediction model. However, due to the complex network and the large amount of historical flow data, the update time of a single parking lot flow prediction model is long, which is difficult to meet the online service requirements of the urban parking lot flow prediction model.
[0150] T+3 days of data online training + weighted replay cache pool: Use the data received every 3 days and combine it with some historical flow data in the weighted replay cache pool to adjust the parking lot flow prediction model. This method does not require manual participation and can automatically update the parking lot flow prediction model online; since only a small amount of newer flow data is used to update the parking lot flow prediction model, the calculation time is greatly shortened.
[0151] Since the online update method takes into account the impact of temporally adjacent flow data more, the effect of the parking lot flow prediction model is improved compared to updating the parking lot flow prediction model using full data.
[0152] The method of self-controlling learning speed can adaptively adjust the learning speed according to the degree of concept drift of the streaming data. When there is drift in the online streaming data, the performance of the parking lot flow prediction model is improved to a certain extent.
[0153] Figure 7 It is a structural diagram of a training device for a prediction model proposed in an embodiment of the present disclosure.
[0154] like Figure 7 As shown, the training device 70 of the prediction model includes:
[0155] An acquisition module 701 is used to acquire current stream data and an online prediction model;
[0156] A first determining module 702 is used to determine the degree of concept drift when concept drift occurs in the current stream data; and
[0157] The training module 703 is used to perform online training on the online prediction model according to the degree value of the concept drift in combination with the current stream data and the target stream data to obtain a target prediction model; wherein the target stream data is sampled from a plurality of historical stream data.
[0158] In some embodiments of the present disclosure, the training module 703 is specifically used to:
[0159] If the value of the degree of concept drift is greater than or equal to the concept drift degree threshold, the target flow data is sampled from the historical flow data stored in the playback buffer pool according to the set rules;
[0160] The online prediction model is trained online based on the current stream data and the target stream data.
[0161] In some embodiments of the present disclosure, the training module 703 is specifically used to:
[0162] If the value of the degree of concept drift is less than the threshold of the degree of concept drift, the current stream data is stored in the playback buffer pool, and the amount of the stream data stored in the playback buffer pool is determined;
[0163] If the data volume does not meet the set conditions, the current stream data is continuously acquired and the data volume is dynamically updated;
[0164] If the data volume meets the set conditions, the target stream data is sampled from the historical stream data stored in the playback buffer pool according to the set rules, and the online prediction model is trained online based on the target stream data.
[0165] In some embodiments of the present disclosure, the training module 703 is specifically used to:
[0166] The online prediction model is trained online a first set number of times according to the current stream data and the target stream data, wherein the first set number of times is a maximum value within a set number of times.
[0167] In some embodiments of the present disclosure, the training module 703 is specifically used to:
[0168] The online prediction model is trained online a second set number of times according to the target stream data, wherein the second set number of times is less than the first set number of times, and the second set number of times is calculated based on the maximum value, the minimum value, the degree of concept drift, and the degree of concept drift threshold within the set number range.
[0169] In some embodiments of the present disclosure, Figure 8 As shown, the device 70 also includes:
[0170] Processing module 704 is used to store the current stream data in the playback cache pool after training the target prediction model, and delete the first stream data in the playback cache pool, wherein the storage order corresponding to the first stream data is before the storage order corresponding to other stream data, and the first stream data and other stream data together constitute the stream data stored in the playback cache pool.
[0171] In some embodiments of the present disclosure, the training module 703 is specifically used to:
[0172] From the historical stream data stored in the playback buffer pool, a set amount of historical stream data is obtained based on the selection probability sampling and used as the target stream data. The ratio between the set amount and the amount of current stream data is a preset value.
[0173] In some embodiments of the present disclosure, the selection probability is determined by the weight of the historical flow data, such as Figure 8 As shown, the device 70 also includes:
[0174] The second determination module 705 is used to determine the weight according to the amount of stream data stored in the playback buffer pool and the storage time corresponding to the historical stream data.
[0175] In some embodiments of the present disclosure,
[0176] The acquisition module 701 is further used to acquire, after acquiring the current stream data, a label corresponding to the current stream data, and acquire at least one prediction label supported by the online prediction model;
[0177] The training module 703 is specifically used for:
[0178] If the annotated label belongs to at least one predicted label, the online prediction model is trained online based on the current stream data and the target stream data according to the degree of concept drift;
[0179] If the annotated label does not belong to at least one predicted label, the online prediction model is updated and trained offline based on the degree of concept drift combined with the current stream data and the target stream data.
[0180] With the above Figures 1 to 6 Corresponding to the training method of the prediction model provided in the embodiment, the present disclosure also provides a training device for the prediction model. Figures 1 to 6 The training method of the prediction model provided in the embodiment corresponds to the training method of the prediction model, so the implementation method of the training method of the prediction model is also applicable to the training device of the prediction model provided in the embodiment of the present disclosure, and will not be described in detail in the embodiment of the present disclosure.
[0181] In this embodiment, the training timing of the online prediction model training is determined by combining the degree value of the concept drift, so as to support the online learning process. If the degree of concept drift of the current streaming data is large, the online training process is made to have a faster model learning speed, so that the model can quickly master the new knowledge represented by the streaming data that produces the concept drift, so as to ensure the online real-time performance of the prediction model; if the degree of concept drift of the current streaming data is small, the online training process is made to maintain a relatively low learning rate to prevent the occurrence of catastrophic forgetting, so as to comprehensively take into account the learning speed of the prediction model for new knowledge and the stability performance of the prediction model, so that the prediction model can continuously meet the prediction needs in the intelligent scene and improve the prediction effect of the prediction model.
[0182] In order to implement the above embodiments, the present disclosure also proposes a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the training method of the prediction model proposed in the above embodiments of the present disclosure is implemented.
[0183] In order to implement the above embodiments, the present disclosure also proposes a non-temporary computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the training method of the prediction model proposed in the above embodiments of the present disclosure is implemented.
[0184] In order to implement the above embodiments, the present disclosure also proposes a computer program product. When the instruction processor in the computer program product is executed, the training method of the prediction model proposed in the above embodiments of the present disclosure is performed.
[0185] Fig. 9 A block diagram of an exemplary computer device suitable for implementing embodiments of the present disclosure is shown. Fig. 9 The computer device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0186] like Fig. 9 As shown, the computer device 12 is in the form of a general-purpose computing device. The components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).
[0187] The bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnection (PCI) bus.
[0188] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.
[0189] The memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Fig. 9Not shown, often called a "hard drive").
[0190] although Fig. 9 Not shown in the figure, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a compact disc read only memory (CD-ROM), a digital versatile disc read only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the various embodiments of the present disclosure.
[0191] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described in the present disclosure.
[0192] The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the computer device 12, and / or any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed via an input / output (I / O) interface 22. In addition, the computer device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the computer device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0193] The processing unit 16 executes various functional applications and data processing by running the programs stored in the system memory 28, such as implementing the training method of the prediction model mentioned in the above embodiment.
[0194] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0195] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
[0196] It should be noted that, in the description of the present disclosure, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present disclosure, unless otherwise specified, the meaning of "plurality" is two or more.
[0197] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present disclosure includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present disclosure belong.
[0198] It should be understood that the various parts of the present disclosure can be implemented in hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0199] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0200] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0201] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0202] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0203] Although the embodiments of the present disclosure have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present disclosure. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present disclosure.
Claims
1. A training method for a prediction model, It is characterized in that The method comprises: Get current streaming data and online prediction models; If the current stream data has concept drift, determining a degree value of the concept drift, wherein the degree value of the concept drift is used to characterize the degree of the concept drift of the current stream data; and According to the degree value of the concept drift, the online prediction model is trained online in combination with the current stream data and the target stream data to obtain a target prediction model; Wherein, the target flow data is sampled from a plurality of historical flow data; The online prediction model is trained online according to the degree value of the concept drift in combination with the current stream data and the target stream data, including: If the value of the degree of concept drift is greater than or equal to the concept drift degree threshold, sampling the target flow data from the historical flow data stored in the playback buffer pool according to the set rule; Performing online training on the online prediction model according to the current stream data and the target stream data; If the value of the degree of concept drift is less than the threshold value of the degree of concept drift, the current stream data is stored in a playback buffer pool, and the amount of stream data stored in the playback buffer pool is determined; If the data volume does not meet the set condition, the current stream data is continuously acquired and the data volume is dynamically updated, wherein the set condition includes that the data volume has reached the maximum data volume that can be stored in the playback buffer pool; If the data volume meets the set condition, the target stream data is sampled from the historical stream data stored in the playback buffer pool with reference to the set rule, and the online prediction model is trained online according to the target stream data.
2. The method according to claim 1, It is characterized in that The online training of the online prediction model according to the current stream data and the target stream data includes: The online prediction model is trained online a first set number of times according to the current flow data and the target flow data, wherein the first set number of times is a maximum value within a set number range.
3. The method according to claim 1, It is characterized in that The online training of the online prediction model according to the target stream data comprises: The online prediction model is trained online a second set number of times according to the target flow data, wherein the second set number of times is less than the first set number of times, and the second set number of times is calculated based on the maximum value, the minimum value, the degree of the concept drift, and the concept drift degree threshold within the set number range.
4. The method according to claim 1, It is characterized in that After the target prediction model is obtained through training, the following steps are included: Storing the current streaming data in a playback buffer pool; Deleting the first stream data in the playback buffer pool; The storage order corresponding to the first stream data is before the storage order corresponding to other stream data, and the first stream data and the other stream data together constitute the stream data stored in the playback buffer pool.
5. The method according to claim 1, It is characterized in that The step of obtaining the target stream data by sampling the historical stream data stored in the playback buffer pool with reference to the set rule includes: From the historical stream data stored in the playback buffer pool, a set number of historical stream data is obtained based on selection probability sampling and used as the target stream data, and the ratio between the set number and the number of current stream data is a preset value.
6. The method according to claim 5, It is characterized in that The selection probability is determined by the weight of the historical flow data, and the method further includes: The weight is determined according to the amount of stream data stored in the playback buffer pool and the storage time corresponding to the historical stream data.
7. The method according to any one of claims 1 to 6, It is characterized in that After obtaining the current stream data, the method further includes: Obtaining a label corresponding to the current stream data; Obtaining at least one prediction label supported by the online prediction model; If the annotated label belongs to the at least one predicted label, performing online training on the online prediction model in combination with the current stream data and the target stream data according to the degree value of the concept drift; If the annotated label does not belong to the at least one predicted label, the online prediction model is updated and trained offline in combination with the current stream data and the target stream data according to the degree value of the concept drift.
8. A training device for a prediction model, It is characterized in that The device comprises: The acquisition module is used to obtain the current stream data and online prediction model; a first determining module, configured to determine a degree value of concept drift when concept drift occurs in the current stream data; and A training module, used for performing online training on the online prediction model in combination with the current stream data and the target stream data according to the degree value of the concept drift, so as to obtain a target prediction model; wherein the target stream data is sampled from a plurality of historical stream data; The training module is specifically used for: If the value of the degree of concept drift is greater than or equal to the concept drift degree threshold, sampling the target flow data from the historical flow data stored in the playback buffer pool according to the set rule; Performing online training on the online prediction model according to the current stream data and the target stream data; The training module is also used for: If the value of the degree of concept drift is less than the threshold value of the degree of concept drift, the current stream data is stored in a playback buffer pool, and the amount of stream data stored in the playback buffer pool is determined; If the data volume does not meet the set condition, the current stream data is continuously acquired and the data volume is dynamically updated, wherein the set condition includes that the data volume has reached the maximum data volume that can be stored in the playback buffer pool; If the data volume meets the set condition, the target stream data is sampled from the historical stream data stored in the playback buffer pool with reference to the set rule, and the online prediction model is trained online according to the target stream data.
9. The device as claimed in claim 8, It is characterized in that The training module is specifically used for: The online prediction model is trained online a first set number of times according to the current flow data and the target flow data, wherein the first set number of times is a maximum value within a set number range.
10. The device according to claim 8, It is characterized in that The training module is specifically used for: The online prediction model is trained online a second set number of times according to the target flow data, wherein the second set number of times is less than the first set number of times, and the second set number of times is calculated based on the maximum value, the minimum value, the degree of the concept drift, and the concept drift degree threshold within the set number range.
11. The device according to claim 8, It is characterized in that The device also includes: A processing module is used to store the current stream data in a replay cache pool after training the target prediction model, and delete the first stream data in the replay cache pool, wherein the storage order corresponding to the first stream data is before the storage order corresponding to other stream data, and the first stream data and the other stream data together constitute the stream data stored in the replay cache pool.
12. The device according to claim 8, It is characterized in that The training module is specifically used for: From the historical stream data stored in the playback buffer pool, a set number of historical stream data is obtained based on selection probability sampling and used as the target stream data, and the ratio between the set number and the number of current stream data is a preset value.
13. The device according to claim 12, It is characterized in that The selection probability is determined by the weight of the historical flow data, and the device further includes: The second determination module is used to determine the weight according to the amount of stream data stored in the playback buffer pool and the storage time corresponding to the historical stream data.
14. The device according to any one of claims 8 to 13, It is characterized in that in, The acquisition module is further configured to, after acquiring the current stream data, acquire a label corresponding to the current stream data, and acquire at least one prediction label supported by the online prediction model; The training module is specifically used for: If the annotated label belongs to the at least one predicted label, performing online training on the online prediction model in combination with the current stream data and the target stream data according to the degree value of the concept drift; If the annotated label does not belong to the at least one predicted label, the online prediction model is updated and trained offline in combination with the current stream data and the target stream data according to the degree value of the concept drift.
15. A computer device, It is characterized in that The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 7 is implemented. 16 . A storage medium, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method according to claim 1 .
