0

Does anyone have an R implementation of a HJSON parser?

Shockingly, parser exist for some of the more 'obscure' languages (ehem.. lua?!) in their github repo but not for R: https://github.com/orgs/hjson/repositories.

For context, undertaking some hyperparameter tuning, so I wanted to specify ranges for the parameters, and HJSON format seemed appropriate for ease (familiarity), commenting and portable to other langs (e.g. Python). Alternative recommendations are welcome for suitable config formats in R.

Example:

# non-dynamic parameters
array_val: [ 1, 2, 3, 4]
array_str: [ "s1", "s2", "s3", "s4"]
some_val: 1

# parameters and dimensions for tuning
dim1:
{
    dim1_A:
    {
      parameter1: [lower_bound, upper_bound]
      parameter2: ... 
    }
}

dim2:
{
    ...
}
qubit
  • 1
  • 1
  • Could you do it with plain `json`? Or XML? Or YAML? – Allan Cameron Aug 07 '22 at 12:41
  • JSON would work I guess, but will not be able to comment decisions/parameters for future reference. TOML is an option. YAML, not a fan of whitespace sensitive schema. – qubit Aug 07 '22 at 20:08
  • If you keep comments on their own line with eg a hash or a double slash it's trivial to regex them out at the user side (A two line function could parse commented json in R or python, rather than having to rely on a non-standard language with no C/C++ parser to port.) – Allan Cameron Aug 07 '22 at 20:15
  • I wouldn't call it shocking - whenever someone likes to contribute to the project a new implementation is added. No one has taken the job on R yet. – laktak Aug 08 '22 at 18:00

0 Answers0