glearn.priors.Erlang.plot#
- Erlang.plot(interval=[0, 2], log_scale=False, compare_numerical=False, filename=None)#
Plot the kernel function and its first and second derivative.
- Parameters:
- intervalfloat, default=[0, 2]
The abscissa interval of the plot.
- log_scalebool, default=False
If True, the hyperparameter (abscissa) is assumed to be in the logarithmic scale.
- compare_numericalbool, default=False
It True, it computes the derivatives of the prior distribution and plots the numerical derivatives together with the exact values of the derivatives from analytical formula. This is used to validate the analytical formulas.
- filenamestr, default=None
Name of file to save the plot. If None, the plot is shown, but not saved. If a string, the plot is not shown, but saved. If the filename does not have a file extension, the file is saved in both
svg
andpdf
format. If the filename does not have a path, the plot is saved in the current directory.
Notes
If no graphical backend exists (such as running the code on a remote server or manually disabling the X11 backend), the plot will not be shown, rather, it will be saved as an
svg
file in the current directory.If the executable
latex
is available onPATH
, the plot is rendered using \(\rm\LaTeX\) and it may take slightly longer to produce the plot.If \(\rm\LaTeX\) is not installed, it uses any available San-Serif font to render the plot.
To manually disable interactive plot display and save the plot as
svg
instead, add the following at the very beginning of your code before importingglearn
:>>> import os >>> os.environ['GLEARN_NO_DISPLAY'] = 'True'
Examples
Create the inverse Gamma distribution with the shape parameter \(\alpha=4\) and rate parameter \(\beta=2\).
>>> from glearn import priors >>> prior = priors.InverseGamma(4, 2) >>> # Plot the distribution and its first and second derivative >>> prior.plot()