How can we Fix a PipeOp
's $state
, so that its parameters or config are fixed from the beginning and remain the same in both training and prediction.
task = tsk("iris")
pos1 = po("scale", param_vals =list(
center = T,
scale = T,
affect_columns = selector_name("Sepal.Width")))
pos1$state
pos1$state$center <- c(Sepal.Width = 0)
pos1$state$scale <- c(Sepal.Width = 2)
graph <- pos1 %>>% lrn("classif.xgboost", eval_metric = "mlogloss")
gl <- GraphLearner$new(graph)
gl$train(task)
gl$state
In the code above, the parameters center
and scale
from po("scale")
are recalculated based on the data even when I try to fix them as zero and two (not sure whether I did this correctly), respectively.