i want to implement a normal log in Julia, I used “using Distributions” and i’m trying to run in it in Jupiter notebook but when I press TAB and write LogNormal it doesn’t show me anything like there doesn’t exist any LogNormal function. do you have any idea to help me, please?
here is the part of my code that I want to implement:
using Revise # lets you change A2funcs without restarting julia!
using Statistics: mean
using .A2funcs: log1pexp # log(1 + exp(x)) stable
using .A2funcs: factorized_gaussian_log_density
using .A2funcs: skillcontour!
using .A2funcs: plot_line_equal_skill!
includet is a function of Revise, making Revise track the included file for changes and reloading on the fly. It’s not related to the question in general.
that is another source file. it’s not important here, main problem is don’t know how to implement a log normal as a prior, as i’ve mentioned it in the question as #todo
You can find the documentation for
LogNormal() # Log-normal distribution with zero log-mean and unit scale
LogNormal(mu) # Log-normal distribution with log-mean mu and unit scale
LogNormal(mu, sig) # Log-normal distribution with log-mean mu and scale sig
params(d) # Get the parameters, i.e. (mu, sig)
meanlogx(d) # Get the mean of log(X), i.e. mu
varlogx(d) # Get the variance of log(X), i.e. sig^2
stdlogx(d) # Get the standard deviation of log(X), i.e. sig
Thanks, didn’t know. To keep it clean, I removed my post. You may consider removing your clarifications too.
Could you try your code in a plain Julia REPL (no jupiter?), just to be sure, it’s not something which comes with combination Jupiter+Revise.
A MWE would also be nice. which reproduces your problem. Maybe with some minimal code from A2_src.jl. (Please read: make it easier to help you)
i am writing this code on my jupyter notebook and when i press TAB in order to see what choices i have for the Distributions, it doesn’t mention LogNormal.
i have had problem installing juno in my laptop, by trying several times unfortunately. so i was forced to use jupyter notebook.
How are you trying to use the TAB completion? Like
Distributions.<TAB>? Which version of Distributions.jl are you on?
Try directly creating the
LogNormal object like in the example I copied from the docs - does that work?
For me it works, with Revise and without. The only thing to pay attention is for me, that the kernel is idle when trying to TAB complete.
Tried with Julia 1.3.1
The version of the notebook server is: 5.6.0 -9de07b7, Python 3.7.0 (default, Jun 28 2018, 13:15:42) [GCC 7.2.0]
[8f4d0f93] Conda v1.4.1
[31c24e10] Distributions v0.23.2
[7073ff75] IJulia v1.21.1
[2bd173c7] NodeJS v1.1.1
[295af30f] Revise v2.6.4
i understood i didn’t install the pkg on jupyter, now just installing it. hope it works.
great, thank you and did you run it as “LogNormal(mu, sig)” ??
No I didn’t, but now I did:
Seems to work.