Incremental learning and meta learning combined prediction model online updating method and system

By combining the predictive model online update method of incremental learning and meta-learning, and using data and model adapters to adjust stock price data, the problem of distribution offset and high cost of rolling retraining in incremental learning is solved, and higher prediction accuracy is achieved. performance and model adaptability.

CN118863019APending Publication Date: 2024-10-29SHANGHAI JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310476516.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-27
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

In the existing technology, incremental learning is difficult to effectively apply in the field of stock price prediction, mainly due to the distribution shift problem that causes the prediction model to perform unstable on test data, and the high storage and time costs of rolling retraining are its fatal flaws.

Method used

An online update method for prediction models that combines incremental learning and meta-learning is adopted. By designing data adapters and model adapters, the incremental data and test data are adjusted through factor adaptation functions and label adaptation functions respectively, so as to optimize prediction model parameters and reduce distribution bias. Shift, and update the adapter parameters through single-step gradient descent to improve model generalization ability.

Benefits of technology

It effectively reduces the impact of distribution shifts, improves the adaptability and prediction accuracy of incremental data, avoids overfitting, achieves rapid model updates with less incremental data, and improves the accuracy of stock price predictions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118863019A_ABST
    Figure CN118863019A_ABST
Patent Text Reader

Abstract

The invention provides an incremental learning and meta learning combined prediction model online updating method and system, and the method comprises the steps: designing two meta learners based on the thought of meta learning, the two meta learners are a data adapter and a model adapter, and the data adapter adjusts original stock factors and labels in incremental data; the model adapter learns a parameter value suitable for the current period according to the adaptive incremental data, so as to update the prediction model and deploy the prediction model on line; the data adapter adjusts an original stock factor of the test data; the prediction model carries out prediction according to the matched stock factors in the test data; and optimizing the data adapter and the model adapter according to the predicted loss. According to the method, the challenge of distribution offset on incremental learning is solved, and the share price prediction model can be quickly updated by effectively utilizing less incremental data, so that higher prediction accuracy is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of deep learning technology, and in particular to a method and system for online updating of a prediction model combining incremental learning and meta-learning. Background Art

[0002] Thanks to the rapid development of deep learning technology, more and more researchers and investors are applying neural network-based prediction models to (stock) price prediction tasks, and have successfully mined the intricate financial information patterns in the (stock) market. In online application scenarios, researchers can continuously obtain new data, update the prediction model online with the new data collected online, and continue to learn the latest financial information, which is particularly important for improving the prediction accuracy of the model. Therefore, the industry usually adopts the online update method of rolling retraining, that is, periodically retraining a new prediction model using all known data to replace the old model online. However, considering the requirements of hyperparameter adjustment and algorithm selection, the high storage cost and time cost are a fatal flaw of rolling retraining.

[0003] Incremental learning is an online update method often used in other fields such as computer vision and recommendation systems. That is, the model is fine-tuned only on the latest incremental data instead of storing the early historical data that has been learned. Since incremental data only accounts for a very small part of the total data, incremental learning can greatly save storage and time costs and has scalability on large-scale data. However, due to the high volatility of the market, the data distribution of incremental data and future test data is often inconsistent. Incremental learning is limited by the distribution offset problem and is difficult to apply in the prediction field. Therefore, there is little in-depth research.

[0004] The characteristic of meta-learning is "two-level optimization" for base learners and meta-learners. Among them, the lower-level optimization is used to update the neural network parameter weights of the base learner (i.e., the prediction model), but some hyperparameters of deep learning (such as learning rate, label, initial value of model parameters, sample weight, etc.) cannot be updated in the lower-level optimization. Therefore, such hyperparameters are provided by the meta-learner as parameters of the meta-learner; meta-learning updates the meta-learner through upper-level optimization, thereby automatically finding the optimal value of the hyperparameter.

[0005] The (stock) market is a well-known non-steady-state environment, and its data distribution shows irregular shifts over time. Taking incremental learning on a monthly basis as an example, the prediction model is fine-tuned on the data of the most recent month (i.e., incremental data), and then predicted on the data of the next month (i.e., test data), in order to accurately predict the financial patterns that recur in both datasets. However, due to the problem of distribution shift, the test data does not maintain the same data distribution as the incremental data, and the prediction model cannot stably benefit from the incremental update, and even fails to predict due to overfitting to the incremental data.

[0006] Patent document CN114154820A (application number: CN202111384905.X) discloses a production bottleneck prediction method based on incremental simple recurrent units and dual attention, which redefines and quantifies production bottlenecks; adopts a simple recurrent unit network based on a dual-layer attention mechanism for feature extraction to complete the construction of a bottleneck prediction source model; triggers incremental updates of source model parameters with the help of sliding time windows and fast Hofferding concept detection methods; selects the prediction model that best adapts to the current data distribution and appropriate new manufacturing data in the model library, and sets different value weights for data samples, and realizes incremental updates of prediction models through model-based transfer learning, and adopts an elimination mechanism to update the model library to ensure the timeliness of the model library. However, this patent cannot solve the existing technical problems, nor can it meet the needs of the present invention. Summary of the invention

