Hi everyone,
I am following the example posted here:
https://github.com/StanJulia/StanSample.jl/blob/master/example/keyword_bernoulli.jl
When I get to the following line of code I get an error:
sm = SampleModel("test_b", bernoulli_model, tmpdir);
This is the error it generates:
/home/charper/classes/MATH462/tmp/test_b.stan updated.
IOError: cd(""): no such file or directory (ENOENT)
Stacktrace:
[1] uv_error
@ ./libuv.jl:97 [inlined]
[2] cd(dir::String)
@ Base.Filesystem ./file.jl:89
[3] cd(f::StanSample.var"#25#26"{IOBuffer, String, String}, dir::String)
@ Base.Filesystem ./file.jl:109
[4] SampleModel(name::String, model::String, tmpdir::String)
@ StanSample ~/.julia/packages/StanSample/rqV3P/src/stanmodel/SampleModel.jl:104
[5] top-level scope
@ In[72]:1
[6] eval
@ ./boot.jl:373 [inlined]
[7] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1196
For ease of reading I have copy and pasted the whole example below:
using StanSample
ProjDir = @__DIR__
bernoulli_model = "
data {
int<lower=1> N;
int<lower=0,upper=1> y[N];
}
parameters {
real<lower=0,upper=1> theta;
}
model {
theta ~ beta(1,1);
y ~ bernoulli(theta);
}
";
data = Dict("N" => 10, "y" => [0, 1, 0, 1, 0, 0, 0, 0, 0, 1])
# Keep tmpdir across multiple runs to prevent re-compilation
tmpdir = joinpath(@__DIR__, "tmp")
sm = SampleModel("kw_bern", bernoulli_model, tmpdir);
sm |> display
rc = stan_sample(sm; data, num_threads=4, num_cpp_chains=4, num_chains=2, seed=12);
if success(rc)
st = read_samples(sm)
display(st)
println()
display(read_samples(sm, :dataframe))
end
When I check the size of test_b.stan, it is not zero.