The user might need to define a distribution themselves. The first recommended approach is to use UserDefinedDsitribution and the second approach, for more control, is to subclass the Distribution class. We would like to communicate this information with the users
DoD:
[ ] Format of communicating this information is agreed on (e.g. book or documentation etc)
[ ] The piece of writing to convey this information is written in the agreed-upon format
Description:
The user might need to define a distribution themselves. The first recommended approach is to use UserDefinedDsitribution and the second approach, for more control, is to subclass the Distribution class. We would like to communicate this information with the users
DoD:
Notes:
First approach: using the class UserDefinedDistribution See for example section 4 in https://cuqi-dtu.github.io/CUQI-Book/chapter0A/B01_Distributions.html , note that besides passing the logpdf_func, One can also pass a gradient function (gradient_func) and a sampling function (sample_func). See the UserDefinedDistribution documentation
https://cuqi-dtu.github.io/CUQIpy/api/_autosummary/cuqi.distribution/cuqi.distribution.UserDefinedDistribution.html#cuqi.distribution.UserDefinedDistribution
Second approach: Subclassing the Distribution class:
In the user showcase: https://github.com/CUQI-DTU/CUQIpy-User-Showcase/blob/main/007_smoothed_Laplace/smoothed_laplace.ipynb We define a class LaplaceSmoothed which is a subclass of Distribution class
In the user showcase: https://github.com/CUQI-DTU/CUQIpy-User-Showcase/tree/main/011_fusion_plasma_tomography There is a file custom_distribution.py in which we define a class MyDistribution subclassed from UserDefinedDistribution (ideally it should be subclassed from Distribution).