[0007] In view of the defects in the prior art, the purpose of the present invention is to provide a method and system for online updating of a prediction model combining incremental learning and meta-learning.

[0008] The online updating method of the prediction model combining incremental learning and meta-learning provided by the present invention includes:

[0009] Step S1: Based on the idea of ​​meta-learning, two meta-learners are designed, namely data adapter and model adapter. The data adapter adjusts the original data factors in the incremental data through the factor adaptation function, and adjusts the labels of the incremental data through the label adaptation function.

[0010] Step S2: Using the model adapter, learn the parameter values ​​suitable for the current period based on the adjusted incremental data, update the prediction model, and deploy it online;

[0011] Step S3: adjusting the original data factors of the test data through the factor adaptation function based on the data adapter;

[0012] Step S4: The prediction model is used to make predictions based on the adjusted data factors in the test data. The model output value is inversely transformed by the label adaptation function and adjusted to the final label prediction value.

[0013] Step S5: After the current prediction phase is completed, the prediction loss is calculated based on the label prediction value and the obtained label true value, thereby optimizing the two meta-learners.

[0014] Preferably, the step S1 comprises:

[0015] The vector of D factors of the original data is recorded as The corresponding label to be predicted is recorded as Each adaptation head is implemented as an affine transformation, and its transformation parameter weights are not shared with each other. The i-th factor adaptation head is defined as:

[0016] g i (x) = W i x+b i

[0017] in, is the transformation matrix of the i-th factor adaptation head, is the transformation offset of the i-th factor adaptation head, and the multi-head factor adaptation function G with m adaptation heads is defined as:

[0018]

[0019] in, represents the transformed factor vector, s i Determine the participation degree of the i-th adapter head, set m paradigm vectors to indicate which adapter head is more suitable for this transformation, and the i-th paradigm is recorded as First calculate x and p i The cosine similarity of Then use softmax normalization Get i , the expression is:

[0020]

[0021] Among them, τ is a positive hyperparameter used to control the temperature of softmax;

[0022] The multi-head label adaptation function contains m label adaptation heads, and the i-th label adaptation head is defined as:

[0023] h i (y) = γ i y+β i

[0024] in, is the scaling variable of the i-th tag adaptation header, is the offset of the i-th label adapter head. The multi-head label adaptation function H with m adapter heads is defined as:

[0025]

[0026] in, Represents the transformed label;

[0027] Let ψ be the parameter set of the data adapter, that is The adapted incremental data and test data are expressed as:

[0028]

[0029]

[0030] Among them, only after the forecast ends on the day, Therefore, in the prediction process of the test set, the label of the test set cannot be adjusted, but the label prediction value of the model can be adjusted by the inverse transformation of the label adaptation function. The inverse transformation of the label adaptation function H -1 Defined as:

[0031]

[0032] in,

[0033]

[0034] When the data is a time series, the same adaptation parameters are applied to each time step, denoted by x = {x1, x2, …, x L} is a time series of length L, each element represents the d stock factors at the jth time step, and the factor adaptation function transforms the factors of each time step respectively, that is, The participation degree of the i-th factor adapter head at the j-th time step is denoted as s ij , calculated as p normalized by softmax i With x j In label adaptation, the concatenated x is mapped to a low-dimensional vector through a linear layer. The participation degree of the i-th label adaptation head is calculated by the additional paradigm and the low-dimensional vector, and its paradigm dimension is consistent with the low-dimensional vector.

[0035] Preferably, the step S2 comprises:

[0036] Let F be the prediction model. In the kth incremental learning task, the model adapter first uses the parameter φ k-1 Initialize the parameter values ​​of the prediction model, and then fine-tune F(·;φ) on the adapted incremental data k-1 ), where the mean square error MSE is used to calculate the training loss The fine-tuned parameter values ​​are defined as:

[0037]

[0038] Among them, η θ is the prediction model learning rate; represents the gradient of the parameter φ.

[0039] Preferably, step S5 comprises:

[0040] The incrementally updated model F(·; θ k ) is deployed online, and the adapted test data set Calculate the mean square error between the predicted value and the true value In addition, to avoid the adapted labels being too abnormal and difficult to learn, The mean square error between the adapted value and the true value is calculated as the regularization term Final test error Defined as:

[0041]

[0042] Among them, the hyperparameter α controls the regularization strength;

[0043] Finally, the model adapter parameters φ are updated by a single step of gradient descent k-1 and the data adapter parameter ψ k-1 :

[0044]

[0045]

[0046] Among them, η φ and η ψ are the learning rates of the model adapter and data adapter respectively.

[0047] Preferably, the training algorithm uses an offline-online two-stage training framework, specifically:

[0048] Input: Meta-training set Meta-validation set Meta test set

[0049] Output: trained adapter parameters φ and ψ, online prediction results;

[0050] 1) Initialize φ and ψ;

[0051] 2) Repeat the following steps ae until the performance degradation meets the preset conditions:

[0052] a. ← Random Arrangement

[0053] b、φ,ψ,Meta-training set prediction results←single-round incremental learning (φ,ψ, );

[0054] c. φ′, ψ′←create a copy of φ, ψ;

[0055] d, φ′, ψ′, meta-validation set prediction results ← single-round incremental learning (φ′, ψ′, );

[0056] e. Evaluate the prediction results of the meta-validation set;

[0057] 3)φ,ψ, meta-validation set prediction results ∪ online prediction results ← single-round incremental learning (φ,ψ, );

[0058] 4) Return the online prediction results of φ and ψ.

[0059] The prediction model online updating system combining incremental learning and meta-learning provided by the present invention includes:

[0060] Module M1: Based on the idea of ​​meta-learning, two meta-learners are designed, namely data adapter and model adapter. The data adapter adjusts the original data factors in the incremental data through the factor adaptation function, and adjusts the labels of the incremental data through the label adaptation function.

[0061] Module M2: Use the model adapter to learn the parameter values ​​suitable for the current period based on the adjusted incremental data, update the prediction model, and deploy it online;

[0062] Module M3: adjusting the original data factors of the test data through the factor adaptation function based on the data adapter;

[0063] Module M4: The prediction model is used to make predictions based on the adjusted data factors in the test data. The model output value is inversely transformed by the label adaptation function and adjusted to the final label prediction value.

[0064] Module M5: After the prediction phase, the prediction loss is calculated based on the label prediction value and the obtained label true value to optimize the two meta-learners.

[0065] Preferably, the module M1 comprises:

[0066] The vector of D factors of the original data is recorded as The corresponding label to be predicted is recorded as Each adaptation head is implemented as an affine transformation, and its transformation parameter weights are not shared with each other. The i-th factor adaptation head is defined as:

[0067] g i (x) = W i x+b i

[0068] in, is the transformation matrix of the i-th factor adaptation head, is the transformation offset of the i-th factor adaptation head, and the multi-head factor adaptation function G with m adaptation heads is defined as:

[0069]

[0070] in, represents the transformed factor vector, s i Determine the participation degree of the i-th adapter head, set m paradigm vectors to indicate which adapter head is more suitable for this transformation, and the i-th paradigm is recorded as First calculate x and p i The cosine similarity of Then use softmax normalization Get i , the expression is:

[0071]

[0072] Among them, τ is a positive hyperparameter used to control the temperature of softmax;

[0073] The multi-head label adaptation function contains m label adaptation heads, and the i-th label adaptation head is defined as:

[0074] h i (y) = γ i y+β i

[0075] in, is the scaling variable of the i-th tag adaptation header, is the offset of the i-th label adapter head. The multi-head label adaptation function H with m adapter heads is defined as:

[0076]

[0077] in, Represents the transformed label;

[0078] Let ψ be the parameter set of the data adapter, that is The adapted incremental data and test data are expressed as:

[0079]

[0080]

[0081] Among them, only after the forecast ends on the day, Therefore, in the prediction process of the test set, the label of the test set cannot be adjusted, but the label prediction value of the model can be adjusted by the inverse transformation of the label adaptation function. The inverse transformation of the label adaptation function H-1 Defined as:

[0082]

[0083] in,

[0084]

[0085] When the data is a time series, the same adaptation parameters are applied to each time step, denoted by x = {x1, x2, …, x L} is a time series of length L, each element represents the d stock factors at the jth time step, and the factor adaptation function transforms the factors of each time step respectively, that is, The participation degree of the i-th factor adapter head at the j-th time step is denoted as s ij , calculated as p normalized by softmax i With x j In label adaptation, the concatenated x is mapped to a low-dimensional vector through a linear layer. The participation degree of the i-th label adaptation head is calculated by the additional paradigm and the low-dimensional vector, and its paradigm dimension is consistent with the low-dimensional vector.

[0086] Preferably, the module M2 comprises:

[0087] Let F be the prediction model. In the kth incremental learning task, the model adapter first uses the parameter φ k-1 Initialize the parameter values ​​of the prediction model, and then fine-tune F(·;φ) on the adapted incremental data k-1 ), where the mean square error MSE is used to calculate the training loss The fine-tuned parameter values ​​are defined as:

[0088]

[0089] Among them, η θ is the prediction model learning rate; represents the gradient of the parameter φ.

[0090] Preferably, the module M5 comprises:

[0091] The incrementally updated model F(·; θ k ) is deployed online, and the adapted test data set Calculate the mean square error between the predicted value and the true value In addition, to avoid the adapted labels being too abnormal and difficult to learn, The mean square error between the adapted value and the true value is calculated as the regularization term Final test error Defined as:

[0092]

[0093] Among them, the hyperparameter α controls the regularization strength;

[0094] Finally, the model adapter parameters φ are updated by a single step of gradient descent k-1 and the data adapter parameter ψ k-1 :

[0095]

[0096]

[0097] Among them, η φ and η ψ are the learning rates of the model adapter and data adapter respectively.

[0098] Preferably, the training algorithm uses an offline-online two-stage training framework, specifically:

[0099] Input: Meta-training set Meta-validation set Meta test set

[0100] Output: trained adapter parameters φ and ψ, online prediction results;

[0101] 1) Initialize φ and ψ;

[0102] 2) Repeatedly trigger the following modules ae until the performance degradation meets the preset conditions:

[0103] Module a, ← Random Arrangement

[0104] Module b, φ, ψ, meta-training set prediction results ← single-round incremental learning (φ, ψ, );

[0105] Module c, φ′, ψ′← creates a copy of φ, ψ;

[0106] Module d, φ′, ψ′, meta-validation set prediction results ← single-round incremental learning (φ′, ψ′, );

[0107] Module e, evaluate the prediction results of the meta-validation set;

[0108] 3)φ,ψ, meta-validation set prediction results ∪ online prediction results ← single-round incremental learning (φ,ψ, );

[0109] 4) Return the online prediction results of φ and ψ.

[0110] Compared with the prior art, the present invention has the following beneficial effects:

[0111] (1) The present invention proposes a fine-grained data adaptation method, which adjusts the stock price factor and label of each stock to make the data distribution of incremental data and test data tend to be locally stable, reducing the impact of distribution deviation problems at the data level and preparing for incremental updates;

[0112] (2) At the model level, the present invention proposes to pursue a better initial parameter value for each incremental learning task, and try to avoid overfitting or underfitting to the incremental data, so that the model can maintain a high generalization ability and adaptability;

[0113] (3) The present invention is based on the idea of ​​meta-learning. By designing the meta-learning optimization goal, it automatically realizes the appropriate data adaptation method and the appropriate parameter initial value, solves the challenge of distribution shift to incremental learning, and can effectively use less incremental data to quickly update the stock price prediction model to achieve higher prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0114] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0115] Figure 1 This is a schematic diagram of the process of a single incremental learning task. DETAILED DESCRIPTION

[0116] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0117] Embodiment 1:

[0118] like Figure 1, the present invention provides an online update method for a prediction model that combines incremental learning and meta-learning, specifically: based on the idea of ​​meta-learning, two meta-learners are designed, named data adapter and model adapter. The data adapter is intended to adjust the incremental data and test data to reduce the data distribution differences between the two data sets; the model adapter is intended to provide better initial values ​​for the parameters of the prediction model. The desired initial parameters can fully learn the latest financial knowledge in the incremental data after the incremental update, while maintaining the generalization ability to deal with unknown test data. The present invention mainly considers mapping the factors (i.e., the characteristics of the stock) and the corresponding labels (such as the closing price or the increase or decrease of the next day) of each stock to a suitable distribution. Each incremental learning task in the present invention is composed of the incremental data acquired in the recent period and the test data to be predicted in the future. Each task mainly includes the following five steps:

[0119] Step S1, the data adapter adjusts the original data factors in the incremental data through a factor adaptation function, and adjusts each label of the incremental data through a label adaptation function;

[0120] Step S2: The model adapter learns the parameter values ​​suitable for the current period based on the adjusted incremental data, updates the prediction model, and deploys it online;

[0121] Step S3, the data adapter adjusts the original data factors of the test data through the factor adaptation function;

[0122] Step S4, the prediction model makes predictions based on the adjusted data factors in the test data, and the model output value is adjusted to the final label prediction value through the inverse transformation of the label adaptation function;

[0123] Step S5, after the current prediction phase is completed, the prediction loss is calculated based on the label prediction value and the acquired label true value, and the two meta-learners, namely the data adapter and the model adapter, are optimized.

[0124] The step S1 comprises:

[0125] The vector of D factors of the original data is recorded as The corresponding label to be predicted is recorded as The present invention proposes a multi-head factor adaptation function, which implements each adaptation head as an affine transformation, and the transformation parameter weights are not shared with each other. The i-th factor adaptation head is defined as:

[0126] g i (x) = W i x+b i

[0127] in, is the transformation matrix of the i-th factor adaptation head, is the transformation offset of the i-th factor adaptation head. The multi-head factor adaptation function G with m adaptation heads is defined as:

[0128]

[0129] in, represents the transformed factor vector, s i Determine the participation degree of the i-th adapter. The present invention sets m paradigm vectors to indicate which adapter is more suitable for this transformation. The i-th paradigm is recorded as First calculate x and p i The cosine similarity of Then use softmax normalization Get i , the expression is:

[0130]

[0131] Among them, τ is a positive hyperparameter used to control the temperature of softmax;

[0132] The multi-head label adaptation function contains m label adaptation heads, and the i-th label adaptation head is defined as:

[0133] h i (y) = γ i y+β i

[0134] in, is the scaling variable of the i-th tag adaptation header, is the offset of the i-th label adapter head. The multi-head label adaptation function H with m adapter heads is defined as:

[0135]

[0136] in, Represents the transformed label.

[0137] Let ψ be the parameter set of the data adapter, that is The adapted incremental data and test data are expressed as:

[0138]

[0139]

[0140] Among them, only after the forecast ends on the day, Therefore, in the prediction process of the test set, the label of the test set cannot be adjusted, but the label prediction value of the model can be adjusted by the inverse transformation of the label adaptation function. The inverse transformation of the label adaptation function H-1 Defined as:

[0141]

[0142] in,

[0143]

