openturns
openturns copied to clipboard
Get functions from a distribution
What happened?
In #2759, we implement Distribution.getPDF()
and Distribution.getCDF()
which return the ot.Function
corresponding to the PDF or CDF. This feature is interesting for various cases, e.g. compute or draw the likelihood of a sample with respect to the parameters of a distribution. This principle also applies to other objects from a distribution :
- logPDF
- quantile
- survival
- covariance
- shiftedMoment
- conditionalPDF
- conditionalCDF
- entropyKernel
- PDFSquared
In this list, not all functions are required in practice.
- In order to evaluate or draw the likelihood of a sample, the
logPDF()
function is interesting. Notice that this use-case could be implemented as a new method of theMaximumLikelihoodFactory.getLikelihood()
. If we have the logPDF, then we can use a custom optimizer algorithm. Notice that this can be done based on a user-definedPythonFunction
.
import openturns as ot
distribution = ot.Normal()
sample = distribution.getSample(10)
logpdf = distribution.getLogPDF()
ylog = logpdf(sample) # Use case 1
logpdf.draw(xMin, xMax) # Use case 2
- We could easily draw the quantile function:
import openturns as ot
distribution = ot.Normal()
sample = distribution.getSample(10)
quantilefunction= distribution.getQuantile()
quantilefunction.draw(xMin, xMax) # Use case 3
Version
1.23
Operating System
unknown
Installation media
unknown
Additional Context
No response