Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmdstanpy/cmdstan_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ def __init__(
inits: int | float | str | list[str] | None = None,
output_dir: OptionalPath = None,
sig_figs: int | None = None,
save_latent_dynamics: bool = False,
save_diagnostics: bool = False,
save_profile: bool = False,
refresh: int | None = None,
) -> None:
Expand All @@ -664,7 +664,7 @@ def __init__(
self.inits = inits
self.output_dir = output_dir
self.sig_figs = sig_figs
self.save_latent_dynamics = save_latent_dynamics
self.save_diagnostics = save_diagnostics
self.save_profile = save_profile
self.refresh = refresh
self.method_args = method_args
Expand Down
14 changes: 7 additions & 7 deletions cmdstanpy/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def sample(
fixed_param: bool = False,
output_dir: OptionalPath = None, # Update OptionalPath if needed
sig_figs: int | None = None,
save_latent_dynamics: bool = False,
save_diagnostics: bool = False,
save_profile: bool = False,
show_progress: bool = True,
show_console: bool = False,
Expand Down Expand Up @@ -668,7 +668,7 @@ def sample(
precision for the system file I/O is used; the usual value is 6.
Introduced in CmdStan-2.25.

:param save_latent_dynamics: Whether or not to output the position and
:param save_diagnostics: Whether or not to output the position and
momentum information for the model parameters (unconstrained).
If ``True``, CSV outputs are written to an output file
'<model_name>-<YYYYMMDDHHMM>_diagnostic_<chain_id>',
Expand Down Expand Up @@ -869,7 +869,7 @@ def sample(
inits=cmdstan_inits,
output_dir=output_dir,
sig_figs=sig_figs,
save_latent_dynamics=save_latent_dynamics,
save_diagnostics=save_diagnostics,
save_profile=save_profile,
method_args=sampler_args,
refresh=refresh,
Expand Down Expand Up @@ -1176,7 +1176,7 @@ def variational(
inits: float | None = None,
output_dir: OptionalPath = None,
sig_figs: int | None = None,
save_latent_dynamics: bool = False,
save_diagnostics: bool = False,
save_profile: bool = False,
algorithm: str | None = None,
iter: int | None = None,
Expand Down Expand Up @@ -1238,7 +1238,7 @@ def variational(
precision for the system file I/O is used; the usual value is 6.
Introduced in CmdStan-2.25.

:param save_latent_dynamics: Whether or not to save diagnostics.
:param save_diagnostics: Whether or not to save diagnostics.
If ``True``, CSV outputs are written to output file
'<model_name>-<YYYYMMDDHHMM>-diagnostic-<chain_id>',
e.g. 'bernoulli-201912081451-diagnostic-1.csv'.
Expand Down Expand Up @@ -1315,7 +1315,7 @@ def variational(
inits=_inits,
output_dir=output_dir,
sig_figs=sig_figs,
save_latent_dynamics=save_latent_dynamics,
save_diagnostics=save_diagnostics,
save_profile=save_profile,
method_args=variational_args,
refresh=refresh,
Expand Down Expand Up @@ -1822,7 +1822,7 @@ def laplace_sample(
seed=seed,
output_dir=output_dir,
sig_figs=sig_figs,
save_latent_dynamics=save_diagnostics,
save_diagnostics=save_diagnostics,
save_profile=save_profile,
method_args=laplace_args,
refresh=refresh,
Expand Down
10 changes: 5 additions & 5 deletions cmdstanpy/stanfit/runset.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ def __init__(
diagnostic_ext = ".json" if args.method == Method.LAPLACE else ".csv"
if chains == 1:
self._csv_files = [self.gen_file_name(".csv")]
if args.save_latent_dynamics:
if args.save_diagnostics:
self._diagnostic_files = [
self.gen_file_name(diagnostic_ext, extra="diagnostic")
]
else:
self._csv_files = [
self.gen_file_name(".csv", id=id) for id in self._chain_ids
]
if args.save_latent_dynamics:
if args.save_diagnostics:
self._diagnostic_files = [
self.gen_file_name(
diagnostic_ext, extra="diagnostic", id=id
Expand Down Expand Up @@ -120,7 +120,7 @@ def __repr__(self) -> str:
" per-chain output files (showing chain 1 only):",
f" csv_file:\n\t{self._csv_files[0] if self._csv_files else ''}",
]
if self._args.save_latent_dynamics:
if self._args.save_diagnostics:
lines.append(f" diagnostics_file:\n\t{self._diagnostic_files[0]}")
if self._args.save_profile:
lines.append(f" profile_file:\n\t{self._profile_files[0]}")
Expand Down Expand Up @@ -175,7 +175,7 @@ def cmd(self, idx: int) -> list[str]:
csv_file=self.csv_files[idx],
diagnostic_file=(
self.diagnostic_files[idx]
if self._args.save_latent_dynamics
if self._args.save_diagnostics
else None
),
profile_file=(
Expand All @@ -188,7 +188,7 @@ def cmd(self, idx: int) -> list[str]:
csv_file=','.join(self.csv_files),
diagnostic_file=(
','.join(self.diagnostic_files)
if self._args.save_latent_dynamics
if self._args.save_diagnostics
else None
),
profile_file=(
Expand Down
12 changes: 6 additions & 6 deletions test/test_runset.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_output_filenames_one_proc_per_chain() -> None:
chain_ids=chain_ids,
data=jdata,
method_args=sampler_args,
save_latent_dynamics=True,
save_diagnostics=True,
save_profile=True,
)
runset_other_files = RunSet(
Expand Down Expand Up @@ -175,7 +175,7 @@ def test_output_filenames_threading() -> None:
chain_ids=chain_ids,
data=jdata,
method_args=sampler_args,
save_latent_dynamics=True,
save_diagnostics=True,
save_profile=True,
)
runset_other_files = RunSet(
Expand Down Expand Up @@ -221,7 +221,7 @@ def test_output_filenames_single_chain() -> None:
chain_ids=chain_ids,
data=jdata,
method_args=sampler_args,
save_latent_dynamics=True,
save_diagnostics=True,
save_profile=True,
)
runset_other_files = RunSet(
Expand Down Expand Up @@ -260,7 +260,7 @@ def test_commands() -> None:
assert 'id=4' in runset.cmd(3)


def test_save_latent_dynamics() -> None:
def test_save_diagnostics() -> None:
exe = os.path.join(DATAFILES_PATH, 'bernoulli' + EXTENSION)
jdata = os.path.join(DATAFILES_PATH, 'bernoulli.data.json')
sampler_args = SamplerArgs()
Expand All @@ -271,7 +271,7 @@ def test_save_latent_dynamics() -> None:
chain_ids=chain_ids,
data=jdata,
method_args=sampler_args,
save_latent_dynamics=True,
save_diagnostics=True,
)
runset = RunSet(args=cmdstan_args, chains=4)
assert _TMPDIR in runset.diagnostic_files[0]
Expand All @@ -282,7 +282,7 @@ def test_save_latent_dynamics() -> None:
chain_ids=chain_ids,
data=jdata,
method_args=sampler_args,
save_latent_dynamics=True,
save_diagnostics=True,
output_dir=os.path.abspath('.'),
)
runset = RunSet(args=cmdstan_args, chains=4)
Expand Down
4 changes: 2 additions & 2 deletions test/test_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -2114,7 +2114,7 @@ def test_metadata() -> None:
assert tuple(fit.metadata.stan_vars['beta'].columns()) == (7, 8)


def test_save_latent_dynamics() -> None:
def test_save_diagnostics() -> None:
stan = os.path.join(DATAFILES_PATH, 'bernoulli.stan')
jdata = os.path.join(DATAFILES_PATH, 'bernoulli.data.json')
bern_model = CmdStanModel(stan_file=stan)
Expand All @@ -2125,7 +2125,7 @@ def test_save_latent_dynamics() -> None:
seed=12345,
iter_warmup=100,
iter_sampling=200,
save_latent_dynamics=True,
save_diagnostics=True,
)
for i in range(bern_fit.chains):
diagnostics_file = bern_fit.diagnostic_files[i] # type: ignore
Expand Down
Loading