Method and apparatus for retraining time series data model, and computer device

CN117131384BActive Publication Date: 2026-09-22CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310973817.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-03
Publication Date
2026-09-22
Estimated Expiration
2043-08-03

AI Technical Summary

Technical Problem

由于人工筛选的出错率较高,导致训练好的模型的预测准确度较低

Benefits of technology

[0047]可知,通过基于时序数据序列和通过初始时序数据模型得到的预测数据序列,确定时序数据序列对应的损失参数序列;由于物联网设备的时序数据会存在偶发性的噪声数据信号,又由于非噪声数据是重复的连续数据信号,因此,可以采用字符串匹配的策略对损失参数序列进行匹配,使得字符串匹配的多的时序数据(即连续且重复的时序数据)赋予更高的状态值,字符串匹配的少的时序数据(即不连续且不重复的时序数据)赋予更低的状态值。由于连续且重复的时序数据不是噪声数据的可能性较大,不连续且不重复的时序数据是噪声数据的可能性较大,因此,针对各个状态值对应的状态匹配序列,对初始时序数据模块中的损失函数进行调整,从而降低初始时序数据模型在重训练时,噪声数据对训练结果的影响,进而在重训练时序数据模型时,在保证时序数据模型重训练的实时性的基础上,达到提升时序数据模型重训练的预测准确率的效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117131384B_ABST
    Figure CN117131384B_ABST
Patent Text Reader

Abstract

The application relates to a retraining method and device of a time series data model and a computer device. The method comprises the following steps: determining a loss parameter sequence corresponding to a time series data sequence based on the time series data sequence and a prediction data sequence; the time series data sequence comprises a plurality of time series data arranged in time sequence, and the prediction data sequence is obtained by inputting the time series data sequence into an initial time series data model; performing string matching on each loss parameter in the loss parameter sequence based on a string matching algorithm to obtain a matching result corresponding to each loss parameter; adjusting an initial loss function corresponding to the initial time series data model based on the matching result corresponding to each loss parameter to obtain a target loss function; and retraining the initial time series data model based on each time series data contained in the time series data and the target loss function to obtain a target time series data model after retraining. The method can improve the prediction accuracy of the retraining of the time series data model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, apparatus, computer device, storage medium, and computer program product for retraining a time-series data model. Background Technology

[0002] The 3rd Generation Partnership Project (3GPP) specifies in Release 18 the capabilities to support network data analysis, including the statistical analysis, prediction, and analysis of time-series data from IoT devices. Currently, due to network fluctuations or device malfunctions, time-series data containing unfamiliar signals may be acquired. Before using this unfamiliar data as a dataset for model training, it is necessary to specifically adapt or optimize the time-series data to reduce the interference of noisy data on model training.

[0003] In related technologies, time-series data containing unfamiliar data signals are manually screened to remove noise, resulting in filtered time-series data. A model is then trained based on this filtered data to obtain a trained model. However, the high error rate of manual screening leads to low prediction accuracy in the trained model. Summary of the Invention

[0004] Therefore, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium, and computer program product for retraining time series data models to address the aforementioned technical problems.

[0005] Firstly, this application provides a method for retraining a time-series data model. The method includes:

[0006] Based on the time-series data sequence and the prediction data sequence, a loss parameter sequence corresponding to the time-series data sequence is determined; wherein, the time-series data sequence contains multiple time-series data arranged in chronological order, the prediction data sequence is obtained by inputting the time-series data sequence into an initial time-series data model, and the loss parameter sequence contains multiple loss parameters, each loss parameter corresponding one-to-one with each of the time-series data;

[0007] Based on the string matching algorithm, string matching is performed on each of the loss parameters in the loss parameter sequence to obtain the matching result corresponding to each of the loss parameters.

[0008] Based on the matching results corresponding to each of the loss parameters, the initial loss function corresponding to the initial time series data model is adjusted to obtain the target loss function;

[0009] Based on the time series data contained in the time series data and the target loss function, the initial time series data model is retrained to obtain the retrained target time series data model.

[0010] In one embodiment, the loss parameter is a predicted state value, and the loss parameter sequence is a predicted state sequence;

[0011] The step of determining the loss parameter sequence corresponding to the time series data sequence based on the time series data sequence and the predicted data sequence includes:

[0012] Based on the loss value algorithm, each predicted data corresponding to the predicted data sequence, and each time series data corresponding to the time series data sequence, a loss value sequence is determined, wherein the loss value sequence includes the loss value corresponding to each of the time series data.

[0013] Based on the reference values ​​corresponding to the loss value sequence, a predicted state sequence corresponding to the loss value sequence is determined; wherein, the predicted state sequence includes the predicted state values ​​obtained after classifying each loss value.

[0014] In one embodiment, determining the predicted state sequence corresponding to the loss value sequence based on the reference value corresponding to the loss value sequence includes:

[0015] Based on the algorithm with standard parameters and the loss values ​​contained in the loss value sequence, a reference value corresponding to the loss value sequence is determined;

[0016] For each of the multiple loss values, a target state interval corresponding to the loss value is determined in multiple state intervals, and a predicted state value corresponding to the target state interval is determined. The multiple state intervals are determined based on at least one state division threshold.

