stan-dev / stan-dev/rstan

API for getting model parameters information

Open
#156 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Is it possible to get the information about the stanfit object parameters in Rstan?
E.g. get_pars_info(stanfit) that would return something like:

list( a = c( type = 'vector', dim = 2, lower = -1, upper = 1 ),
      b = c( type = 'matrix', dim = c( 2, 5 ), lower = 0, upper = NA ) )

One potential use-case. I've ended up using DEoptim R package to optimize the function defined as a Stan model (log_prob(stanfit, upars)). DEoptim allows specifying element-wise constraints on the parameter vector, and it appears that differential evolution in the constrained space is much more efficient than in the unconstrained one. ATM I have to "manually" take care that constraints specification for DEoptim is in sync with the
Stan model, with get_pars_info() it would be possible to generate this specification automatically.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the stanfit object and the log_prob(stanfit, upars) interface mentioned in the issue to determine what parameter metadata is available. Done means providing a get_pars_info(stanfit)-style API that returns parameter types, dimensions, and bounds in a form usable for element-wise constraints.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.