orbit.estimators package

Submodules

orbit.estimators.base_estimator module

class orbit.estimators.base_estimator.BaseEstimator(seed=8888, verbose=False)

Bases: object

Base Estimator class for both Stan and Pyro Estimator

Parameters
  • seed (int) – seed number for initial random values

  • verbose (bool) – If True, output all diagnostics messages from estimators

abstract fit(model_name, model_param_names, data_input, init_values=None)
Parameters
  • model_name (str) – name of model - used in mapping the right sampling file (stan/pyro/…)

  • model_param_names (list) – list of strings of model parameters names to extract

  • data_input (dict) – key-value pairs of data input as required by definition in samplers (stan/pyro/…)

  • init_values (float or np.array) – initial sampler value. If None, ‘random’ is used

Returns

key: value pairs in which key is the model parameter name and value is num_sample x posterior values

Return type

OrderedDict

orbit.estimators.pyro_estimator module

class orbit.estimators.pyro_estimator.PyroEstimator(num_steps=101, learning_rate=0.1, learning_rate_total_decay=1.0, message=100, **kwargs)

Bases: orbit.estimators.base_estimator.BaseEstimator

Abstract PyroEstimator with shared args for all PyroEstimator child classes

Parameters
  • seed (int) – seed number for initial random values

  • verbose (bool) – If True, output all diagnostics messages from estimators

  • num_steps (int) – Number of estimator steps in optimization

  • learning_rate (float) – Estimator learning rate

  • learning_rate_total_decay (float) – A config re-parameterized from lrd in ClippedAdam. Note this is the total decay over all num_steps, not the per-step decay factor. Such parameter is independent from num_steps. e.g. 1.0 means no decay and 0.1 means 90% decay at the final step.

  • seed – Seed int

  • message (int) – Print to console every message number of steps

  • kwargs – Additional BaseEstimator args

Notes

See http://docs.pyro.ai/en/stable/_modules/pyro/optim/clipped_adam.html for optimizer details

abstract fit(model_name, model_param_names, data_input, init_values=None)
Parameters
  • model_name (str) – name of model - used in mapping the right sampling file (stan/pyro/…)

  • model_param_names (list) – list of strings of model parameters names to extract

  • data_input (dict) – key-value pairs of data input as required by definition in samplers (stan/pyro/…)

  • init_values (float or np.array) – initial sampler value. If None, ‘random’ is used

Returns

key: value pairs in which key is the model parameter name and value is num_sample x posterior values

Return type

OrderedDict

class orbit.estimators.pyro_estimator.PyroEstimatorMAP(**kwargs)

Bases: orbit.estimators.pyro_estimator.PyroEstimator

Pyro Estimator for MAP Posteriors

Parameters
  • seed (int) – seed number for initial random values

  • verbose (bool) – If True, output all diagnostics messages from estimators

  • num_steps (int) – Number of estimator steps in optimization

  • learning_rate (float) – Estimator learning rate

  • learning_rate_total_decay (float) – A config re-parameterized from lrd in ClippedAdam. Note this is the total decay over all num_steps, not the per-step decay factor. Such parameter is independent from num_steps. e.g. 1.0 means no decay and 0.1 means 90% decay at the final step.

  • seed – Seed int

  • message (int) – Print to console every message number of steps

  • kwargs – Additional BaseEstimator args

Notes

See http://docs.pyro.ai/en/stable/_modules/pyro/optim/clipped_adam.html for optimizer details

fit(model_name, model_param_names, data_input, init_values=None)
Parameters
  • model_name (str) – name of model - used in mapping the right sampling file (stan/pyro/…)

  • model_param_names (list) – list of strings of model parameters names to extract

  • data_input (dict) – key-value pairs of data input as required by definition in samplers (stan/pyro/…)

  • init_values (float or np.array) – initial sampler value. If None, ‘random’ is used

Returns

key: value pairs in which key is the model parameter name and value is num_sample x posterior values

Return type

OrderedDict

class orbit.estimators.pyro_estimator.PyroEstimatorVI(num_sample=100, num_particles=100, **kwargs)

Bases: orbit.estimators.pyro_estimator.PyroEstimator

Pyro Estimator for VI Sampling

Parameters
  • seed (int) – seed number for initial random values

  • verbose (bool) – If True, output all diagnostics messages from estimators

  • num_steps (int) – Number of estimator steps in optimization

  • learning_rate (float) – Estimator learning rate

  • learning_rate_total_decay (float) – A config re-parameterized from lrd in ClippedAdam. Note this is the total decay over all num_steps, not the per-step decay factor. Such parameter is independent from num_steps. e.g. 1.0 means no decay and 0.1 means 90% decay at the final step.

  • seed – Seed int

  • message (int) – Print to console every message number of steps

  • kwargs – Additional BaseEstimator args

  • num_sample (int) – Number of samples ot draw for inference, default 100

  • num_particles (int) – Number of particles used in :class: ~pyro.infer.Trace_ELBO for SVI optimization

  • kwargs – Additional PyroEstimator class args

Notes

See http://docs.pyro.ai/en/stable/_modules/pyro/optim/clipped_adam.html for optimizer details

fit(model_name, model_param_names, data_input, init_values=None)
Parameters
  • model_name (str) – name of model - used in mapping the right sampling file (stan/pyro/…)

  • model_param_names (list) – list of strings of model parameters names to extract

  • data_input (dict) – key-value pairs of data input as required by definition in samplers (stan/pyro/…)

  • init_values (float or np.array) – initial sampler value. If None, ‘random’ is used

Returns