[0017] The predicted state values ​​corresponding to the multiple loss values ​​are used as the predicted state sequence corresponding to the loss value sequence.

[0018] In one embodiment, the step of performing string matching on each loss parameter in the loss parameter sequence based on the string matching algorithm to obtain the matching result corresponding to each loss parameter includes:

[0019] According to the string matching algorithm, string matching is performed on each of the predicted state values ​​in the predicted state sequence to obtain the string matching value corresponding to each predicted state value, and each string matching value is used as the matching result.

[0020] In one embodiment, adjusting the initial loss function corresponding to the initial time-series data model based on the matching results corresponding to each of the loss parameters to obtain the target loss function includes:

[0021] Based on the preset weight calculation function and the matching results corresponding to each loss parameter, the weight coefficient corresponding to each loss parameter is determined.

[0022] Based on the weight coefficients corresponding to each of the loss parameters and the initial loss function, the target loss function is obtained.

[0023] In one embodiment, the step of performing string matching on each loss parameter in the loss parameter sequence based on the string matching algorithm to obtain the matching result corresponding to each loss parameter includes:

[0024] Based on the KMP algorithm, string matching is performed on each loss parameter in the loss parameter sequence to obtain the matching result corresponding to each loss parameter.

[0025] Secondly, this application also provides a retraining apparatus for a time-series data model. The apparatus includes:

[0026] The loss parameter determination module is used to determine the loss parameter sequence corresponding to the time series data sequence based on the time series data sequence and the prediction data sequence; wherein, the time series data sequence contains multiple time series data arranged in chronological order, the prediction data sequence is obtained by inputting the time series data sequence into an initial time series data model, and the loss parameter sequence contains multiple loss parameters, each loss parameter corresponding one-to-one with each of the time series data;

[0027] The string matching module is used to perform string matching on each of the loss parameters in the loss parameter sequence based on the string matching algorithm, and obtain the matching result corresponding to each of the loss parameters respectively.

[0028] The loss function adjustment module is used to adjust the initial loss function corresponding to the initial time series data model based on the matching results corresponding to each of the loss parameters, so as to obtain the target loss function.

[0029] The retraining module is used to retrain the initial time series data model based on each time series data contained in the time series data and the target loss function, so as to obtain the retrained target time series data model.

[0030] In one embodiment, the loss parameter is a predicted state value, the loss parameter sequence is a predicted state sequence, and the loss parameter determination module is specifically used for:

[0031] Based on the loss value algorithm, each predicted data corresponding to the predicted data sequence, and each time series data corresponding to the time series data sequence, a loss value sequence is determined, wherein the loss value sequence includes the loss value corresponding to each of the time series data.

[0032] Based on the reference values ​​corresponding to the loss value sequence, a predicted state sequence corresponding to the loss value sequence is determined; wherein, the predicted state sequence includes the predicted state values ​​obtained after classifying each loss value.

[0033] In one embodiment, the loss parameter determination module is further configured to:

[0034] Based on the algorithm with standard parameters and the loss values ​​contained in the loss value sequence, a reference value corresponding to the loss value sequence is determined;

[0035] For each of the multiple loss values, a target state interval corresponding to the loss value is determined in multiple state intervals, and a predicted state value corresponding to the target state interval is determined. The multiple state intervals are determined based on at least one state division threshold.

[0036] The predicted state values ​​corresponding to the multiple loss values ​​are used as the predicted state sequence corresponding to the loss value sequence.

[0037] In one embodiment, the string matching module is specifically used to: perform string matching on each of the predicted state values ​​in the predicted state sequence according to the string matching algorithm, obtain the string matching value corresponding to each of the predicted state values, and use each of the string matching values ​​as the matching result.

[0038] In one embodiment, the loss parameter determination module is further configured to: determine the loss value corresponding to each of the time series data based on the loss value algorithm, each prediction data corresponding to the prediction data sequence, and each of the time series data corresponding to the time series data sequence, and use the loss value corresponding to each of the time series data as the loss parameter sequence corresponding to the time series data sequence.

[0039] In one embodiment, the loss function adjustment module is specifically used for:

[0040] Based on the preset weight calculation function and the matching results corresponding to each loss parameter, the weight coefficient corresponding to each loss parameter is determined.

[0041] Based on the weight coefficients corresponding to each of the loss parameters and the initial loss function, the target loss function is obtained.

[0042] In one embodiment, the string matching module is further configured to: perform string matching on each of the loss parameters in the loss parameter sequence based on the KMP algorithm, and obtain the matching result corresponding to each of the loss parameters.

[0043] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method described in the first aspect.

[0044] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the method described in the first aspect.

[0045] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the method as described in the first aspect.

[0046] The aforementioned retraining method, apparatus, computer equipment, storage medium, and computer program product for time-series data models utilize the following technical means: Based on a time-series data sequence and a prediction data sequence, a loss parameter sequence corresponding to the time-series data sequence is determined; wherein the time-series data sequence contains multiple time-series data arranged in chronological order, the prediction data sequence is obtained by inputting the time-series data sequence into an initial time-series data model, and the loss parameter sequence contains multiple loss parameters, each loss parameter corresponding to a specific time-series data; based on a string matching algorithm, string matching is performed on each loss parameter in the loss parameter sequence to obtain a matching result corresponding to each loss parameter; based on the matching results corresponding to each loss parameter, the initial loss function corresponding to the initial time-series data model is adjusted to obtain a target loss function; based on the time-series data contained in the time-series data and the target loss function, the initial time-series data model is retrained to obtain a retrained target time-series data model.

[0047] It can be seen that the loss parameter sequence corresponding to the time series data sequence is determined based on the time series data sequence and the predicted data sequence obtained through the initial time series data model. Since the time series data from IoT devices may contain sporadic noise signals, and since the non-noise data is a repetitive continuous signal, a string matching strategy can be used to match the loss parameter sequence. This assigns higher state values ​​to time series data with more string matches (i.e., continuous and repetitive time series data) and lower state values ​​to time series data with fewer string matches (i.e., discontinuous and non-repetitive time series data). Since continuous and repetitive time series data is more likely not to be noise data, while discontinuous and non-repetitive time series data is more likely to be noise data, the loss function in the initial time series data module is adjusted based on the state matching sequence corresponding to each state value. This reduces the impact of noise data on the training results during retraining of the initial time series data model, thereby improving the prediction accuracy of the time series data model during retraining while ensuring the real-time performance of the retraining process. Attached Figure Description

[0048] Figure 1 This is a diagram illustrating the application environment of a retraining method for a time-series data model in one embodiment.

[0049] Figure 2 This is a flowchart illustrating a retraining method for a time-series data model in one embodiment.

[0050] Figure 3 This is a flowchart illustrating the steps for determining the sequence of loss parameters in one embodiment;

[0051] Figure 4 This is a flowchart illustrating the steps for determining the predicted state sequence in one embodiment;

[0052] Figure 5 This is a flowchart illustrating the steps for determining the target loss function in one embodiment;

[0053] Figure 6 This is a flowchart illustrating the retraining method for a time-series data model in another embodiment;

[0054] Figure 7 This is a schematic diagram of the weight calculation function in one embodiment;

[0055] Figure 8 This is a structural block diagram of a retraining device for a time series data model in one embodiment;

[0056] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0058] The retraining method for time-series data models provided in this application can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network, and can send time-series data to server 104 or a data storage system in real time. The data storage system can store data that server 104 needs to process, or it can store the processed data. The data storage system can be integrated onto server 104, or it can be located in the cloud or on other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0059] In one embodiment, such as Figure 2 As shown, a retraining method for time series data models is provided, which can be applied to... Figure 1 Taking the server in the example, the following steps are included:

[0060] Step S202: Based on the time series data sequence and the prediction data sequence, determine the loss parameter sequence corresponding to the time series data sequence.

[0061] The time-series data sequence comprises multiple time-series data arranged in chronological order. As an example, the time-series data could be the location data of a shared bicycle at each time point within a preset time period. The predicted data sequence is obtained by inputting the time-series data sequence into an initial time-series data model. The initial time-series data model can be a machine learning model used for statistical analysis, prediction, and analysis of IoT device data. The initial time-series data model is obtained after training based on the time-series data sequence.

[0062] The loss parameter sequence contains multiple loss parameters, each corresponding one-to-one with a time series data point. Loss parameters are used to evaluate the degree of error between the model's predictions (i.e., the predicted data sequence) and the actual results (time series data sequences) from the initial time series data model. Generally, a smaller loss parameter indicates that the model's predictions are closer to the actual results, while a larger loss parameter indicates that the model's predictions have a larger error compared to the actual results. Therefore, loss parameters can be used to measure the performance of time series data models.

[0063] Specifically, the server receives time-series data from IoT devices generated by the terminal and merges the time-series data to obtain a time-series data sequence. Based on this, the server can input the time-series data sequence into an initial time-series data model. The initial time-series model, after prediction, obtains the prediction results corresponding to each time-series data in the time-series data sequence. In other words, the initial time-series model can output a predicted data sequence, and the server can obtain the predicted data sequence corresponding to the time-series data sequence. Based on the loss parameter calculation formula, the server determines the loss parameter sequence between the predicted data sequence and the time-series data sequence, where each loss parameter corresponds one-to-one with a time-series data.

[0064] Optionally, based on the time series data sequence, the predicted data sequence, and the loss parameter calculation formula, the loss parameter sequence corresponding to the time series data sequence is determined, wherein the loss parameter calculation formula is a preset custom indicator calculation formula or loss function.

[0065] Optionally, time-series data can be any data generated in chronological order, such as data generated by IoT devices, computer devices, communication terminals, or computer software.

[0066] Step S204: Based on the string matching algorithm, perform string matching on each loss parameter in the loss parameter sequence to obtain the matching result corresponding to each loss parameter.

[0067] The string matching algorithm is an algorithm that finds the corresponding substrings within a string. The loss parameter sequence can be a string, and the string matching algorithm can perform substring matching within the strings corresponding to the loss parameter sequence. The matching result can be the string matching value obtained after the loss parameter sequence has undergone string matching. The string matching value contains the implicit features of each loss parameter. Based on this, substrings with higher matching degrees in the matching results have more regular data characteristics, while substrings with lower matching degrees have more random data characteristics. The matching results corresponding to each loss parameter can represent the implicit features contained within each loss parameter, and these implicit features are used to adjust the corresponding initial loss function in subsequent steps.

