Physical information guidance-based BS equation numerical solution method and calculation device thereof
Through a multi-directional gating cyclic attention network guided by physical information, the problems of timing correlation and grid dependence of BS equations are solved, and the precise numerical solution and generalization ability of BS equations are improved.
Patent Information
- Application Number
- CN202411239762.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-12-27
AI Technical Summary
The prior art is difficult to effectively capture the timing correlation characteristics and sequence hidden state characteristics of BS equations, and traditional numerical methods rely on grid scales, and there are truncation errors and insufficient generalization capabilities.
Using a multi-directional gating cyclic attention network based on physical information guidance, the timing sample set is generated through Latin Hypercube hierarchical random sampling, the bidirectional gating cyclic unit extracts pre-order and post-order information, and the one-directional gating cyclic unit performs sequential modeling. , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
The timing correlation complexity and grid dependence problems of BS equations were overcome, and the precise numerical solution was achieved in the absence of real solutions was achieved, which improved the capture and generalization capabilities of BS equations.
Smart Images

Figure CN119202476A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of physical information machine learning, and in particular to a BS equation numerical method and device based on a multi-directional gated recurrent attention network guided by physical information. Background Art
[0002] In financial market research, investment portfolio is an important means of risk diversification and is crucial to the evaluation of financial assets. Based on the portfolio selection theory, Black and Scholes pioneered the Black-Scholes model of European options, referred to as the BS model, and won the 1997 Nobel Prize in Economics for this. Given the widespread application of the BS model in contemporary commodity futures and portfolio pricing, studying and solving the BS equation can have a significant economic impact on option pricing.
[0003] In general, there are two main methods for solving BS equations: analytical method and numerical method. Among them, due to the complex time series correlation and random process characteristics of BS equations, its analytical solution form is often difficult to obtain, especially in the generalized form of the equation. Even if the analytical solution exists, it is difficult to simplify it into elementary functions or series forms using traditional mathematical tools. Therefore, it is very necessary to study efficient and accurate numerical methods to solve BS equations.
[0004] Traditional numerical methods for solving BS equations include finite difference method, high-order compact finite difference method, B-spline interpolation method, etc. The general idea is to use the discrete solution region to transform the derivatives and constraints of BS equations into the difference quotient form of discrete points, and obtain a linear equation system whose solution is a numerical solution of discrete points. However, these traditional numerical methods have significant defects, including dependence on grid scale division, truncation error outside grid points, and curse of dimensionality in high-dimensional problems. Therefore, it is crucial to explore a new non-discretization method. With the rapid development of computer science and information technology, deep neural networks based on universal approximation theorems have become the focus of research and application. Neural networks have made remarkable achievements in image recognition, data mining, natural language processing, and differential equation solving. Nevertheless, the network architecture based on multi-layer perceptron MLP performs poorly in capturing the features of temporal input sequences (such as BS equations) due to the lack of self-feedback mechanism. In addition, the traditional recurrent neural network RNN is easily affected by the causal law of subsequent features when capturing features between sequences and is difficult to generalize. At the same time, there is also a lack of effective weight allocation strategy for the hidden state features of the sequence. Important features should be given corresponding weights to enhance their contribution to the output. Therefore, how to design an efficient network architecture that can fully capture the temporal correlation characteristics of the BS equation without violating the law of causality, and reasonably assign positively correlated weights to the hidden state features of the sequence, and how to effectively integrate the physical information of the BS equation into the learning process of the neural network are technical problems that need to be solved urgently. Summary of the invention
[0005] In order to overcome the above-mentioned technical defects, an embodiment of the present invention provides a BS equation numerical method and a computing device based on physical information guidance, which can overcome the time-related complexity of the BS equation itself, while solving the limitations of traditional numerical methods in grid dependence and generalization ability, and realize accurate numerical solutions to BS equations of various complexities in the absence of true solutions.
[0006] In a first aspect, an embodiment of the present invention provides a BS equation numerical method based on physical information guidance, which is applicable to a deep learning model constructed by a multi-directional gated recurrent attention network, and includes the following steps:
[0007] S1: Using the Latin Hypercube stratified random sampling method, we independently generate time series sample sets that satisfy the operator conditions, initialization conditions, and boundary conditions of the BS equation within their respective defined domains, and use the three time series sample sets as the training sets of the model;
[0008] S2: extract the correlation features between the pre-order and post-order information of the input sequence through the bidirectional gated recurrent unit module to obtain a hidden state output sequence containing bidirectional feature information;
[0009] S3: Sequentially model the hidden state output sequence in S2 by connecting unidirectional gated recurrent unit modules in series to obtain the hidden state sequence and the corresponding output sequence under the sequential structure;
[0010] S4: The dynamic weight of the hidden state sequence in S3 relative to its output sequence is dynamically calculated by integrating the attention mechanism to obtain the weighted context feature sequence;
[0011] S5: Map the weighted context sequence to the final output sequence through a multi-layer perceptron to complete the forward propagation calculation phase of the model;
[0012] S6: Calculate the two-norm residuals between the output sequence generated by the forward propagation calculation stage corresponding to S2 to S5 and the operator conditions, boundary conditions and initial conditions in the BS equation, and integrate these residuals into the quadratic penalty term of the model loss function;
[0013] S7: Optimize the loss function through the ADAM algorithm based on adaptive learning rate and gradient correction to complete the back propagation calculation stage of the model;
[0014] S8: Iterate S2 to S7 to update the model parameters, and calculate the mean square error (MSE) of the current output of the model on the validation set. Based on the MSE, determine whether the model has converged on the validation set. If so, end the training. Otherwise, repeat S8 to finally obtain a sequence of numerical solutions that meet the constraints of the BS equation.
[0015] Specifically, optionally, in an implementation of the first aspect, in S1, the generated time series sample sets are respectively:
[0016]
[0017] in represents the sequence in the internal domain of the BS equation, represents a sequence of boundary domains, represents the initialization sequence at time t=0, which respectively contains n randomly sampled time series sample sequences:
[0018] Specifically, optionally, in an implementation of the first aspect, in S2, a specific calculation formula for extracting the correlation feature of the pre-order and post-order information of the input sequence is as follows:
[0019]
[0020]
[0021] in, and Respectively represent the extracted pre-order and post-order feature sequences; represents the update gate, represents the candidate hidden state sequence, the symbol ⊙ represents the point-by-point multiplication operation of the element, and the symbol *∈{f, b} represents the pre-order and post-order; the update gate in the pre-order and post-order information is calculated in the same way as the candidate hidden state sequence. Taking the pre-order as an example, the specific calculation formula is as follows:
[0022]
[0023] in, represents the forget gate, σ represents the sigmoid function; represents the weight parameter, Represents bias parameters, which are all learnable parameters of the model.
[0024] The hidden state output sequence containing bidirectional feature information is recorded as It is calculated as follows:
[0025] Among them, the symbol Represents the concatenation operation of vectors
[0026] Specifically, in an implementation of the first aspect, in S3, the hidden state sequence and the corresponding output sequence under the sequential structure are respectively recorded as h n and H t , and the calculation formulas are as follows:
[0027] H t =Z t ☉H t-1 +(1-Z t )☉h n
[0028]
[0029] Among them, W xh , W hh represents the weight parameter, b h represents the bias parameters, which are learnable parameters of the model; update gate Z t and the forget gate R t The calculation of is consistent with that in S2.
[0030] Specifically, in an implementation of the first aspect, in S4, the calculation formula of the dynamic weight is as follows:
[0031]
[0032] Among them, k and v represent the key-value pair sequence, and q represents the query sequence. They are the hidden state sequence in S4 and its corresponding output sequence, that is, q = h n , k=Ht , v = H t ; a(q, k) represents the attention score of q compared to k. W qk , W v Represents the learnable weight parameters of the model;
[0033] The calculation formula of the dynamic weighting is as follows:
[0034] C t (q, v) = E z~p(z|q,k) [v z ] = α(q, k)·v;
[0035] Among them, C t Represents the context feature sequence after weighting by the attention module.
[0036] Specifically, in an implementation of the first aspect, in S5, the specific calculation formula of the multi-layer perceptron MLP mapping is as follows:
[0037]
[0038] Among them, C t represents the context feature sequence after weighting by the attention module, O t Represents the final output sequence after MLP mapping, symbol It represents a composite operation, and the activation function of the nonlinear mapping is GELU.
[0039] Specifically, in an implementation of the first aspect, in S6, the two-norm residual between the operator condition in the BS equation and the output sequence in S5 is recorded as L1; the two-norm residual between the boundary condition in the BS equation and the output sequence in S5 is recorded as L2; the two-norm residual between the initialization condition in the BS equation and the output sequence in S5 is recorded as L3, and the calculation formulas thereof are as follows:
[0040]
[0041]
[0042]
[0043] Among them, Λ θ represents the output sequence of the model, that is, the forward propagation process in S2-S5, which converts different input sequences X t Mapped to the corresponding output sequence O t ;
[0044] The operator representing the BS equation is:
[0045]
[0046] Among them, the partial derivative of each variable is completed by the automatic differentiation algorithm;
[0047] The above-mentioned two-norm residual is used as a quadratic penalty term to construct a quadratic penalty function as the loss function of the model to be optimized, and its expression is: L(θ; x, t) = L1+L2+L3; where θ is the set of parameters that can be learned by the model.
[0048] Specifically, in an implementation of the first aspect, in S7, all model parameters in the loss function are calculated using a back propagation algorithm to calculate gradients; an ADAM algorithm with an adaptive learning rate is used to correct the gradients, and the model parameters are updated in a negative gradient direction, that is:
[0049] Specifically, in an implementation of the first aspect, in S8, the mean square error MSE of the output of the current model on the validation set is:
[0050]
[0051] Among them, Λ θ represents the output sequence of the current model, u represents the true solution corresponding to the validation set sample, and u only participates in the validation phase and does not participate in the model training to update the parameters. ε represents MSE, and when ε reaches the allowable error range, the model training ends.
[0052] In the second aspect, an embodiment of the present invention provides a computing device for numerically solving BS equations guided by physical information, characterized in that a deep learning model constructed based on a multi-directional gated recurrent attention network is deployed in the computing device to execute the steps of the method described in any one of the first aspect and its implementation methods.
[0053] In a third aspect, a computer-readable storage medium is provided in an embodiment of the present application, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described in any one of the first aspect and its implementation methods is implemented.
[0054] In a fourth aspect, a computer program product is provided in an embodiment of the present application, including a computer program, which, when executed by a processor, implements the method described in any one of the first aspect and its implementation methods.
[0055] The embodiments of the present invention adopt the above technical solution to achieve the following technical effects:
[0056] The technical solution in the embodiment of the present invention can overcome the time-series correlation complexity of the BS equation itself, while solving the limitations of traditional numerical methods in grid dependence and generalization ability, and realize accurate numerical solutions to BS equations of various complexities in the absence of true solutions. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0058] Figure 1 A flow chart of a method for numerically solving BS equations based on physical information guidance in an embodiment of the present invention;
[0059] Figure 2 The comparison of the spatial evolution of the predicted solution and the true solution of the model at four key time points in the embodiment of the present invention;
[0060] Figure 3 In the embodiment of the present invention, the evolution comparison between the predicted solution and the true solution of the model in the entire spatiotemporal domain is presented in the form of a heat map;
[0061] Figure 4 The loss function of the model and the convergence of its prediction error on the validation set in the embodiment of the present invention;
[0062] Figure 5 The figure is a schematic diagram of the hardware structure of a computing device for numerically solving BS equations guided by physical information in an embodiment of the present invention. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0064] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present invention are only for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0065] In the description of the present invention, it should be understood that the numerical labels before the steps do not identify the order of executing the steps, but are only used to facilitate the description of the present invention and distinguish each step, and therefore cannot be understood as a limitation of the present invention.
[0066] For solving complex partial differential equations (PDEs) such as the BS equation, traditional numerical methods usually rely on the central difference method to approximate the differential terms and solve their numerical solutions through single-step iterations. These methods are susceptible to truncation errors of the difference approximation and are limited by the grid resolution and the shape of the feasible domain. In addition, due to the lack of parameter learning mechanisms, these methods usually require additional interpolation techniques when processing data outside the grid points. In contrast, physical information neural networks (PINNs), as a gridless method based on parameter learning, can circumvent the problems of truncation errors and grid selection to a certain extent. However, PINNs often do not fully consider the feature extraction of PDEs with strong temporal correlation, such as the BS equation, when designing the neural network architecture. At the same time, PINNs also fail to effectively evaluate the contribution of different hidden features to the output, making it difficult to assign appropriate weights to important features.
[0067] A type of BS equation solved by the present invention can be expressed as:
[0068]
[0069] Where V represents the option price to be solved, which is related to the asset price S and the remaining time τ. r, d and σ represent the risk-free interest rate, dividend and asset price volatility respectively. When these parameters are constants, the BS equation degenerates into its classical form, otherwise it is expressed as its generalized form. T represents the expiration time. We use the transformation S = exp(x), τ = Tt to transform the BS equation into the following non-degenerate time-forward form:
[0070]
[0071] This equation represents the operator equation of the BS equation, which is mathematically equivalent to considering the change of option price as its heat diffusion process in logarithmic space. The boundary constraints and initialization constraints of the BS equation can be expressed as:
[0072]
[0073] Among them, x l and x r Represent the left boundary set and the right boundary set respectively. Boundary function It can represent both Dirichlet boundary and Neumann boundary. These operator equations, boundary constraints and initialization constraints will be regarded as prior knowledge, representing known physical information.
[0074] In the technical solution of the present invention, a multi-directional gated recurrent unit module is designed, including bidirectional and unidirectional structures, to comprehensively capture the temporal correlation characteristics between input sequences. At the same time, an attention mechanism is introduced to dynamically calculate the weights of hidden feature sequences, effectively assigning positively correlated weights to key features, thereby enhancing the characterization ability of context feature sequences. In the training stage, the present invention integrates the constraints of the BS equation (including operators, boundaries, and initial conditions) into physical prior information, constructs a quadratic penalty function based on the two-norm residual to form the loss function of the model, and guides the optimization direction of the model.
[0075] First, the numerical solution method of the BS equation based on physical information guidance in the embodiment of the present invention is described. Figure 1 As shown, including:
[0076] S1: Random sampling generates a sample sequence within the definition domain of each constraint condition of the BS equation.
[0077] Specifically, the constraints of the BS equation include the operator conditions, initialization conditions and boundary conditions of the BS equation. The Latin Hypercube stratified random sampling method is used to independently generate time series sample sets that meet the operator conditions, initialization conditions and boundary conditions of the BS equation in their respective defined domains, and the three time series sample sets are used as training sets of the model.
[0078] Specifically, in one implementation, in S1, the generated time series sample sets are:
[0079]
[0080] in represents the sequence in the internal domain of the BS equation, represents a sequence of boundary domains, represents the initialization sequence at time t=0, which respectively contains n randomly sampled time series sample sequences:
[0081] S2: A bidirectional gated recurrent unit module is used to extract bidirectional feature information between input sequences.
[0082] Specifically, the correlation features between the pre-order and post-order information of the input sequence are extracted through the bidirectional gated recurrent unit module to obtain a hidden state output sequence containing bidirectional feature information.
[0083] Specifically, in one embodiment, S2 specifically includes:
[0084] (1) First, the bidirectional gated recurrent unit module is used to extract the correlation features of the pre-order and post-order information of the input sequence. The specific calculation is as follows:
[0085]
[0086] in and Respectively represent the extracted pre-order and post-order feature sequences; represents the update gate, represents the candidate hidden state sequence, the symbol ⊙ represents the point-by-point multiplication operation of the element, and the symbol *∈{f, b} represents the pre-order and post-order. Taking the pre-order as an example, the specific calculation is as follows:
[0087]
[0088] in represents the forget gate, σ represents the sigmoid function; represents the weight parameter, Denotes bias parameters, which are learnable parameters of the model.
[0089] (2) Further merge the feature sequences of the pre-order and post-order information to obtain the following hidden state output sequence containing bidirectional information:
[0090]
[0091] Among them, the symbol Represents a vector concatenation operation.
[0092] S3: A unidirectional gated recurrent unit module is used to sequentially model the bidirectional feature sequence.
[0093] Specifically, the hidden state output sequence containing the bidirectional feature information is sequentially modeled through a series of unidirectional gated recurrent unit modules to obtain a hidden state sequence and a corresponding output sequence under a sequential structure.
[0094] Specifically, in one embodiment, the above S3 is specifically:
[0095] By connecting a unidirectional gated recurrent unit module in series, Sequential modeling is performed to reduce the interference of subsequent information on model inference, so that the model inference does not violate the causal law as much as possible. The hidden state sequence and the corresponding output sequence under the sequential structure are respectively denoted as h n and H t , and the calculation formulas are as follows
[0096] H t =Z t ☉H t-1 +(1-Z t )☉h n
[0097]
[0098] Among them, W xh , W hh represents the weight parameter, b h represents the bias parameters, which are learnable parameters of the model; update gate Z t and the forget gate R t The calculation process is the same as that in S2.
[0099] S4: Fusion attention mechanism calculates the dynamic weights of feature sequences.
[0100] Specifically, the dynamic weights of the hidden state sequence in S3 relative to its output sequence are dynamically calculated by integrating the attention mechanism to obtain the weighted context feature sequence.
[0101] Specifically, in one embodiment, the above S4 is specifically:
[0102] (1) Dynamic calculation of h n Compared to H t The attention score is calculated as follows:
[0103]
[0104] Among them, k and v represent the key-value pair sequence, and q represents the query sequence. They are the hidden state sequence in S4 and its corresponding output sequence, that is, q = h n , k=H t , v = H t ; a(q, k) represents the attention score of q compared to k. W qk , W v Represents the learnable weight parameters of the model;
[0105] (2) H t Dynamic weighted calculation is performed to make the model pay more attention to the features with greater contribution. The calculation is as follows:
[0106] C t (q, v) = Ez~p(z|q,k) [v z ] = α(q, k)·v
[0107] Among them, C t Represents the context feature sequence after weighting by the attention module.
[0108] S5: Use a multi-layer perceptron to map the output sequence.
[0109] Specifically, the weighted context sequence is mapped to the final output sequence through the multi-layer perceptron MLP to complete the forward propagation calculation stage of the model.
[0110] Specifically, in one implementation, S5 is specifically:
[0111] Through MLP, C t Mapped to output sequence O t , and discard some neurons by adding the Dropout operation during training to prevent overfitting. The calculation is as follows:
[0112]
[0113] Among them, the symbol It represents a composite operation, and the activation function of the nonlinear mapping is GELU.
[0114] S6: Calculate the constraints of the BS equation and the two-norm residual of the output sequence.
[0115] Specifically, the two-norm residuals between the output sequence generated by the forward propagation calculation stage corresponding to S2 to S5 and the operator conditions, boundary conditions and initial conditions in the BS equation are calculated respectively, and these residuals are integrated into the quadratic penalty term of the model loss function
[0116] Specifically, in one implementation, S6 is specifically:
[0117] (1) The two-norm residuals between the output sequences generated by the forward propagation calculation stages corresponding to S2 to S5 and the operator conditions, boundary conditions, and initialization conditions of the BS equation are calculated respectively, which are calculated as follows:
[0118]
[0119] Among them, Λ θ represents the output sequence of the model, that is, the forward propagation process in S2-S5, which converts different input sequences X t Mapped to the corresponding output sequence O t . The operator representing the BS equation is:
[0120]
[0121] The partial derivative of each variable is completed by the automatic differentiation algorithm.
[0122] (2) The above-mentioned two-norm residual is used as a penalty term, and a quadratic penalty function is constructed as the loss function of the model to be optimized, which is expressed as:
[0123] L(θ; x, t) = L1 + L2 + L3
[0124] Among them, θ is the set of parameters that can be learned by the model.
[0125] S7: The above residual is used as a penalty term to construct a quadratic penalty function optimization, and the ADAM algorithm is used to optimize the penalty function and update the model parameters.
[0126] Specifically, the loss function is optimized by the ADAM algorithm based on adaptive learning rate and gradient correction to complete the back propagation calculation phase of the model.
[0127] Specifically, in one embodiment, S7 specifically includes:
[0128] (1) All model parameters in the loss function are calculated using the back-propagation algorithm to calculate gradients.
[0129] (2) The ADAM algorithm with adaptive learning rate is used to correct the gradient and update the model parameters in the negative gradient direction, that is:
[0130] S8: Evaluate the validation set error and obtain the data solution sequence of the target BS equation.
[0131] Specifically, iterate S2 to S7 to update the model parameters, calculate the mean square error (MSE) of the current output of the model on the validation set, and judge whether the model converges on the validation set based on the mean square error (MSE). If so, terminate the training, otherwise repeat S8 to finally obtain a sequence of numerical solutions that meet the constraints of the BS equation.
[0132] Specifically, in one embodiment, S8 obtains the updated model through a forward propagation process and a back propagation process of a training batch, and calculates the MSE of the current model on the validation set, that is:
[0133]
[0134] Among them, Λ θ represents the output sequence of the current model, u represents the true solution corresponding to the validation set sample, and u only participates in the validation phase and does not participate in the model training to update the parameters. ε represents MSE, and when ε reaches the allowable error range, the model training ends.
[0135] In the technical solution of the present invention, the neural network structure of PINNs is improved, and the ability to capture the temporal correlation features of the input sequence of the BS equation is significantly improved. By integrating the attention mechanism, a context feature sequence with richer representation capabilities is generated, which effectively solves the shortcomings of PINNs in sequence feature extraction and feature weight allocation. In solving generalized BS equations of different complexities, the present invention can efficiently and accurately solve the numerical solution of the BS equation, and is applicable to the boundary conditions of various BS equations, such as Dirichlet and Neumann types.
[0136] Secondly, the technical solution and its effect of the present invention are verified in combination with specific experimental cases:
[0137] The following is an experimental description of the practicality of the calculation and numerical results of the present invention based on the specific implementation records:
[0138] 1. Experimental use cases
[0139] Take the following generalized BS equation as an experimental case:
[0140] u t =γ1u xx +γ2u x -γ3u+γ4, (x, t)∈(-2, 2)×(0, 1)
[0141] γ1=0.08(2+(1-t)sin(exp(x))) 2
[0142] γ2=0.06(1+t exp(-exp(x)))-0.02exp(-t-exp(x))-0.08(2+(1-t)sin(exp(x))) 2
[0143] γ3=0.06(1+t exp(-exp(x)))
[0144] γ4=0.02exp(x-exp(x)-2t)-exp(xt)
[0145] The BS equation has been transformed into a non-degenerate time-forward form, and its boundary constraints and initialization constraints are as follows:
[0146] u(-2, t) = exp(-2-t)
[0147] u(2,t)=exp(2-t),t∈(0,1)
[0148] u(x,0)=exp(x),x∈(-2,2)
[0149] Where u represents the unknown function to be solved.
[0150] 2. Experimental content
[0151] In the experimental part, we compared and analyzed the spatial evolution of the numerical solution predicted by the proposed method and the true solution at multiple time points, as well as the evolution in the entire spatiotemporal domain. At the same time, we tested the convergence of the loss function during model training and its performance on the validation set. In addition, we also evaluated the difference in numerical accuracy between the proposed method and other methods.
[0152] Figure 2 The numerical solution predicted by the present invention is compared with the spatial evolution of the actual solution at four different time snapshots. On a microscopic time scale, the model shows a high degree of approximation to the spatial evolution of the real solution, and its fitting process is smooth and continuously differentiable, without any first or second type of discontinuity points.
[0153] Figure 3 The heat map shows the temporal and spatial evolution comparison between the predicted numerical solution and the actual solution in the entire BS equation in the time and space domain. The heat map clearly shows the model's accurate prediction of the BS equation derivative price in the logarithmic space at different times in the entire macroscopic time and space domain. Its evolution trend in the time and space domain is highly consistent with the actual solution, and the error volatility is extremely small.
[0154] Figure 4 The convergence of the loss function during training and the change of MSE on the validation set are depicted. Figure 4 The results further confirmed that the proposed model can stably converge to the local optimal solution without being accompanied by violent oscillations, and obtain an accurate numerical solution within the allowable error range on the validation set.
[0155] Figure 2 and Figure 3 The accuracy and generalization ability of the present invention in solving BS equations are demonstrated. Figure 4 This further proves the effectiveness and applicability of the method of the present invention in actual solutions. In addition, the results compared with traditional numerical methods and existing deep learning technologies in Table 1 also prove the superiority of the present invention in improving numerical accuracy and minimizing errors.
[0156] Table 1
[0157]
[0158] Finally, the computing device for numerically solving the BS equation based on physical information guidance in the embodiment of the present application is described. Figure 5Schematic diagram of its hardware structure is shown in FIG. In some embodiments, the computing device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle-mounted terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computing device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Figure 5 As shown, the computing device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them:
[0159] The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10010 can be an internal storage module of the computing device 10000, such as a hard disk or memory of the computing device 10000. In other embodiments, the memory 10010 can also be an external storage device of the computing device 10000, such as a plug-in hard disk equipped on the computing device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 can also include both the internal storage module of the computing device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed in the computing device 10000, such as the program code of the BS equation numerical solution method guided by physical information, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.
[0160] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computing device 10000, such as performing control and processing related to data interaction or communication with the computing device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.
[0161] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computing device 10000 and other computing devices. For example, the network interface 10030 is used to connect the computing device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computing device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.
[0162] It should be pointed out that Figure 5 Only a computing device having components 10010 - 10030 is shown, but it should be understood that implementing all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0163] In this embodiment, the physical information-guided BS equation numerical solution method stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present invention.
[0164] A computer-readable storage medium is also provided in an embodiment of the present invention, on which a computer program is stored. When the computer program is executed by a processor, the steps of the BS equation numerical solution method based on physical information guidance in the embodiment are implemented.
[0165] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the computer-readable storage medium can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store the operating system and various application software installed on the computer device, such as the program code of the BS equation numerical solution method based on physical information guidance in the embodiment. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or are to be output.
[0166] A computer program product is also provided in an embodiment of the present invention, including a computer program, and when the computer program is executed by a processor, the method in the above embodiment is implemented.
[0167] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present invention can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, and optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present invention are not limited to any specific combination of hardware and software.
[0168] It should be noted that the above are only preferred embodiments of the present invention, and the patent protection scope of the present invention is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for numerically solving BS equations based on physical information guidance and a computing device thereof, characterized in that: The method is applicable to a deep learning model built based on a multi-directional gated recurrent attention network, and includes the following steps: S1: Using the Latin Hypercube stratified random sampling method, we independently generate time series sample sets that satisfy the operator conditions, initialization conditions, and boundary conditions of the BS equation within their respective defined domains, and use the three time series sample sets as the training sets of the model; S2: extract the correlation features between the pre-order and post-order information of the input sequence through the bidirectional gated recurrent unit module to obtain a hidden state output sequence containing bidirectional feature information; S3: Sequentially model the hidden state output sequence in S2 by connecting unidirectional gated recurrent unit modules in series to obtain the hidden state sequence and the corresponding output sequence under the sequential structure; S4: The dynamic weight of the hidden state sequence in S3 relative to its output sequence is dynamically calculated by integrating the attention mechanism to obtain the weighted context feature sequence; S5: Map the weighted context sequence to the final output sequence through a multi-layer perceptron to complete the forward propagation calculation phase of the model; S6: Calculate the two-norm residuals between the output sequence generated by the forward propagation calculation stage corresponding to S2 to S5 and the operator conditions, boundary conditions and initial conditions in the BS equation, and integrate these residuals into the quadratic penalty term of the model loss function; S7: Optimize the loss function through the ADAM algorithm based on adaptive learning rate and gradient correction to complete the back propagation calculation stage of the model; S8: Iterate S2 to S7 to update the model parameters, and calculate the mean square error (MSE) of the current output of the model on the validation set. Based on the MSE, determine whether the model has converged on the validation set. If so, end the training. Otherwise, repeat S8 to finally obtain a sequence of numerical solutions that meet the constraints of the BS equation.
2. The method according to claim 1, characterized in that In S1, the generated time series sample sets are: in represents the sequence in the internal domain of the BS equation, represents a sequence of boundary domains, represents the initialization sequence at time t=0, which respectively contains n randomly sampled time series sample sequences:
3. The method according to claim 1, characterized in that In S2, the specific calculation formula for extracting the correlation features of the pre-order and post-order information of the input sequence is as follows: in and Respectively represent the extracted pre-order and post-order feature sequences; represents the update gate, represents the candidate hidden state sequence, the symbol ⊙ represents the point-by-point multiplication operation of the element, and the symbol *∈{f, b} represents the pre-order and post-order; the update gate in the pre-order and post-order information is calculated in the same way as the candidate hidden state sequence. Taking the pre-order as an example, the specific calculation formula is as follows: in represents the forget gate, σ represents the sigmoid function; represents the weight parameter, Represents bias parameters, which are all learnable parameters of the model; The hidden state output sequence containing bidirectional feature information is recorded as It is calculated as follows: Among them, the symbol Represents a vector concatenation operation.
4. The method according to claim 1, characterized in that: In S3, the hidden state sequence and the corresponding output sequence under the sequential structure are respectively denoted as h n and H t , and the calculation formulas are as follows: H t =Z t ☉H t-1 +(1-Z t )☉h n Among them, W xh , W hh represents the weight parameter, b h represents the bias parameters, which are learnable parameters of the model; update gate Z t and the forget gate R t The calculation of is consistent with that in S2.
5. The method according to claim 1, characterized in that In S4, the calculation formula of the dynamic weight is as follows: Among them, k and v represent the key-value pair sequence, and q represents the query sequence. They are the hidden state sequence in S4 and its corresponding output sequence, that is, q = h n , k=H t , v = H t ; α(q, k) represents the attention score of q compared to k; W qk , W v Represents the learnable weight parameters of the model; The calculation formula of the dynamic weighting is as follows: C t (q,v)=E z~p(z|q,k) [v2]=α(q,k)·v; Among them, C t Represents the context feature sequence after weighting by the attention module.
6. The method according to claim 1, characterized in that In S5, the specific calculation formula of the multi-layer perceptron MLP mapping is as follows: Among them, C t represents the context feature sequence after weighting by the attention module, O t Represents the final output sequence after MLP mapping, symbol It represents a composite operation, and the activation function of the nonlinear mapping is GELU.
7. The method according to claim 1, characterized in that In S6, the two-norm residual between the operator condition in the BS equation and the output sequence in S5 is recorded as L1; the two-norm residual between the boundary condition in the BS equation and the output sequence in S5 is recorded as L2; the two-norm residual between the initialization condition in the BS equation and the output sequence in S5 is recorded as L3, and their calculation formulas are as follows: Among them, Λ θ represents the output sequence of the model, that is, the forward propagation process in S2-S5, which converts different input sequences X t Mapped to the corresponding output sequence o t ; The operator representing the BS equation is: Among them, the partial derivative of each variable is completed by the automatic differentiation algorithm; The above-mentioned two-norm residual is used as a quadratic penalty term to construct a quadratic penalty function as the loss function of the model to be optimized, and its expression is: L(θ; x, t) = L1+L2+L3; where θ is the set of parameters that can be learned by the model.
8. The method according to claim 1, characterized in that In S7, all model parameters in the loss function are calculated using the back-propagation algorithm to calculate the gradient; the ADAM algorithm with adaptive learning rate is used to correct the gradient and update the model parameters in the negative gradient direction, that is:
9. The method according to claim 1, characterized in that: In S8, the mean square error MSE of the output of the current model on the validation set is: Among them, Λ θ Represents the output sequence of the current model, u represents the true solution corresponding to the validation set sample, and u only participates in the validation phase and does not participate in the model training to update the parameters; ε represents MSE, and when ε reaches the allowable error range, the model training is terminated.
10. A computing device for numerically solving BS equations guided by physical information, characterized in that: The computing device deploys a deep learning model built based on a multi-directional gated recurrent attention network, which is used to execute the steps in the method described in any one of claims 1 to 9 above.
