-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Milstein function #615
base: develop
Are you sure you want to change the base?
Milstein function #615
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #615 +/- ##
===========================================
+ Coverage 86.65% 86.90% +0.24%
===========================================
Files 156 158 +2
Lines 13322 13568 +246
===========================================
+ Hits 11544 11791 +247
+ Misses 1778 1777 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried to do a quick review, so that you can incorporate the feedback before your presentation, but I did not review the math nor the code/tests correctness.
examples/plot_langevin_dynamics.py
Outdated
# %% | ||
# Langevin dynamics is a mathematical model used to describe the behaviour of | ||
# particles in a fluid, particularly in the context of statistical mechanic | ||
# and molecular dynamics. It’s named after Paul Langevin a French physicist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# and molecular dynamics. It’s named after Paul Langevin a French physicist. | |
# and molecular dynamics. It’s named after Paul Langevin, a French physicist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it named after him? I think the sentence is incomplete without that information.
examples/plot_langevin_dynamics.py
Outdated
# a probability distribution: a 2-d Gaussian mixture. | ||
# | ||
# Langevin dynamics enable us to sample from probability distributions from | ||
# which a non-normalised pdf is known. This is possible thanks to the use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# which a non-normalised pdf is known. This is possible thanks to the use | |
# which a non-normalised pdf is known. This is possible thanks to the use |
examples/plot_langevin_dynamics.py
Outdated
# of :math:`N` Gaussians of mean :math:`\mu_n` and covarianze matrix | ||
# :math:`\Sigma_n`. For the sake of simplicity, we will suppose the covarianze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# of :math:`N` Gaussians of mean :math:`\mu_n` and covarianze matrix | |
# :math:`\Sigma_n`. For the sake of simplicity, we will suppose the covarianze | |
# of :math:`N` Gaussians of mean :math:`\mu_n` and covariance matrix | |
# :math:`\Sigma_n`. For the sake of simplicity, we will suppose the covariance |
examples/plot_langevin_dynamics.py
Outdated
# | ||
# .. math:: | ||
# | ||
# \nabla_x \log p(\mathbf{x}). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it does suddenly take a vector as input?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be always a vector. I will change it.
examples/plot_langevin_dynamics.py
Outdated
# \nabla_\mathbf{x} \log p(\mathbf{x}) = \nabla_\mathbf{x} \log q(\mathbf{x}) | ||
# - \nabla_\mathbf{x} \log Z = \nabla_\mathbf{x} \log q(\mathbf{x}), | ||
# | ||
# which is known. Once we know the score function, we can sample from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to split the paragraph here.
# which is known. Once we know the score function, we can sample from the | |
# which is known. | |
# | |
# Once we know the score function, we can sample from the |
... ) | ||
|
||
References: | ||
Paromita Banerjee, Brynjarsdottir Jenny, Gurarie David, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For references we are using the sphinxcontrib-bibtex functionality, in particular its footbibliography
functionality.
|
||
References: | ||
Paromita Banerjee, Brynjarsdottir Jenny, Gurarie David, and | ||
Albert Jeffrey. Numerical Methods for Stochastic Differential Equations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to reference an article (if there is any) than a thesis, both in term of correctness (an article has been peer-reviewed, while in a thesis there can be less scrutiny) and easiness of finding the relevant information (an article is much shorter and to-the-point).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We haven't found any article about the Milstein L=0 method apart from this thesis. Alberto has checked the thesis and he has told me that it is probably correct as the institution has high quality standards. However, there is almost no literature about the Milstein method for multidimensional data. Most people use it for one-dimensional SDEs.
with lower order of convergence. | ||
|
||
Examples: | ||
Example of the use of milstein for a 1-d Geometric Brownian motion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example of the use of milstein for a 1-d Geometric Brownian motion | |
Example of the use of Milstein's method for a 1-d Geometric Brownian motion |
and Postintervention in Structural Equation Models. PhD thesis, USA, | ||
2020. AAI29605510 | ||
""" | ||
random_state = validate_random_state(random_state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not have the bandwidth now to check for code correctness in depth. I will assume that Alberto has reviewed the code and tests with you thoroughly. If that is not true, please let me now to recheck it later before merging.
skfda/tests/test_milstein.py
Outdated
@@ -0,0 +1,337 @@ | |||
"""Tests of milstein.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Tests of milstein.""" | |
"""Tests of Milstein's method.""" |
References to issues or other PRs
Describe the proposed changes
Added milstein function which computes the Milstein scheme for Stochastic Differential Equations (SDEs). Additionally, examples which show the functionality of the SDE solvers are added.
Additional information
Checklist before requesting a review