[0068] Specifically, the server uses a string matching algorithm to find a substring composed of multiple loss parameters in the string corresponding to the loss parameter sequence and obtains the string matching result. The matching result can represent the degree of matching of each loss parameter in the loss parameter sequence.

[0069] Optionally, the server can use at least one of the following algorithms—Brute-Force, Rabin-Karp Hash, KMP (Knuth-Morris-Pratt), and Sunday—to match the strings corresponding to the loss parameter sequence and obtain the matching results.

[0070] Step S206: Based on the matching results corresponding to each loss parameter, adjust the initial loss function corresponding to the initial time series data model to obtain the target loss function.

[0071] The initial time-series data model includes an initial loss function, which is obtained iteratively during training. During training, the server trains the time-series data model based on this initial loss function. Based on this, the server adjusts the initial loss function according to the matching results of each loss parameter to obtain the target loss function. During retraining, the server optimizes the initial time-series data model based on the target loss function. When the convergence or training termination condition is met, the retrained target time-series data model is obtained. Since the matching results contain the degree of matching for each loss parameter in the loss parameter sequence, different loss parameters are adjusted according to the matching results when adjusting the initial loss function, resulting in different target loss functions. Accordingly, each loss parameter in the loss parameter sequence corresponds one-to-one with the target loss function.

[0072] Specifically, the matching results corresponding to each loss parameter can represent the latent features of each loss parameter. As an example, latent features can be represented by their degree of randomness and regularity. A higher degree of randomness indicates a greater likelihood that the loss parameter is noisy data, while a higher degree of regularity indicates a lower likelihood. Based on this, different target loss functions can be determined for loss parameters with different latent features. Specifically, for loss parameters with higher degrees of randomness, the target loss function has a smaller impact on the initial time-series data model; conversely, for loss parameters with lower degrees of randomness, the target loss function has a greater impact on the initial time-series data model. Correspondingly, the server obtains the target loss function for each loss parameter based on the matching results.

[0073] Step S208: Based on the time series data contained in the time series data and the target loss function, the initial time series data model is retrained to obtain the retrained target time series data model.

[0074] The initial time-series data model is a machine learning model established by statistically analyzing, predicting, and interpreting time-series data from IoT devices. The target time-series data model is based on the initial time-series data model, and is further trained and iterated using time-series data to obtain a more accurate time-series data model.

[0075] Specifically, after obtaining the target loss function corresponding to each loss parameter, the server can retrain the time series data corresponding to each loss parameter. During retraining, the corresponding target loss function is used to train different time series data. When the convergence condition of the target time series data model is reached, the retraining of the target time series data model is completed. As an example, the target time series data model and the initial time series data model have the same structure, and the convergence condition of the initial time series data model can be used as the convergence condition of the target time series data model.

[0076] In the retraining method of the aforementioned time-series data model, the server determines the loss parameter sequence corresponding to the time-series data sequence based on the time-series data sequence and the prediction data sequence obtained from the initial time-series data model. Since the time-series data from IoT devices may contain sporadic noise signals, and since non-noise data consists of repetitive continuous signals, a string matching strategy can be used to match the loss parameter sequence. Time-series data with more string matches (i.e., continuous and repetitive time-series data) are assigned higher state values, while time-series data with fewer string matches (i.e., discontinuous and non-repetitive time-series data) are assigned lower state values. Because continuous and repetitive time-series data is more likely not to be noise data, while discontinuous and non-repetitive time-series data is more likely to be noise data, the loss function in the initial time-series data module is adjusted based on the state matching sequence corresponding to each state value. This reduces the impact of noise data on the training results during retraining of the initial time-series data model, thereby improving the prediction accuracy of the retrained time-series data model while ensuring its real-time performance.

[0077] In one embodiment, the loss parameter is the predicted state value, and the loss parameter sequence is the predicted state sequence, such as... Figure 3 As shown, the specific implementation process of the step "determine the loss parameter sequence corresponding to the time series data sequence based on the time series data sequence and the prediction data sequence" includes:

[0078] Step S302: Based on the loss value algorithm, the predicted data corresponding to the predicted data sequence, and the time series data corresponding to the time series data sequence, determine the loss value sequence.

[0079] The loss value sequence includes the loss value corresponding to each time series data, which is obtained based on the loss function; the prediction data sequence includes the prediction data corresponding to each time series data; the server can calculate the loss value corresponding to each time series data and each prediction data of the prediction data sequence through the loss value algorithm, and finally obtain the loss value sequence composed of the loss values.

[0080] Specifically, the server inputs each predicted data corresponding to the predicted data sequence and each time series data corresponding to the time series data sequence into the loss function corresponding to the initial time series data model, calculates the loss value corresponding to each time series data, and forms a loss value sequence from the loss values.

[0081] Step S304: Based on the reference values ​​corresponding to the loss value sequence, determine the predicted state sequence corresponding to the loss value sequence.

[0082] In this system, the loss parameter is the predicted state value, the loss parameter sequence is the predicted state sequence, and the predicted state sequence contains the predicted state values ​​obtained after classifying each loss value. The predicted state value corresponding to each loss value is obtained by matching a reference value in the loss value sequence. The predicted state value is the classification value obtained after classifying each loss value. The reference value corresponding to the loss value sequence is a unified reference loss value for multiple loss values ​​in the loss value sequence. Based on the reference value, the predicted state value of each loss value can be determined.

[0083] Specifically, the server determines a reference value for the loss value sequence, and classifies each loss value based on the reference value and the classification algorithm to obtain the predicted state value corresponding to each loss value. The server can then form a predicted state sequence based on the predicted state values ​​corresponding to each loss value.

[0084] Optionally, a predicted state sequence corresponding to the loss value sequence is determined based on a reference value corresponding to the loss value sequence; wherein the reference value may be at least one of the average or median of each loss value in the loss value sequence.

[0085] In this embodiment, the loss value sequence of the time series data sequence is calculated by the loss function, and the predicted state sequence is obtained by classifying the loss value sequence as the loss parameter sequence. This can reduce the string complexity corresponding to the loss parameter sequence and achieve the technical means of improving the efficiency and accuracy of string matching.

[0086] In one embodiment, such as Figure 4 As shown, the steps for determining the predicted state sequence corresponding to the loss value sequence based on the reference value corresponding to the loss value sequence are as follows:

[0087] Step S402: Based on the algorithm with standard parameters and the loss values ​​contained in the loss value sequence, determine the reference value corresponding to the loss value sequence.

[0088] The algorithm for standard parameters is used to determine the reference values ​​corresponding to the loss value sequence.

[0089] Specifically, an algorithm that inputs each loss value in the loss value sequence into standard parameters obtains a reference value corresponding to the loss value sequence. As an example, inputting each loss value in the loss value sequence into a median algorithm yields the median corresponding to the loss value sequence.

[0090] Step S404: For each of the multiple loss values, determine the target state interval corresponding to the loss value in the multiple state intervals, and determine the predicted state value corresponding to the target state interval.

[0091] Step S406: The predicted state values ​​corresponding to multiple loss values ​​are used as the predicted state sequence corresponding to the loss value sequence.

[0092] The multiple state intervals are determined based on at least one state division threshold. The state division threshold can be determined based on a reference value. A state division threshold can divide at least two range intervals, each range interval representing a state type of the loss value, and each range interval corresponds to a predicted state value.

[0093] Specifically, after obtaining the reference values ​​corresponding to the loss value sequence, the server can set multiple thresholds based on the reference values ​​and obtain multiple state intervals according to the multiple thresholds. Based on this, a corresponding predicted state value can be determined for the loss value in each state interval. Accordingly, the server can traverse the loss value sequence. For each loss value, the server can determine which state interval range the loss value falls within among the multiple state intervals and obtain the corresponding state interval range, thereby obtaining the predicted state value corresponding to the loss value, and finally obtaining the predicted state sequence corresponding to the loss value sequence.

[0094] Optionally, the server uses the first state division threshold and the second state division threshold as the boundaries of the state intervals to determine the first state interval, the second state interval, and the third state interval. The server determines the predicted state values ​​corresponding to the first state interval, the second state interval, and the third state interval as a, b, and c, respectively. Then, the server iterates through n loss values. When it reaches the i-th loss value, the server can determine the target state interval corresponding to the loss value from the three state intervals. If the server determines that the target state interval corresponding to the loss value is the first state interval, then the server determines that the predicted state value corresponding to the loss value is the predicted state value corresponding to the first state interval, which is a. The server can add the predicted state values ​​corresponding to each loss value to the predicted state sequence according to the traversal order of the multiple loss values.

[0095] As an example, the server can determine two thresholds corresponding to the reference value: 1.1 times the reference value and 1.3 times the reference value. Based on this, the server can determine the loss value below 1.1 times the reference value as the first state interval, the loss value above 1.1 times the reference value and below 1.3 times the reference value as the second state interval, and the loss value above 1.3 times the reference value as the third state interval.

[0096] In this embodiment, a reference value for the loss value sequence is calculated using an algorithm with standard parameters. Based on the reference value, each loss value is classified, and the classified predicted state value is obtained. This reduces the string complexity corresponding to the predicted state sequence, thereby improving the string matching efficiency and accuracy.

[0097] In one embodiment, the specific implementation process of the step "based on a string matching algorithm, perform string matching on each loss parameter in the loss parameter sequence to obtain the matching result corresponding to each loss parameter" includes:

[0098] According to the string matching algorithm, string matching is performed on each predicted state value in the predicted state sequence to obtain the string matching value corresponding to each predicted state value, and each string matching value is used as the matching result.

[0099] Among them, the string matching algorithm is an algorithm that finds the substring corresponding to a given string within a string.

[0100] The predicted state sequence can be viewed as a string, and the string matching algorithm can match substrings composed of predicted state values ​​within this sequence. The matching result is the string matching value obtained after string matching of the predicted state sequence, which contains the latent features of each predicted state value. Therefore, substrings with higher matching degrees in the matching result have more regular data features, while substrings with lower matching degrees have more random data features. The matching result corresponding to each predicted state value can represent the latent features contained within each predicted state value, and these latent features are used to adjust the corresponding initial loss function in subsequent steps.

