Giter Site home page Giter Site logo

deepbsde's Introduction

Deep BSDE Solver in TensorFlow (2.0)

Training

python main.py --config_path=configs/hjb_lq_d100.json

Command-line flags:

  • config_path: Config path corresponding to the partial differential equation (PDE) to solve. There are seven PDEs implemented so far. See Problems section below.
  • exp_name: Name of numerical experiment, prefix of logging and output.
  • log_dir: Directory to write logging and output array.

Problems

equation.py and config.py now support the following problems:

Three examples in ref [1]:

  • HJBLQ: Hamilton-Jacobi-Bellman (HJB) equation.
  • AllenCahn: Allen-Cahn equation with a cubic nonlinearity.
  • PricingDefaultRisk: Nonlinear Black-Scholes equation with default risk in consideration.

Four examples in ref [2]:

  • PricingDiffRate: Nonlinear Black-Scholes equation for the pricing of European financial derivatives with different interest rates for borrowing and lending.
  • BurgersType: Multidimensional Burgers-type PDEs with explicit solution.
  • QuadraticGradient: An example PDE with quadratically growing derivatives and an explicit solution.
  • ReactionDiffusion: Time-dependent reaction-diffusion-type example PDE with oscillating explicit solutions.

New problems can be added very easily. Inherit the class equation in equation.py and define the new problem. Note that the generator function and terminal function should be TensorFlow operations while the sample function can be python operation. A proper config is needed as well.

Dependencies

Note: an old version of the deep BSDE solver compatiable with TensorFlow 1.12 and Python 2 can be found in the commit 9d4e332.

Reference

[1] Han, J., Jentzen, A., and E, W. Overcoming the curse of dimensionality: Solving high-dimensional partial differential equations using deep learning, Proceedings of the National Academy of Sciences, 115(34), 8505-8510 (2018). [journal] [arXiv]
[2] E, W., Han, J., and Jentzen, A. Deep learning-based numerical methods for high-dimensional parabolic partial differential equations and backward stochastic differential equations, Communications in Mathematics and Statistics, 5, 349โ€“380 (2017). [journal] [arXiv]

deepbsde's People

Contributors

frankhan91 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deepbsde's Issues

monte carlo comparison

Hi,
Thank you very much for the library.
I am comparing the results with different lambda with the ones in the paper, but they don't seem to match. For example with lambda = 40, I get Y0 of 6.2449e-01, which is different from that in the paper. I am simply changing lambda here to 40 with everything else the same . [line 35- equation.py]. Is this the correct approach?
self.lambd = 40.0
Also is it possible to get the corresponding code for monte carlo simulation for HJBLQ?

Thanks in advance.

Issue with Equation.sample method when in 1 dimension

Hi Frank, awesome paper and very clean code, thank you for sharing it publicly!

There seems to be an issue with the sample method of the Equation class when considering 1-dimensional equations (eg. line 39 of Equation.py). Unfortunately, scipy's multivariate normal seems to remove the second dimension when self.dim=1, resulting in an indexing error when doing x_sample[:, :, 0] as x_sample will be of shape (num_sample, self.num_time_interval). I am running scipy 1.6.2.

Question about boundary condition

Hi, I was going through your paper on Arxiv and trying out the solver. It's a great work.
I was wondering how do you deal with boundary conditions in PDE as there's only initial(terminal) condition s specified in the solver.
Thanks a lot.

I just want to make sure it is a typo

Hi, I am reading your paper, it is very interesting for me!

Anyway, I have one question in your python script.

for i in xrange(self._num_time_interval):

is it wrong "for i in range(self._num_time_interval):" instaed of "for i in xrange(self._num_time_interval):"

Thanks!

An issue inside HJBLQ class

Hello Prof. Han,

I read your DeepBSDE paper with great interest. I was focusing on understanding especially the LQGC example. I enjoyed studying your paper and learned a lot from it. Thank you for making such a nice contribution and for writing the paper so clearly.

I also appreciate the fact that you provided your code. It is so helpful! I just wanted to double-check something with you about the code in the equation.py file. Inside HJB class, I understand that the f function for that case should be -\lambda*||\nabla u||^2. So inside the code, you have written -self.lambd * tf.reduce_sum(tf.square(z), 1, keepdims=True) where z is used to denote \nabla u.

However, inside solver.py and also in the paper you use z to denote \sigma^T *\nabla u. It seems that z is used to denote both \nabla u and \sigma^T *\nabla u in that case. Is this accurate? If so, to resolve this issue, should we multiply the expression inside f_tf for HJBLQ class by 0.5 and write it as -self.lambd * tf.reduce_sum(tf.square(z), 1, keepdims=True)*0.5?

I just wanted to double-check if I am confused or there may be a typo in the code. Would you mind letting me know? Thank you very much!

Minor issue in config.py related to AllenCahn equation

I read your DeepBSDE paper on arXiv and am now playing around with your DeepBSDE solver. Great work, and a great idea.

Trying to run the AllenCahn solver out of the box, I noticed that lr_values and lr_boundaries don't match, so you get an error of the form

ValueError: The length of boundaries should be 1 less than the length of values

Just thought I'd post that here in case future users encounter the same problem.

Thanks!

Question about the solver.py

Hi, Mr. Han! In the file, solver.py, I wonder why subnets are denoted by z = self.subnet[t](x[:, :, t + 1], training) / self.bsde.dim
rather than z = self.subnet[t](x[:, :, t + 1], training) (the code is in the NonsharedModel class).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.