When applying CPOs to data, the operation entails saving the CPOTrained information that gets generated to an attribute of the resulting object. This is a useful solution to the problem that applying multiple CPOs should also lead to a retrafo object that performs the same multiple operations. However, sometimes this may lead to surprising and unwanted results when a CPO is applied and not meant to be part of a trafo-retrafo machine learning pipeline, e.g. for dropping columns that occur in training but not in prediction data. In that case, it is necessary to reset the retrafo and possibly inverter attributes of the data being used. This can be done either by using retrafo(data) <- NULL, or by using clearRI. clearRI clears both retrafo and inverter attributes.




[data.frame | Task | WrappedModel]
The result of a CPO applied to a data set.


[data.frame | Task | WrappedModel] the data after stripping all retrafo and inverter attributes.

See also


# without clearRI transformed = iris.task %>>% cpoPca() transformed2 = transformed %>>% cpoScale() retrafo(transformed2) # [RETRAFO pca]=>[RETRAFO scale]
#> CPO Retrafo chain #> [RETRAFO pca(center = TRUE, scale = FALSE)] => #> [RETRAFO scale(center = TRUE, scale = TRUE)]
transformed = iris.task %>>% cpoPca() transformed2 = clearRI(transformed) %>>% cpoScale() retrafo(transformed2) # [RETRAFO scale]
#> CPO Retrafo chain #> [RETRAFO scale(center = TRUE, scale = TRUE)]