mlrCPO (version 0.3.4-4)

clearRI: Clear Retrafo and Inverter Attributes

Description

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.

Usage

clearRI(data)

Arguments

data

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

Value

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

See Also

Other retrafo related: CPOTrained, NULLCPO, %>>%, applyCPO, as.list.CPO, getCPOClass, getCPOName, getCPOOperatingType, getCPOPredictType, getCPOProperties, getCPOTrainedCPO, getCPOTrainedCapability, getCPOTrainedState, is.retrafo, makeCPOTrainedFromState, pipeCPO, print.CPOConstructor

Other inverter related: CPOTrained, NULLCPO, %>>%, applyCPO, as.list.CPO, getCPOClass, getCPOName, getCPOOperatingType, getCPOPredictType, getCPOProperties, getCPOTrainedCPO, getCPOTrainedCapability, getCPOTrainedState, is.inverter, makeCPOTrainedFromState, pipeCPO, print.CPOConstructor

Examples

Run this code
# NOT RUN {
# without clearRI
transformed = iris.task %>>% cpoPca()
transformed2 = transformed %>>% cpoScale()
retrafo(transformed2)  # [RETRAFO pca]=>[RETRAFO scale]

transformed = iris.task %>>% cpoPca()
transformed2 = clearRI(transformed) %>>% cpoScale()
retrafo(transformed2)  # [RETRAFO scale]

# }

Run the code above in your browser using DataCamp Workspace