Open WardBrian opened 1 year ago
If the other posterior authors are ok with adding this I can make a PR.
yes that would be nice!
Jonah Gabry @.***> schrieb am Fr., 17. Nov. 2023, 17:54:
If the other posterior authors are ok with adding this I can make a PR.
— Reply to this email directly, view it on GitHub https://github.com/stan-dev/posterior/issues/317#issuecomment-1816767698, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADCW2AGEQFTYLS5X4WBOYYLYE6JCTAVCNFSM6AAAAAA7P7MTDCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJWG43DONRZHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@paul-buerkner Any preference where this should go? I was thinking of documenting it on the same doc page as set_variables()
, but I could also put it somewhere else. On slack @avehtari gave an example of
x <- set_variables(x, repair_variable_names(bad_names))
which seems like the most common use case for a function like repair_variable_names
.
yeah I like that!
Jonah Gabry @.***> schrieb am Fr., 17. Nov. 2023, 18:30:
@paul-buerkner https://github.com/paul-buerkner Any preference where this should go? I was thinking of documenting it on the same doc page as set_variables(), but I could also put it somewhere else. On slack @avehtari https://github.com/avehtari gave an example of
x <- set_variables(x, repair_variable_names(bad_names))
which seems like the most common use case for a function like repair_variable_names.
— Reply to this email directly, view it on GitHub https://github.com/stan-dev/posterior/issues/317#issuecomment-1816819484, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADCW2ADQ6NLYK6J7LH75RZTYE6NK3AVCNFSM6AAAAAA7P7MTDCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJWHAYTSNBYGQ . You are receiving this because you were mentioned.Message ID: @.***>
Started to think, whether repair
is the best name? Would convert
be better?
This doesn't work for complex numbers or tuples, but since posterior doesn't seem to support those either I think this is fine
Can you add examples of how the names for these would look like? It would be good to recognize complex and tuples even if there would not be support at the moment
Started to think, whether
repair
is the best name? Wouldconvert
be better?
I opened a PR for this (https://github.com/stan-dev/posterior/pull/318) using repair
but I'm happy to change the name. Do you want to move the naming discussion to the PR review?
Can you add examples of how the names for these would look like? It would be good to recognize complex and tuples even if there would not be support at the moment
Complex variables use .real
and .imag
as their CSV names in Stan. So something like a complex_vector[2] foo
has names foo.1.real,foo.1.imag,foo.2.real,foo.2.imag
Tuples use :
to separate "slots" in a tuple. So a tuple(real, int) a
is printed as a:1,a:2
. This stacks naturally with the .
for arrays of tuples/tuples of arrays.
If you want some really nasty edge cases, you can see some of the test cases of my stanio Python package
This allows you to translate from the names Stan uses (like
theta.1
) to those Posterior wants (theta[1]
).This function exists (privately) in cmdstanr, and is currently very simple:
This doesn't work for complex numbers or tuples, but since posterior doesn't seem to support those either I think this is fine