[0144] In some embodiments, when the stock data is a time series, the present invention applies the same adaptation parameters to each time step. L} is a time series of length L, each element represents the d stock factors at the jth time step. The factor adaptation function transforms the factors at each time step, that is, The participation degree of the i-th factor adapter head at the j-th time step is denoted as s ij , calculated as p normalized by softmax i With x j In label adaptation, the concatenated x is mapped to a low-dimensional vector via a simple linear layer, and the participation of the i-th label adaptation head is calculated by the additional paradigm and the low-dimensional vector, and its paradigm dimension is consistent with the low-dimensional vector.

[0145] The step S2 comprises:

[0146] Let F be the prediction model. In the kth incremental learning task, the model adapter first uses the parameter φ k-1 Initialize the parameter values ​​of the prediction model, and then fine-tune F(·;φ) on the adapted incremental data k-1 ). Among them, the present invention uses mean square error MSE to calculate the training loss The fine-tuned parameter values ​​are defined as:

[0147]

[0148] Among them, η θ is the prediction model learning rate; represents the gradient of the parameter φ.

[0149] The step S5 comprises:

[0150] The incrementally updated model F(·;θ k ) is deployed online, and the adapted test data set Calculate the mean square error between the predicted value and the true value In addition, to avoid the adapted labels being too abnormal and difficult to learn, The mean square error between the adapted value and the true value is calculated as the regularization term Final test error Defined as:

[0151]

[0152] Among them, the hyperparameter α controls the regularization strength.

[0153] Finally, the model adapter parameters φ are updated by a single step of gradient descent k-1 and the data adapter parameter ψ k-1 :

[0154]

[0155]

[0156] Among them, η φ and η ψ are the learning rates of the model adapter and data adapter respectively.

[0157] The training algorithm uses an "offline-online" two-stage training framework, specifically:

[0158] Input: Meta-training set Meta-validation set Meta test set

[0159] Output: trained adapter parameters φ and ψ, online prediction results.

[0160] 1) Initialize φ and ψ;

[0161] 2) Repeat the following steps ae until the performance degradation meets the preset conditions:

[0162] a. ← Random Arrangement

[0163] b、φ,ψ, prediction results of meta-training set←single-round incremental learning(φ,ψ, );

[0164] c. φ′, ψ′←create a copy of φ, ψ;

[0165] d, φ′, ψ′, meta-validation set prediction results ← single-round incremental learning (φ′, ψ′, );

[0166] e. Evaluate the prediction results of the meta-validation set;

[0167] 3)φ,ψ, meta-validation set prediction results ∪ online prediction results ← single-round incremental learning (φ,ψ, );

[0168] 4) Return the online prediction results of φ and ψ.

[0169] Embodiment 2:

[0170] The present invention also provides an online update system for a prediction model that combines incremental learning and meta-learning. The online update system for a prediction model that combines incremental learning and meta-learning can be implemented by executing the process steps of the online update method for a prediction model that combines incremental learning and meta-learning, that is, those skilled in the art can understand the online update method for a prediction model that combines incremental learning and meta-learning as a preferred implementation of the online update system for a prediction model that combines incremental learning and meta-learning.

[0171] According to the online update system of the prediction model combining incremental learning and meta-learning provided by the present invention, it includes: module M1: based on the idea of ​​meta-learning, two meta-learners are designed, namely a data adapter and a model adapter, the data adapter adjusts the original data factors in the incremental data through a factor adaptation function, and adjusts each label of the incremental data through a label adaptation function; module M2: learns parameter values ​​suitable for the current period according to the adjusted incremental data through the model adapter, thereby updating the prediction model and deploying it online; module M3: based on the data adapter, adjusts the original data factors of the test data through the factor adaptation function; module M4: predicts according to the adjusted data factors in the test data through the prediction model, and the model output value is adjusted to the final label prediction value through the inverse transformation of the label adaptation function; module M5: after the end of this prediction stage, the prediction loss is calculated according to the label prediction value and the acquired label true value, thereby optimizing the two meta-learners.

[0172] The module M1 includes: recording the vector of the original data consisting of D factors as The corresponding label to be predicted is recorded as Each adaptation head is implemented as an affine transformation, and its transformation parameter weights are not shared with each other. The i-th factor adaptation head is defined as: g i (x) = W i x+b i ,in, is the transformation matrix of the i-th factor adaptation head, is the transformation offset of the i-th factor adaptation head, and the multi-head factor adaptation function G with m adaptation heads is defined as: in, represents the transformed factor vector, s i Determine the participation degree of the i-th adapter head, set m paradigm vectors to indicate which adapter head is more suitable for this transformation, and the i-th paradigm is recorded as First calculate x and p i The cosine similarity of Then use softmax normalization Get i , the expression is: Among them, τ is a positive hyperparameter used to control the temperature of softmax; the multi-head label adaptation function contains m label adaptation heads, and the i-th label adaptation head is defined as: h i (y) = γ i y+β i ,in, is the scaling variable of the i-th tag adaptation header, is the offset of the i-th label adapter head. The multi-head label adaptation function H with m adapter heads is defined as: in, represents the transformed label; ψ is the parameter set of the data adapter, that is, The adapted incremental data and test data are expressed as: Among them, only after the forecast ends on the day, Therefore, in the prediction process of the test set, the label of the test set cannot be adjusted, but the label prediction value of the model can be adjusted by the inverse transformation of the label adaptation function. The inverse transformation of the label adaptation function H -1 Defined as: in, When the data is a time series, the same adaptation parameters are applied to each time step, denoted by x = {x1, x2, …, x L} is a time series of length L, each element represents the d stock factors at the jth time step, and the factor adaptation function transforms the factors of each time step respectively, that is, The participation degree of the i-th factor adapter head at the j-th time step is denoted as s ij , calculated as p normalized by softmax i With x j In label adaptation, the concatenated x is mapped to a low-dimensional vector through a linear layer. The participation degree of the i-th label adaptation head is calculated by the additional paradigm and the low-dimensional vector, and its paradigm dimension is consistent with the low-dimensional vector.

