Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to "paradox" package will break NADIA #186

Open
mb706 opened this issue Jan 14, 2024 · 1 comment
Open

Changes to "paradox" package will break NADIA #186

mb706 opened this issue Jan 14, 2024 · 1 comment

Comments

@mb706
Copy link

mb706 commented Jan 14, 2024

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.

@eccentric003x
Copy link

Hello! I'm encountering an issue when trying to use PipeOpMice from the NADIA package. When running the following example code, I receive an error.

library(NADIA)
library(mlr3oml)
task <- mlr3oml::OMLTask$new(55)
task <- task$task
graph <- PipeOpMice$new()%>>% PipeOpEncodeImpact$new() %>>% lrn('classif.glmnet')
Error in isTRUE(lhs) : 找不到对象'ParamDbl'

Thank you for any assistance you can provide! The error seems related to the ParamDbl object, but I'm not sure if there's a specific configuration or setup required to resolve this. Any suggestions would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants