You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Revise the log_prob implementation to allow only constrained or only unconstrained params, in accord with the documentation
Allow multiple constrained parameter inputs in the form of a CSV file, similar to standalone_gqs
Description:
The log_prob method exposes a Stan model's log_prob function which takes as an input the vector of parameter values on the unconstrained scale and returns the gradients.
Desiderata
To amortize the cost of instantiating the model, the log_prob method should be able to accept an array of parameter vectors and then call the model's log_prob method on each.
Depending on the use case, the input parameters may be available on the constrained or unconstrained scale.
Current implementation
Constrained parameters are specified as a JSON object with entries for all parameters in the model, structured accordingly. Because the input file can only contain one JSON object, the current implementation doesn't admit of getting radients for more than one set of parameters on the constrained scale.
The documentation states that the user can only specify one or the other.
The code, as written, allows for inputs in the form of a file of one or more sets of parameters on the unconstrained scale and/or a file of a single set of parameter values on the constrained scale. If both are present, the logic will first computes the gradients for all unconstrained parameter sets, then compute the gradients for the constrained parameter set. This means that the last row of the output corresponds to the constrained parameters, if constrained parameter input file is present.
mitzimorris
changed the title
log_prop unit tests contradict documentation
log_prop implementation allows un- and constrained param input files, but will clobber former with latter
Nov 22, 2022
mitzimorris
changed the title
log_prop implementation allows un- and constrained param input files, but will clobber former with latter
log_prop implementation allows un- and constrained param input files, but docs say only one or the other.
Nov 22, 2022
mitzimorris
changed the title
log_prop implementation allows un- and constrained param input files, but docs say only one or the other.
log_prob - allow only constrained or unconstrained inputs; allow multiple constrained inputs
Nov 22, 2022
Summary:
Revise the
log_prob
implementation to allow only constrained or only unconstrained params, in accord with the documentationAllow multiple constrained parameter inputs in the form of a CSV file, similar to standalone_gqs
Description:
The
log_prob
method exposes a Stan model'slog_prob
function which takes as an input the vector of parameter values on the unconstrained scale and returns the gradients.Desiderata
To amortize the cost of instantiating the model, the
log_prob
method should be able to accept an array of parameter vectors and then call the model's log_prob method on each.Depending on the use case, the input parameters may be available on the constrained or unconstrained scale.
Current implementation
Constrained parameters are specified as a JSON object with entries for all parameters in the model, structured accordingly. Because the input file can only contain one JSON object, the current implementation doesn't admit of getting radients for more than one set of parameters on the constrained scale.
The documentation states that the user can only specify one or the other.
The code, as written, allows for inputs in the form of a file of one or more sets of parameters on the unconstrained scale and/or a file of a single set of parameter values on the constrained scale. If both are present, the logic will first computes the gradients for all unconstrained parameter sets, then compute the gradients for the constrained parameter set. This means that the last row of the output corresponds to the constrained parameters, if constrained parameter input file is present.
cmdstan/src/test/interface/log_prob_test.cpp
Lines 42 to 54 in 6bfcc1c
Reproducible Steps:
Changed CmdStan code to check for this; unit tests fail.
.
Current Version:
v2.31.0
The text was updated successfully, but these errors were encountered: