httpstan.fits

Helper functions for Stan fits.

Module Contents

Functions

calculate_fit_name(function: str, model_name: str, kwargs: dict) → str

Calculate fit name from parameters and data.

httpstan.fits.calculate_fit_name(function: str, model_name: str, kwargs: dict) str[source]

Calculate fit name from parameters and data.

If a random seed is provided, a fit is a deterministic function of the model, data, and parameters. If no random seed is provided, this function returns a random string.

If a random seed is provided, a fit id is a hash of the concatenation of binary representations of the arguments to services_stub.call (type, model, kwargs):

  • UTF-8 encoded name of service function (e.g., hmc_nuts_diag_e_adapt)

  • UTF-8 encoded Stan model name (which is derived from a hash of program_code)

  • Bytes of pickled kwargs dictionary

  • UTF-8 encoded string recording the httpstan version

  • UTF-8 encoded string identifying the system platform

  • UTF-8 encoded string identifying the system bit architecture

  • UTF-8 encoded string identifying the Python version

  • UTF-8 encoded string identifying the Python executable

Parameters
  • function – name of service function

  • model_name – Stan model name

  • kwargs – kwargs passed to service function

Returns

fit name

Return type

str