WIP: Wrapper package for the optimize method in Stan's cmdstan executable.
Author StanJulia
0 Stars
Updated Last
1 Year Ago
Started In
June 2019


Project Status Build Status

Important note

StanOptimize.jl v3 is a breaking change.

While in StanOptimize.jl v2 one could select Bfgs as optimization algorithm:

 om = OptimizeModel("bernoulli",  bernoulli_model;
  #tmpdir = joinpath(@__DIR__, "tmp"));
  tmpdir = mktempdir());
rc = stan_optimize(om; data, init)

In StanOptimize.jl v3:

om = OptimizeModel("bernoulli",  bernoulli_model)
rc = stan_optimize(om; data, init, algorithm=:bfgs)

See ??OptimizeModel and ??stan_optimize.


This package is registered. Install with

pkg> add StanOptimize

You need a working cmdstan installation, the path of which you should specify in either CMDSTAN or JULIA_CMDSTAN_HOME, eg in your ~/.julia/config/startup.jl` have a line like

# CmdStan setup
ENV["CMDSTAN"] = expanduser("~/src/cmdstan-2.28.2/") # replace with your path

This package is derived from Tamas Papp's StanRun.jl package.


It is recommended that you start your Julia process with multiple worker processes to take advantage of parallel sampling, eg

julia -p auto

Otherwise, stan_sample will use a single process.

Use this package like this:

using StanOptimize

See the docstrings (in particular ?StanOptimize) for more.