[0173] The module M2 includes: Let F be the prediction model. In the kth incremental learning task, the model adapter first uses the parameter φ k-1 Initialize the parameter values ​​of the prediction model, and then fine-tune F(·;φ) on the adapted incremental data k-1 ), where the mean square error MSE is used to calculate the training loss The fine-tuned parameter values ​​are defined as: Among them, η θ is the prediction model learning rate; represents the gradient of the parameter φ.

[0174] The module M5 includes: updating the incrementally updated model F(·; θ k ) is deployed online, and the adapted test data set Calculate the mean square error between the predicted value and the true value In addition, to avoid the adapted labels being too abnormal and difficult to learn, The mean square error between the adapted value and the true value is calculated as the regularization term Final test error Defined as: Among them, the hyperparameter α controls the regularization strength; finally, the model adapter parameter φ is updated by single-step gradient descent k-1 and the data adapter parameter ψ k-1 : Among them, η φ and η ψ are the learning rates of the model adapter and data adapter respectively.

[0175] The training algorithm uses an offline-online two-stage training framework, specifically: Input: Meta-training set Meta-validation set Meta test set Output: trained adapter parameters φ and ψ, online prediction results; 1) Initialize φ and ψ; 2) Repeatedly trigger the following modules ae until the performance degradation meets the preset conditions: Module a, ← Random Arrangement Module b, φ, ψ, meta-training set prediction results ← single-round incremental learning (φ, ψ, ); Module c, φ′, ψ′← create φ, ψ copies; Module d, φ′, ψ′, meta-validation set prediction results ← single-round incremental learning (φ′, ψ′, ); Module e, evaluate the prediction results of the meta-validation set; 3) φ, ψ, meta-validation set prediction results ∪ online prediction results ← single-round incremental learning (φ, ψ, );4) Return the online prediction results of φ, ψ.

[0176] The framework of the present invention is characterized by:

[0177] a) Fine-grained data adaptation. In order to reduce the difference in data distribution between incremental data and test data, the present invention proposes to modify and adapt the two data sets at a fine-grained level, that is, to transform the factors and labels in each stock data respectively. On the one hand, the incremental data should adapt to the future data distribution to make the model training more reliable and effective; on the other hand, the test data should adapt to the experience learned in the past to make the model easier to predict accurately. The present invention proposes a multi-head factor adaptation function and a multi-head label adaptation function to realize the data adapter.

[0178] b) Model adaptation with generalization capability. In general, incremental learning initializes the model parameters of the current task with the parameter values ​​updated in the previous task, and then updates such initial parameters with the current incremental data. The present invention points out that the initial parameters should have both generalization capability and adaptability. On the one hand, the initial parameters should memorize sufficient historical information to maintain the generalization capability on unknown data; on the other hand, the initial parameters should effectively memorize recent information in incremental updates and adapt to the current environment rather than being trapped in past experience. The present invention proposes a model adapter to provide initial parameters with the required properties.

[0179] The training strategy of the present invention includes:

[0180] a) Reconstruct the incremental learning task into a meta-learning task involving two-level optimization. The present invention proposes a meta-learning optimization objective to guide the search for beneficial adaptation methods and transform the incremental learning task into a two-level optimization problem. In the lower-level optimization, the model adapter uses the incremental data adapted by the data adapter to update the prediction model; in the upper-level optimization, the prediction model makes predictions on the adapted test data, and the two adapters perform gradient updates based on the actual test performance.

[0181] b) "Offline-online" two-stage training. Before deploying the model online, the present invention organizes all offline data known in the past into multiple incremental learning tasks, and divides them into a meta-training set and a meta-validation set by time. The meta-training set is used to pre-train the two adapters, and the meta-validation set is used to implement the "early stopping" strategy. It is characterized in that the order of tasks in the training set needs to be disrupted for each round of training, and temporary copies of the two adapters are created after each round of training, and their performance is evaluated on the meta-validation set. The original adapter parameters do not participate in the update in the meta-validation set. After the offline pre-training stage is completed, the model and the adapter are deployed online, and periodic incremental updates are implemented.

[0182] Those skilled in the art know that, in addition to implementing the system, device and its various modules provided by the present invention in a purely computer-readable program code, it is entirely possible to implement the same program in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, the system, device and its various modules provided by the present invention can be considered as a hardware component, and the modules included therein for implementing various programs can also be considered as structures within the hardware component; the modules for implementing various functions can also be considered as both software programs for implementing the method and structures within the hardware component.

[0183] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A method for online updating of prediction models combining incremental learning and meta-learning, It is characterized in that include: Step S1: Based on the idea of ​​meta-learning, two meta-learners are designed, namely data adapter and model adapter. The data adapter adjusts the original data factors in the incremental data through the factor adaptation function, and adjusts the labels of the incremental data through the label adaptation function. Step S2: Using the model adapter, learn the parameter values ​​suitable for the current period based on the adjusted incremental data, update the prediction model, and deploy it online; Step S3: adjusting the original data factors of the test data through the factor adaptation function based on the data adapter; Step S4: The prediction model is used to make predictions based on the adjusted data factors in the test data. The model output value is inversely transformed by the label adaptation function and adjusted to the final label prediction value. Step S5: After the current prediction phase is completed, the prediction loss is calculated based on the label prediction value and the obtained label true value, thereby optimizing the two meta-learners.

2. The online updating method of the prediction model combining incremental learning and meta-learning according to claim 1, It is characterized in that The step S1 comprises: The vector of D factors of the original data is recorded as The corresponding label to be predicted is recorded as Each adaptation head is implemented as an affine transformation, and its transformation parameter weights are not shared with each other. The i-th factor adaptation head is defined as: g i (x)=W i x+b i in, is the transformation matrix of the i-th factor adaptation head, is the transformation offset of the i-th factor adaptation head, and the multi-head factor adaptation function G with m adaptation heads is defined as: in, represents the transformed factor vector, s i Determine the participation degree of the i-th adapter head, set m paradigm vectors to indicate which adapter head is more suitable for this transformation, and the i-th paradigm is recorded as First calculate x and p i The cosine similarity of Then use softmax normalization Get i , the expression is: Among them, τ is a positive hyperparameter used to control the temperature of softmax; The multi-head label adaptation function contains m label adaptation heads, and the i-th label adaptation head is defined as: h i (y)=γ i y+β i in, is the scaling variable of the i-th tag adaptation header, is the offset of the i-th label adapter head. The multi-head label adaptation function H with m adapter heads is defined as: in, Represents the transformed label; Let ψ be the parameter set of the data adapter, that is The adapted incremental data and test data are expressed as: Among them, only after the forecast ends on the day, Therefore, in the prediction process of the test set, the label of the test set cannot be adjusted, but the label prediction value of the model can be adjusted by the inverse transformation of the label adaptation function. The inverse transformation of the tag adaptation function H -1 Defined as: in, When the data is a time series, the same adaptation parameters are applied to each time step, denoted by x = {x 1 ,x 2 ,…,x L } is a time series of length L, each element represents the d stock factors at the jth time step, and the factor adaptation function transforms the factors of each time step respectively, that is, The participation degree of the i-th factor adapter head at the j-th time step is denoted as s ij , calculated as p normalized by softmax i With x j In label adaptation, the concatenated x is mapped to a low-dimensional vector through a linear layer. The participation degree of the i-th label adaptation head is calculated by the additional paradigm and the low-dimensional vector, and its paradigm dimension is consistent with the low-dimensional vector.

3. The online updating method of the prediction model combining incremental learning and meta-learning according to claim 2, It is characterized in that The step S2 comprises: Let F be the prediction model. In the kth incremental learning task, the model adapter first uses the parameter φ k-1 Initialize the parameter values ​​of the prediction model, and then fine-tune F(·;φ) on the adapted incremental data k-1 ), where the mean square error MSE is used to calculate the training loss The fine-tuned parameter values ​​are defined as: Among them, η θ is the prediction model learning rate; represents the gradient of the parameter φ.

4. The online updating method of the prediction model combining incremental learning and meta-learning according to claim 3, It is characterized in that The step S5 comprises: The incrementally updated model F(·; θ k ) is deployed online, and the adapted test data set Calculate the mean square error between the predicted value and the true value In addition, to avoid the adapted labels being too abnormal and difficult to learn, The mean square error between the adapted value and the true value is calculated as the regularization term Final test error Defined as: Among them, the hyperparameter α controls the regularization strength; Finally, the model adapter parameters φ are updated by a single step of gradient descent k-1 and the data adapter parameter ψ k-1 : Among them, η φ and η ψ are the learning rates of the model adapter and data adapter respectively.

5. The online updating method of the prediction model combining incremental learning and meta-learning according to claim 4, It is characterized in that The training algorithm uses an offline-online two-stage training framework, specifically: Input: Meta-training set Meta-validation set Meta test set Output: trained adapter parameters φ and ψ, online prediction results; 1) Initialize φ and ψ; 2) Repeat the following steps ae until the performance degradation meets the preset conditions: a、 b. φ, ψ, prediction results of meta-training set ← single round incremental learning c. φ′, ψ′←create a copy of φ, ψ; d. φ′, ψ′, meta-validation set prediction results ← single-round incremental learning e. Evaluate the prediction results of the meta-validation set; 3)φ,ψ, meta-validation set prediction results ∪ online prediction results ← single-round incremental learning 4) Return the online prediction results of φ and ψ.

6. An online update system for prediction models combining incremental learning and meta-learning, It is characterized in that include: Module M1: Based on the idea of ​​meta-learning, two meta-learners are designed, namely data adapter and model adapter. The data adapter adjusts the original data factors in the incremental data through the factor adaptation function, and adjusts the labels of the incremental data through the label adaptation function. Module M2: Use the model adapter to learn the parameter values ​​suitable for the current period based on the adjusted incremental data, update the prediction model, and deploy it online; Module M3: adjusting the original data factors of the test data through the factor adaptation function based on the data adapter; Module M4: The prediction model is used to make predictions based on the adjusted data factors in the test data. The model output value is inversely transformed by the label adaptation function and adjusted to the final label prediction value. Module M5: After the prediction phase, the prediction loss is calculated based on the label prediction value and the obtained label true value to optimize the two meta-learners.

7. The online updating system for prediction model combining incremental learning and meta-learning according to claim 6, It is characterized in that The module M1 comprises: The vector of D factors of the original data is recorded as The corresponding label to be predicted is recorded as Each adaptation head is implemented as an affine transformation, and its transformation parameter weights are not shared with each other. The i-th factor adaptation head is defined as: g i (x)=W i x+b i in, is the transformation matrix of the i-th factor adaptation head, is the transformation offset of the i-th factor adaptation head, and the multi-head factor adaptation function G with m adaptation heads is defined as: in, represents the transformed factor vector, s i Determine the participation degree of the i-th adapter head, set m paradigm vectors to indicate which adapter head is more suitable for this transformation, and the i-th paradigm is recorded as First calculate x and p i The cosine similarity of Then use softmax normalization Get i , the expression is: Among them, τ is a positive hyperparameter used to control the temperature of softmax; The multi-head label adaptation function contains m label adaptation heads, and the i-th label adaptation head is defined as: h i (y)=γ i y+β i in, is the scaling variable of the i-th tag adaptation header, is the offset of the i-th label adapter head. The multi-head label adaptation function H with m adapter heads is defined as: in, Represents the transformed label; Let ψ be the parameter set of the data adapter, that is The adapted incremental data and test data are expressed as: Among them, only after the forecast ends on the day, Therefore, in the prediction process of the test set, the label of the test set cannot be adjusted, but the label prediction value of the model can be adjusted by the inverse transformation of the label adaptation function. The inverse transformation of the tag adaptation function H -1 Defined as: in, When the data is a time series, the same adaptation parameters are applied to each time step, denoted by x = {x 1 ,x 2 ,…,x L } is a time series of length L, each element represents the d stock factors at the jth time step, and the factor adaptation function transforms the factors of each time step respectively, that is, The participation degree of the i-th factor adapter head at the j-th time step is denoted as s ij , calculated as p normalized by softmax i With x j In label adaptation, the concatenated x is mapped to a low-dimensional vector through a linear layer. The participation degree of the i-th label adaptation head is calculated by the additional paradigm and the low-dimensional vector, and its paradigm dimension is consistent with the low-dimensional vector.

8. The online updating system for prediction models combining incremental learning and meta-learning according to claim 7, It is characterized in that The module M2 comprises: Let F be the prediction model. In the kth incremental learning task, the model adapter first uses the parameter φ k-1 Initialize the parameter values ​​of the prediction model, and then fine-tune F(·;φ) on the adapted incremental data k-1 ), where the mean square error MSE is used to calculate the training loss The fine-tuned parameter values ​​are defined as: Among them, η θ is the prediction model learning rate; represents the gradient of the parameter φ.

9. The online updating system for prediction model combining incremental learning and meta-learning according to claim 8, It is characterized in that The module M5 comprises: The incrementally updated model F(·; θ k ) is deployed online, and the adapted test data set Calculate the mean square error between the predicted value and the true value In addition, to avoid the adapted labels being too abnormal and difficult to learn, The mean square error between the adapted value and the true value is calculated as the regularization term Final test error Defined as: Among them, the hyperparameter α controls the regularization strength; Finally, the model adapter parameters φ are updated by a single step of gradient descent k-1 and the data adapter parameter ψ k-1 : Among them, η φ and η ψ are the learning rates of the model adapter and data adapter respectively.

10. The online updating system for prediction model combining incremental learning and meta-learning according to claim 9, It is characterized in that The training algorithm uses an offline-online two-stage training framework, specifically: Input: Meta-training set Meta-validation set Meta test set Output: trained adapter parameters φ and ψ, online prediction results; 1) Initialize φ and ψ; 2) Repeatedly trigger the following modules ae until the performance degradation meets the preset conditions: Module a, Module b, φ, ψ, meta-training set prediction results ← single round incremental learning Module c, φ ′ ,ψ v ←Create φ,ψ copies; Module d, φ ′ ,ψ ′ , meta-validation set prediction results ← single round incremental learning Module e, evaluate the prediction results of the meta-validation set; 3)φ,ψ, meta-validation set prediction results ∪ online prediction results ← single-round incremental learning 4) Return the online prediction results of φ and ψ.