CmdStanPy - ready for beta testing!

there’s a bit more to be gleaned from looking at the raw help output - here’s what latest dev version of CmdStan says:

  method=<list element>
    Analysis method (Note that method= is optional)
    Valid values: sample, optimize, variational, diagnose, generate_quantities
    Defaults to sample

    sample
      Bayesian inference with Markov Chain Monte Carlo
      Valid subarguments: num_samples, num_warmup, save_warmup, thin, adapt, algorithm

      num_samples=<int>
        Number of sampling iterations
        Valid values: 0 <= num_samples
        Defaults to 1000

      num_warmup=<int>
        Number of warmup iterations
        Valid values: 0 <= warmup
        Defaults to 1000

      save_warmup=<boolean>
        Stream warmup samples to output?
        Valid values: [0, 1]
        Defaults to 0

      thin=<int>
        Period between saved samples
        Valid values: 0 < thin
        Defaults to 1

      adapt
        Warmup Adaptation
        Valid subarguments: engaged, gamma, delta, kappa, t0, init_buffer, term_buffer, window

        engaged=<boolean>
          Adaptation engaged?
          Valid values: [0, 1]
          Defaults to 1

        gamma=<double>
          Adaptation regularization scale
          Valid values: 0 < gamma
          Defaults to 0.05

        delta=<double>
          Adaptation target acceptance statistic
          Valid values: 0 < delta < 1
          Defaults to 0.8

        kappa=<double>
          Adaptation relaxation exponent
          Valid values: 0 < kappa
          Defaults to 0.75

        t0=<double>
          Adaptation iteration offset
          Valid values: 0 < t0
          Defaults to 10

        init_buffer=<unsigned int>
          Width of initial fast adaptation interval
          Valid values: All
          Defaults to 75

        term_buffer=<unsigned int>
          Width of final fast adaptation interval
          Valid values: All
          Defaults to 50

        window=<unsigned int>
          Initial width of slow adaptation interval
          Valid values: All
          Defaults to 25

      algorithm=<list element>
        Sampling algorithm
        Valid values: hmc, fixed_param
        Defaults to hmc

        hmc
          Hamiltonian Monte Carlo
          Valid subarguments: engine, metric, metric_file, stepsize, stepsize_jitter

          engine=<list element>
            Engine for Hamiltonian Monte Carlo
            Valid values: static, nuts
            Defaults to nuts

            static
              Static integration time
              Valid subarguments: int_time

              int_time=<double>
                Total integration time for Hamiltonian evolution
                Valid values: 0 < int_time
                Defaults to 2 * pi

            nuts
              The No-U-Turn Sampler
              Valid subarguments: max_depth

              max_depth=<int>
                Maximum tree depth
                Valid values: 0 < max_depth
                Defaults to 10

          metric=<list element>
            Geometry of base manifold
            Valid values: unit_e, diag_e, dense_e
            Defaults to diag_e

            unit_e
              Euclidean manifold with unit metric

            diag_e
              Euclidean manifold with diag metric

            dense_e
              Euclidean manifold with dense metric

          metric_file=<string>
            Input file with precomputed Euclidean metric
            Valid values: Path to existing file
            Defaults to ""

          stepsize=<double>
            Step size for discrete evolution
            Valid values: 0 < stepsize
            Defaults to 1

          stepsize_jitter=<double>
            Uniformly random jitter of the stepsize, in percent
            Valid values: 0 <= stepsize_jitter <= 1
            Defaults to 0

        fixed_param
          Fixed Parameter Sampler

    optimize
      Point estimation
      Valid subarguments: algorithm, iter, save_iterations

      algorithm=<list element>
        Optimization algorithm
        Valid values: bfgs, lbfgs, newton
        Defaults to lbfgs

        bfgs
          BFGS with linesearch
          Valid subarguments: init_alpha, tol_obj, tol_rel_obj, tol_grad, tol_rel_grad, tol_param

          init_alpha=<double>
            Line search step size for first iteration
            Valid values: 0 < init_alpha
            Defaults to 0.001

          tol_obj=<double>
            Convergence tolerance on absolute changes in objective function value
            Valid values: 0 <= tol
            Defaults to 9.9999999999999998e-13

          tol_rel_obj=<double>
            Convergence tolerance on relative changes in objective function value
            Valid values: 0 <= tol
            Defaults to 10000

          tol_grad=<double>
            Convergence tolerance on the norm of the gradient
            Valid values: 0 <= tol
            Defaults to 1e-08

          tol_rel_grad=<double>
            Convergence tolerance on the relative norm of the gradient
            Valid values: 0 <= tol
            Defaults to 10000000

          tol_param=<double>
            Convergence tolerance on changes in parameter value
            Valid values: 0 <= tol
            Defaults to 1e-08

        lbfgs
          LBFGS with linesearch
          Valid subarguments: init_alpha, tol_obj, tol_rel_obj, tol_grad, tol_rel_grad, tol_param, history_size

          init_alpha=<double>
            Line search step size for first iteration
            Valid values: 0 < init_alpha
            Defaults to 0.001

          tol_obj=<double>
            Convergence tolerance on absolute changes in objective function value
            Valid values: 0 <= tol
            Defaults to 9.9999999999999998e-13

          tol_rel_obj=<double>
            Convergence tolerance on relative changes in objective function value
            Valid values: 0 <= tol
            Defaults to 10000

          tol_grad=<double>
            Convergence tolerance on the norm of the gradient
            Valid values: 0 <= tol
            Defaults to 1e-08

          tol_rel_grad=<double>
            Convergence tolerance on the relative norm of the gradient
            Valid values: 0 <= tol
            Defaults to 10000000

          tol_param=<double>
            Convergence tolerance on changes in parameter value
            Valid values: 0 <= tol
            Defaults to 1e-08

          history_size=<int>
            Amount of history to keep for L-BFGS
            Valid values: 0 < history_size
            Defaults to 5

        newton
          Newton's method

      iter=<int>
        Total number of iterations
        Valid values: 0 < iter
        Defaults to 2000

      save_iterations=<boolean>
        Stream optimization progress to output?
        Valid values: [0, 1]
        Defaults to 0

    variational
      Variational inference
      Valid subarguments: algorithm, iter, grad_samples, elbo_samples, eta, adapt, tol_rel_obj, eval_elbo, output_samples

      algorithm=<list element>
        Variational inference algorithm
        Valid values: meanfield, fullrank
        Defaults to meanfield

        meanfield
          mean-field approximation

        fullrank
          full-rank covariance

      iter=<int>
        Maximum number of ADVI iterations.
        Valid values: 0 < iter
        Defaults to 10000

      grad_samples=<int>
        Number of Monte Carlo draws for computing the gradient.
        Valid values: 0 < num_samples
        Defaults to 1

      elbo_samples=<int>
        Number of Monte Carlo draws for estimate of ELBO.
        Valid values: 0 < num_samples
        Defaults to 100

      eta=<double>
        Stepsize scaling parameter.
        Valid values: 0 < eta
        Defaults to 1

      adapt
        Eta Adaptation for Variational Inference
        Valid subarguments: engaged, iter

        engaged=<boolean>
          Boolean flag for eta adaptation.
          Valid values: [0, 1]
          Defaults to 1

        iter=<int>
          Number of iterations for eta adaptation.
          Valid values: 0 < iter
          Defaults to 50

      tol_rel_obj=<double>
        Relative tolerance parameter for convergence.
        Valid values: 0 <= tol
        Defaults to 0.01

      eval_elbo=<int>
        Number of interations between ELBO evaluations
        Valid values: 0 < eval_elbo
        Defaults to 100

      output_samples=<int>
        Number of approximate posterior output draws to save.
        Valid values: 0 < output_samples
        Defaults to 1000

    diagnose
      Model diagnostics
      Valid subarguments: test

      test=<list element>
        Diagnostic test
        Valid values: gradient
        Defaults to gradient

        gradient
          Check model gradient against finite differences
          Valid subarguments: epsilon, error

          epsilon=<double>
            Finite difference step size
            Valid values: 0 < epsilon
            Defaults to 1e-6

          error=<double>
            Error threshold
            Valid values: 0 < error
            Defaults to 1e-6

    generate_quantities
      Generate quantities of interest
      Valid subarguments: fitted_params

      fitted_params=<string>
        Input file of sample of fitted parameter values for model conditioned on data
        Valid values: Path to existing file
        Defaults to ""

  id=<int>
    Unique process identifier
    Valid values: id > 0
    Defaults to 0

  data
    Input data options
    Valid subarguments: file

    file=<string>
      Input data file
      Valid values: Path to existing file
      Defaults to ""

  init=<string>
    Initialization method: "x" initializes randomly between [-x, x], "0" initializes to 0, anything else identifies a file of values
    Valid values: All
    Defaults to "2"

  random
    Random number configuration
    Valid subarguments: seed

    seed=<unsigned int>
      Random number generator seed
      Valid values: seed > 0, if negative seed is generated from time
      Defaults to -1

  output
    File output options
    Valid subarguments: file, diagnostic_file, refresh

    file=<string>
      Output file
      Valid values: Path to existing file
      Defaults to output.csv

    diagnostic_file=<string>
      Auxiliary output file for diagnostic information
      Valid values: Path to existing file
      Defaults to ""

    refresh=<int>
      Number of interations between screen updates
      Valid values: 0 <= refresh
      Defaults to 100


Looks like the script needs to be updated. It used to get all of that.

We’ll make sure it works going forward.

That may be a bug in the algorithms, not in PyStan.

CmdStan does support most of the cross-product here. I want to trim that down as I think some of the settings are useless. We can always add them back in later if they turn out to be critical.

Right. The one place we strongly recommend CmdStan is for long-running or cluster jobs. There’s just less that can go wrong.

1 Like

Do you mean that the valid values are missing? For example “Valid values: [0, 1]”? (I initially thought you indicated that some arguments were missing.)

The script is only aiming to get the default value and the type. The goal is to make sure that httpstan/pystan and cmdstan have identical default values and parameter names.