[0101] Specifically, the server uses a string matching algorithm to find a substring composed of multiple predicted state values ​​in the string corresponding to the predicted state sequence, and obtains the string matching value. Each string matching value is used as the matching result, and the matching result records the degree of matching corresponding to each predicted state value in the predicted state sequence.

[0102] In one example, the server receives a predicted state sequence, such as "a,a,b,c,a,a,a,b,c,a". Based on the string matching algorithm, it performs string matching on each predicted state value in the predicted state sequence, obtaining the first i characters of the string and taking the maximum match count at the beginning and end. If i is 2, the characters are "a,a", and the string match count for the second 'a' is 1. If i is 4, the characters are "a,a,b,c", and there are no matching characters, so the string match count for 'c' is 0. If i is 8, the characters are "a,a,b,c,a,a,a,b", and the maximum match count at the beginning and end is 3, where the maximum match count corresponds to "a,a,b". This continues until i is 10, at which point the maximum match count is 5. Finally, the multiple string match values ​​are merged to obtain the matching result: "0,1,0,0,1,1,2,3,4,5".

[0103] In this embodiment, the string matching value corresponding to each predicted state value is calculated by a string matching algorithm, and the matching result is finally determined, so as to achieve the effect of accurately obtaining the string matching value.

[0104] In one embodiment, such as Figure 5 As shown, the steps for adjusting the initial loss function corresponding to the initial time series data model based on the matching results corresponding to each loss parameter to obtain the target loss function are as follows:

[0105] Step S502: Determine the weight coefficient corresponding to each loss parameter based on the preset weight calculation function and the matching results corresponding to each loss parameter.

[0106] Step S504: Based on the weight coefficients corresponding to each loss parameter and the initial loss function, the target loss function is obtained.

[0107] The weight calculation function is used to calculate the weight coefficients. As an example, the weight calculation function can be a modified Sigmoid function, and the value range of the modified Sigmoid function can be [0, 1].

[0108] Specifically, the matching results corresponding to each loss parameter of the server are input into a preset weight calculation function to obtain the weight coefficient of each loss parameter. The weight coefficients corresponding to each loss parameter are used as the weight part of the initial loss function to obtain the target loss function with weight coefficients. As an example, the initial loss function is multiplied by the weight coefficients to obtain the target loss function.

[0109] Optionally, the degree of matching corresponding to the loss parameter is positively correlated with the magnitude of the weight corresponding to that loss parameter. The degree of matching of the first matching result corresponding to the first loss parameter can be higher than the degree of matching of the second matching result corresponding to the second loss parameter. Therefore, the server can determine that the first weight coefficient corresponding to the first loss parameter is greater than the second weight coefficient corresponding to the second loss parameter through a preset weight calculation function. As an example, if the first matching result is 4 and the second matching result is 1, according to the modified Sigmoid function, the first weight coefficient corresponding to the first matching result is calculated to be 1, and the second weight coefficient corresponding to the second matching result is 0.5. Here, the modified Sigmoid function is an increasing function.

[0110] In this embodiment, the loss value corresponding to each time series data is calculated by the loss function, and the loss value sequence is composed of each loss value. The loss value sequence is used as the loss parameter sequence, which can determine the loss value of each time series data and use it as the loss parameter, thereby achieving the effect of efficiently obtaining the features of the time series data.

[0111] In one embodiment, the step of performing string matching on each loss parameter in the loss parameter sequence based on a string matching algorithm to obtain the matching result corresponding to each loss parameter includes the following specific implementation process:

[0112] Based on the KMP algorithm, string matching is performed on each loss parameter in the loss parameter sequence to obtain the matching result corresponding to each loss parameter.

[0113] The KMP algorithm is an improved string matching algorithm. The core of the KMP algorithm is to utilize information from failed matches to minimize the number of matches between the substring and the main string, thus achieving fast matching. The KMP algorithm finds the corresponding substring within a given string. The loss parameter sequence can be viewed as a string, and the KMP algorithm can match substrings composed of the loss parameters within this sequence. The matching result is the string matching value obtained after matching the loss parameter sequence; this value contains the implicit features of each loss parameter.

[0114] Specifically, the server uses the KMP algorithm to find a substring composed of multiple loss parameters in the string corresponding to the loss parameter sequence and obtains the matching result. The matching result records the degree of matching for each loss parameter in the loss parameter sequence.

[0115] In this embodiment, the KMP algorithm is used to obtain the matching results corresponding to the loss parameters, thereby achieving the effect of obtaining highly accurate matching results.

[0116] like Figure 6 As shown below, the specific execution process of the retraining method for the time series data model described above will be described in detail with reference to a specific embodiment.

[0117] First, the retraining process of the time series data model proposed in this application is as follows: Figure 6 As shown. The specific process is as follows:

[0118] 0. The server obtains the time-series data sequence from the terminal, and lets the time-series data sequence be... ;

[0119] 1. Fix the parameters of the initial time series data model, and then process the time series data sequence. Perform one round of prediction calculations sequentially to obtain the predicted data sequence. ;

[0120] 2. Calculate the loss value sequence by combining the predicted data sequence and the time series data sequence using a loss function or other user-defined metric formula. ;

[0121] 3. The median is calculated from the loss value sequence. The median is used as the average accuracy of the model's prediction results for data during normal equipment operation. :

[0122]

[0123] 4. Based on the median of the loss value For the loss value sequence Perform state division, such as classifying states below... Let the state of the loss value be 'a', and then... The loss value state within the interval is set as b, and so on to obtain the predicted state sequence. ,like:

[0124]

[0125] 5. Perform state matching on the predicted state sequence using the KMP algorithm to obtain the state matching sequence. ,like:

[0126]

[0127] 6. Use custom functions to assign weights to the state matching sequences, such as variants of the Sigmoid function:

[0128]

[0129] Thus, the weight coefficient sequence is obtained. ;

[0130] Its user-defined function should be characterized by assigning lower weights to smaller predicted state values ​​in the state-matching sequence and higher weights to larger predicted state values, with the interval limited to [specific range]. The image of the above variant of the Sigmoid function is as follows. Figure 7 As shown.

[0131] 7. Add the weight coefficient sequence to the loss function as additional weight coefficients, and then start model tuning and training to obtain the target time series data model.

[0132] The time-series data model retraining method provided in this embodiment can complete the retraining of the time-series data model without introducing knowledge of unfamiliar data signals or incurring a large amount of additional computation, even under noisy data interference. Accordingly, the time-series data model retraining method provided in this embodiment improves the unfamiliar data signal detection method for time-series data, realizing an end-to-end time-series data model retraining method that includes unfamiliar data signal detection.

[0133] The retraining method for time series data models provided in this embodiment can also reduce manual workload, improve the accuracy of unfamiliar data signal detection, effectively suppress the interference of noise data on time series data models, enhance the anti-noise interference ability of time series data models, improve the prediction accuracy and precision of time series data models, and endow the model with long-term sustainable self-optimization ability.

[0134] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0135] Based on the same inventive concept, this application also provides a retraining apparatus for a time series data model to implement the retraining method for the time series data model described above. The solution provided by this apparatus is similar to the implementation described in the above method. Therefore, the specific limitations in one or more retraining apparatus embodiments for time series data models provided below can be found in the limitations of the retraining method for time series data models described above, and will not be repeated here.

[0136] In one embodiment, such as Figure 8 As shown, a retraining device 800 for a time series data model is provided, including: a loss parameter determination module 801, a string matching module 802, a loss function adjustment module 803, and a retraining module 804, wherein:

[0137] The loss parameter determination module is used to determine the loss parameter sequence corresponding to the time series data sequence based on the time series data sequence and the prediction data sequence. The time series data sequence contains multiple time series data arranged in chronological order, the prediction data sequence is obtained by inputting the time series data sequence into the initial time series data model, and the loss parameter sequence contains multiple loss parameters, each of which corresponds one-to-one with each time series data.

[0138] The string matching module is used to perform string matching on each loss parameter in the loss parameter sequence based on the string matching algorithm, and obtain the matching result corresponding to each loss parameter.

[0139] The loss function adjustment module is used to adjust the initial loss function corresponding to the initial time series data model based on the matching results corresponding to each loss parameter, so as to obtain the target loss function.

[0140] The retraining module is used to retrain the initial time series data model based on the time series data contained in the time series data and the target loss function, so as to obtain the retrained target time series data model.

[0141] Furthermore, the loss parameter is the predicted state value, the loss parameter sequence is the predicted state sequence, and the loss parameter determination module is specifically used for: determining the loss value sequence based on the loss value algorithm, each predicted data corresponding to the predicted data sequence, and each time series data corresponding to the time series data sequence, the loss value sequence including the loss value corresponding to each time series data; and determining the predicted state sequence corresponding to the loss value sequence based on the reference value corresponding to the loss value sequence; wherein, the predicted state sequence includes the predicted state values ​​obtained after classifying each loss value.

[0142] Furthermore, the loss parameter determination module is specifically used for: determining the reference value corresponding to the loss value sequence based on the algorithm of standard parameters and each loss value contained in the loss value sequence; for each loss value among multiple loss values, determining the target state interval corresponding to the loss value in multiple state intervals, and determining the predicted state value corresponding to the target state interval, wherein the multiple state intervals are determined based on at least one state division threshold; and using the predicted state values ​​corresponding to the multiple loss values ​​as the predicted state sequence corresponding to the loss value sequence.

[0143] Furthermore, the string matching module is specifically used to: perform string matching on each predicted state value in the predicted state sequence according to the string matching algorithm, obtain the string matching value corresponding to each predicted state value, and use each string matching value as the matching result.

[0144] Furthermore, the loss function adjustment module is specifically used to: determine the weight coefficients corresponding to each loss parameter based on the preset weight calculation function and the matching results corresponding to each loss parameter; and obtain the target loss function based on the weight coefficients corresponding to each loss parameter and the initial loss function.

[0145] Furthermore, the string matching module is specifically used to: perform string matching on each loss parameter in the loss parameter sequence based on the KMP algorithm, and obtain the matching result corresponding to each loss parameter.

[0146] Each module in the retraining device for the aforementioned time-series data model can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0147] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores time-series data from Internet of Things (IoT) devices. The I / O interfaces are used for information exchange between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a retraining method for a time-series data model.

[0148] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0149] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0150] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0151] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0152] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0153] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0154] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0155] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A retraining method for a time series data model, characterized in that, The method includes: Based on the time-series data sequence and the prediction data sequence, a loss parameter sequence corresponding to the time-series data sequence is determined; wherein, the time-series data sequence contains multiple time-series data arranged in chronological order, the prediction data sequence is obtained by inputting the time-series data sequence into an initial time-series data model, and the loss parameter sequence contains multiple loss parameters, each of which corresponds one-to-one with each of the time-series data; the time-series data is the location data of shared bicycles at each time node within a preset time period; Based on the string matching algorithm, string matching is performed on each of the loss parameters in the loss parameter sequence to obtain the matching result corresponding to each of the loss parameters. Based on the matching results corresponding to each of the loss parameters, the initial loss function corresponding to the initial time series data model is adjusted to obtain the target loss function; Based on the time series data contained in the time series data and the target loss function, the initial time series data model is retrained to obtain the retrained target time series data model. Wherein, the loss parameter is the predicted state value, and the loss parameter sequence is the predicted state sequence; The step of determining the loss parameter sequence corresponding to the time series data sequence based on the time series data sequence and the predicted data sequence includes: Based on the loss value algorithm, each predicted data corresponding to the predicted data sequence, and each time series data corresponding to the time series data sequence, a loss value sequence is determined, wherein the loss value sequence includes the loss value corresponding to each of the time series data. Based on the reference values ​​corresponding to the loss value sequence, a predicted state sequence corresponding to the loss value sequence is determined; wherein, the predicted state sequence includes the predicted state values ​​obtained after classifying each loss value.

2. The method according to claim 1, characterized in that, Determining the predicted state sequence corresponding to the loss value sequence based on the reference value corresponding to the loss value sequence includes: Based on the algorithm with standard parameters and the loss values ​​contained in the loss value sequence, a reference value corresponding to the loss value sequence is determined; For each of the multiple loss values, a target state interval corresponding to the loss value is determined in multiple state intervals, and a predicted state value corresponding to the target state interval is determined. The multiple state intervals are determined based on at least one state division threshold. The predicted state values ​​corresponding to the multiple loss values ​​are used as the predicted state sequence corresponding to the loss value sequence.

3. The method according to claim 1, characterized in that, The string matching algorithm is used to perform string matching on each loss parameter in the loss parameter sequence to obtain the matching result corresponding to each loss parameter, including: According to the string matching algorithm, string matching is performed on each of the predicted state values ​​in the predicted state sequence to obtain the string matching value corresponding to each predicted state value, and each string matching value is used as the matching result.

4. The method according to claim 1, characterized in that, The step of adjusting the initial loss function corresponding to the initial time series data model based on the matching results corresponding to each of the aforementioned loss parameters to obtain the target loss function includes: Based on the preset weight calculation function and the matching results corresponding to each loss parameter, the weight coefficient corresponding to each loss parameter is determined. Based on the weight coefficients corresponding to each of the loss parameters and the initial loss function, the target loss function is obtained.

5. The method according to claim 1, characterized in that, The string matching algorithm is used to perform string matching on each loss parameter in the loss parameter sequence to obtain the matching result corresponding to each loss parameter, including: Based on the KMP algorithm, string matching is performed on each loss parameter in the loss parameter sequence to obtain the matching result corresponding to each loss parameter.

6. A retraining device for a time series data model, characterized in that, The device includes: A loss parameter determination module is used to determine a loss parameter sequence corresponding to the time-series data sequence based on a time-series data sequence and a prediction data sequence. The time-series data sequence contains multiple time-series data arranged in chronological order. The prediction data sequence is obtained by inputting the time-series data sequence into an initial time-series data model. The loss parameter sequence contains multiple loss parameters, each corresponding one-to-one with a specific time-series data point. The time-series data is the location data of a shared bicycle at each time node within a preset time period. The loss parameters are predicted state values, and the loss parameter sequence is a predicted state sequence. The loss parameter determination module is used to determine a loss value sequence based on a loss value algorithm, each predicted data point corresponding to the prediction data sequence, and each time-series data point corresponding to the time-series data sequence. The loss value sequence includes loss values ​​corresponding to each time-series data point. Based on a reference value corresponding to the loss value sequence, the module determines a predicted state sequence corresponding to the loss value sequence. The predicted state sequence includes predicted state values ​​obtained after classifying each loss value. The string matching module is used to perform string matching on each of the loss parameters in the loss parameter sequence based on the string matching algorithm, and obtain the matching result corresponding to each of the loss parameters respectively. The loss function adjustment module is used to adjust the initial loss function corresponding to the initial time series data model based on the matching results corresponding to each of the loss parameters, so as to obtain the target loss function. The retraining module is used to retrain the initial time series data model based on each time series data contained in the time series data and the target loss function, so as to obtain the retrained target time series data model.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Character recognition improved training method based on center loss

    CN113326833A

  • Research Analysis System

    US20160259841A1