key: value pairs in which key is the model parameter name and value is num_sample x posterior values

Return type

OrderedDict

orbit.estimators.stan_estimator module

class orbit.estimators.stan_estimator.StanEstimator(num_warmup=900, num_sample=100, chains=4, cores=8, algorithm=None, **kwargs)

Bases: orbit.estimators.base_estimator.BaseEstimator

Abstract StanEstimator with shared args for all StanEstimator child classes

Parameters
  • seed (int) – seed number for initial random values

  • verbose (bool) – If True, output all diagnostics messages from estimators

  • num_warmup (int) – Number of samples to discard, default 900

  • num_sample (int) – Number of samples to return, default 100

  • chains (int) – Number of chains in stan sampler, default 4

  • cores (int) – Number of cores for parallel processing, default max(cores, multiprocessing.cpu_count())

  • algorithm (str) – If None, default to Stan defaults

  • kwargs – Additional BaseEstimator class args

abstract fit(model_name, model_param_names, data_input, init_values=None)
Parameters
  • model_name (str) – name of model - used in mapping the right sampling file (stan/pyro/…)

  • model_param_names (list) – list of strings of model parameters names to extract

  • data_input (dict) – key-value pairs of data input as required by definition in samplers (stan/pyro/…)

  • init_values (float or np.array) – initial sampler value. If None, ‘random’ is used

Returns

key: value pairs in which key is the model parameter name and value is num_sample x posterior values

Return type

OrderedDict

class orbit.estimators.stan_estimator.StanEstimatorMAP(stan_map_args=None, **kwargs)

Bases: orbit.estimators.stan_estimator.StanEstimator

Stan Estimator for MAP Posteriors

Parameters
  • seed (int) – seed number for initial random values

  • verbose (bool) – If True, output all diagnostics messages from estimators

  • num_warmup (int) – Number of samples to discard, default 900

  • num_sample (int) – Number of samples to return, default 100

  • chains (int) – Number of chains in stan sampler, default 4

  • cores (int) – Number of cores for parallel processing, default max(cores, multiprocessing.cpu_count())

  • algorithm (str) – If None, default to Stan defaults

  • kwargs – Additional BaseEstimator class args

  • stan_map_args (dict) – Supplemental stan vi args to pass to PyStan.optimizing()

fit(model_name, model_param_names, data_input, init_values=None)
Parameters
  • model_name (str) – name of model - used in mapping the right sampling file (stan/pyro/…)

  • model_param_names (list) – list of strings of model parameters names to extract

  • data_input (dict) – key-value pairs of data input as required by definition in samplers (stan/pyro/…)

  • init_values (float or np.array) – initial sampler value. If None, ‘random’ is used

Returns

key: value pairs in which key is the model parameter name and value is num_sample x posterior values

Return type

OrderedDict

class orbit.estimators.stan_estimator.StanEstimatorMCMC(stan_mcmc_control=None, stan_mcmc_args=None, **kwargs)

Bases: orbit.estimators.stan_estimator.StanEstimator

Stan Estimator for MCMC Sampling

Parameters
  • seed (int) – seed number for initial random values

  • verbose (bool) – If True, output all diagnostics messages from estimators

  • num_warmup (int) – Number of samples to discard, default 900

  • num_sample (int) – Number of samples to return, default 100

  • chains (int) – Number of chains in stan sampler, default 4

  • cores (int) – Number of cores for parallel processing, default max(cores, multiprocessing.cpu_count())

  • algorithm (str) – If None, default to Stan defaults

  • kwargs – Additional BaseEstimator class args

  • stan_mcmc_control (dict) – Supplemental stan control parameters to pass to PyStan.sampling()

  • stan_mcmc_args (dict) – Supplemental stan mcmc args to pass to PyStan.sampling()

fit(model_name, model_param_names, data_input, init_values=None)
Parameters
  • model_name (str) – name of model - used in mapping the right sampling file (stan/pyro/…)

  • model_param_names (list) – list of strings of model parameters names to extract

  • data_input (dict) – key-value pairs of data input as required by definition in samplers (stan/pyro/…)

  • init_values (float or np.array) – initial sampler value. If None, ‘random’ is used

Returns

key: value pairs in which key is the model parameter name and value is num_sample x posterior values

Return type

OrderedDict

class orbit.estimators.stan_estimator.StanEstimatorVI(stan_vi_args=None, **kwargs)

Bases: orbit.estimators.stan_estimator.StanEstimator

Stan Estimator for VI Sampling

Parameters
  • seed (int) – seed number for initial random values

  • verbose (bool) – If True, output all diagnostics messages from estimators

  • num_warmup (int) – Number of samples to discard, default 900

  • num_sample (int) – Number of samples to return, default 100

  • chains (int) – Number of chains in stan sampler, default 4

  • cores (int) – Number of cores for parallel processing, default max(cores, multiprocessing.cpu_count())

  • algorithm (str) – If None, default to Stan defaults

  • kwargs – Additional BaseEstimator class args

  • stan_vi_args (dict) – Supplemental stan vi args to pass to PyStan.vb()

fit(model_name, model_param_names, data_input, init_values=None)
Parameters
  • model_name (str) – name of model - used in mapping the right sampling file (stan/pyro/…)

  • model_param_names (list) – list of strings of model parameters names to extract

  • data_input (dict) – key-value pairs of data input as required by definition in samplers (stan/pyro/…)

  • init_values (float or np.array) – initial sampler value. If None, ‘random’ is used

Returns

key: value pairs in which key is the model parameter name and value is num_sample x posterior values

Return type

OrderedDict

Module contents