mlrCPO
mlrCPO copied to clipboard
cpoSelect with statements
trafficstars
Is there a CPO where I can just write something like cpoSelect(sel.statement = function(x) is.numeric(x) && !any(is.na(x))) and sel.statement just gets lapplied on the columns?
Currently the way to select columns is only via cpoSelect(type = "numeric"); dropping columns with missing values is not supported right now. I will try to make this nicer, probably together with "slices" (see #38)
In the mean time, a quick and dirty implementation of this would be
library("BBmisc")
cpoSelectFunctional = makeCPO("select.functional",
pSS(selector: funct),
dataformat = "df.features",
properties.adding = c("numerics.sometimes", "factors.sometimes",
"ordered.sometimes", "missings.sometimes"),
cpo.train = {
vlapply(data, selector)
},
cpo.retrafo = {
data[control]
})
Thanks. That's a nice start. If you want, you can close this issue.