Skip to content

Changes to "paradox" package will break NADIA #186

@mb706

Description

@mb706

We are in the process of overhauling the paradox package, on which your NADIA package depends: At some point in the near future, we are going to merge this PR.

This will remove the ParamDbl, ParamInt etc. classes, instead only the ParamSet class will remain, representing the parameter space as a table. Constructing a ParamSet will then need to be done using the shorthand forms ps(), p_dbl(), p_int() etc. See this diff of PipeOpImputeOOR.R in mlr3pipelines as an example of what changes are necessary.

Note that ps(), p_dbl() etc. is already possible (and the recommended way of doing this!), we are just phasing out the old ParamDbl$new() way.


If it helps, I did this semi-automatically by running the following in the R directory of affected packages. Please check these commands before running them and check the result, I can't guarantee that it works as intended in your setup.

sed -i 's/\(^ *\)ParamInt\$new("\([^"]*\)", /\1\2 = p_int(/' ./*.R
sed -i 's/\(^ *\)ParamDbl\$new("\([^"]*\)", /\1\2 = p_dbl(/' ./*.R
sed -i 's/\(^ *\)ParamFct\$new("\([^"]*\)", /\1\2 = p_fct(/' ./*.R
sed -i 's/\(^ *\)ParamUty\$new("\([^"]*\)", /\1\2 = p_uty(/' ./*.R
sed -i 's/\(^ *\)ParamLgl\$new("\([^"]*\)", /\1\2 = p_lgl(/' ./*.R
sed -i 's/ParamSet\$new()/ps()/g' ./*.R
sed -i 's/ParamSet\$new(list/ParamSet$new(params = list/g' ./*.R
for f in ./*.R ; do awk '/ParamSet\$new\(params = list\($/ { sub(/ParamSet\$new\(params = list\(/, "ps(");  print; in_block=1;  next; } in_block && /^ *\)\)$/ { sub(/\)\)/, ")"); in_block=0; } { print }'  $f > tmp ; mv tmp  $f ; done

It is not perfect -- it e.g. fails when the closing parentheses of the ParamSet$new(params = list( are not on the same line (i.e. they are not ))), so I had to do some manual cleaning afterwards.

Some other changes could also be necessary: Instead of accessing param_set$params[["<id>"]]$<field>, it is now necessary to access param_set$<field>[["<id>"]]. Both of these were possible in the past, we are phasing out the first one now.

Please @ me if you have any questions, I will try to help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions