stan-dev / cmdstanpy

CmdStanPy is a lightweight interface to Stan for Python users which provides the necessary objects and functions to compile a Stan program and fit the model to data using CmdStan.
BSD 3-Clause "New" or "Revised" License
153 stars 69 forks source link

add method `Fixed_Param` #64

Closed mitzimorris closed 5 years ago

mitzimorris commented 5 years ago

Summary:

Implement logic for algorithm=Fixed_Param

Description:

from the CmdStan manual:

Fixed Parameter Sampler The fixed parameter sampler generates a new sample without changing the current state of the Markov chain; only generated quantities may change. This can be useful when, for example, trying to generate pseudo-data using the generated quantities block. If the parameters block is empty (no parameters) then using algorithm=fixed_param is mandatory.

This generates the same output as the sample command.

- add method fixed_param to Model class - implement placeholder class FixedParamArgs in file cmdstan_args.py as needed.

Update: "algorithm=fixed_param" is part of method sample - added boolean arg fixed_param, default is false. don't need additional methods or class FixedParamArgs.

Additional Information:

"Fixed_Param" is a terrible name. alternatives: "run_program". Need to get across idea that sample is not generated by MCMC, instead using RNG functions to generate outputs.

Current Version:

mitzimorris commented 5 years ago

name "fixed_state_sample"? "run_fixed_state"? "fixed_param_sample" - returns a StanFit object, but missing metric, therefore num_params.

mitzimorris commented 5 years ago

pending PR https://github.com/stan-dev/cmdstanpy/pull/119

mitzimorris commented 5 years ago

PR #119 has been merged.