This is a CPOConstructor
to be used to create a
CPO
. It is called like any R function and returns
the created CPO
.
Allows imputation of missing feature values through various techniques. Note that you have the possibility to re-impute a data set in the same way as the imputation was performed during training. This especially comes in handy during resampling when one wants to perform the same imputation on the test set as on the training set.
The function impute
performs the imputation on a data set and returns,
alongside with the imputed data set, an “ImputationDesc” object
which can contain “learned” coefficients and helpful data.
It can then be passed together with a new data set to reimpute
.
The imputation techniques can be specified for certain features or for feature classes, see function arguments.
You can either provide an arbitrary object, use a built-in imputation method listed
under imputations
or create one yourself using makeImputeMethod
.
cpoImpute
will impute some columns. cpoImputeAll
behaves just like cpoImpute
,
except that it will throw an error if there are any missings remaining in its output. cpoImputeAll
should be used if one wants to prepend an imputer to a learner.
cpoImpute( target.cols = character(0), classes = list(), cols = list(), dummy.classes = character(0), dummy.cols = character(0), dummy.type = "factor", force.dummies = FALSE, impute.new.levels = TRUE, recode.factor.levels = TRUE, id, export = "export.default", affect.type = NULL, affect.index = integer(0), affect.names = character(0), affect.pattern = NULL, affect.invert = FALSE, affect.pattern.ignore.case = FALSE, affect.pattern.perl = FALSE, affect.pattern.fixed = FALSE ) cpoImputeAll( target.cols = character(0), classes = list(), cols = list(), dummy.classes = character(0), dummy.cols = character(0), dummy.type = "factor", force.dummies = FALSE, impute.new.levels = TRUE, recode.factor.levels = TRUE, id, export = "export.default", affect.type = NULL, affect.index = integer(0), affect.names = character(0), affect.pattern = NULL, affect.invert = FALSE, affect.pattern.ignore.case = FALSE, affect.pattern.perl = FALSE, affect.pattern.fixed = FALSE )
target.cols | [ |
---|---|
classes | [ |
cols | [ |
dummy.classes | [ |
dummy.cols | [ |
dummy.type | [ |
force.dummies | [ |
impute.new.levels | [ |
recode.factor.levels | [ |
id | [ |
export | [ |
affect.type | [ |
affect.index | [ |
affect.names | [ |
affect.pattern | [ |
affect.invert | [ |
affect.pattern.ignore.case | [ |
affect.pattern.perl | [ |
affect.pattern.fixed | [ |
[CPO
].
The description object contains these slots
character
]See argument.
character
]Feature names (column names of data
).
character
]Feature classes (storage type of data
).
named list
]Mapping of column names of factor features to their levels, including newly created ones during imputation.
named list
]Mapping of column names to imputation functions.
named list
]Mapping of column names to imputation functions.
logical(1)
]See argument.
logical(1)
]See argument.
This function creates a CPO object, which can be applied to
Task
s, data.frame
s, link{Learner}
s
and other CPO objects using the %>>%
operator.
The parameters of this object can be changed after creation
using the function setHyperPars
. The other
hyper-parameter manipulating functins, getHyperPars
and getParamSet
similarly work as one expects.
If the “id” parameter is given, the hyperparameters will have this id as aprefix; this will, however, not change the parameters of the creator function.
CPOConstructor
CPO constructor functions are called with optional values of parameters, and additional “special” optional values.
The special optional values are the id
parameter, and the affect.*
parameters. The affect.*
parameters
enable the user to control which subset of a given dataset is affected. If no affect.*
parameters are given, all
data features are affected by default.
Other CPOs:
cpoApplyFunRegrTarget()
,
cpoApplyFun()
,
cpoAsNumeric()
,
cpoCache()
,
cpoCbind()
,
cpoCollapseFact()
,
cpoDropConstants()
,
cpoDummyEncode()
,
cpoFilterAnova()
,
cpoFilterCarscore()
,
cpoFilterChiSquared()
,
cpoFilterFeatures()
,
cpoFilterGainRatio()
,
cpoFilterInformationGain()
,
cpoFilterKruskal()
,
cpoFilterLinearCorrelation()
,
cpoFilterMrmr()
,
cpoFilterOneR()
,
cpoFilterPermutationImportance()
,
cpoFilterRankCorrelation()
,
cpoFilterRelief()
,
cpoFilterRfCImportance()
,
cpoFilterRfImportance()
,
cpoFilterRfSRCImportance()
,
cpoFilterRfSRCMinDepth()
,
cpoFilterSymmetricalUncertainty()
,
cpoFilterUnivariate()
,
cpoFilterVariance()
,
cpoFixFactors()
,
cpoIca()
,
cpoImpactEncodeClassif()
,
cpoImpactEncodeRegr()
,
cpoImputeConstant()
,
cpoImputeHist()
,
cpoImputeLearner()
,
cpoImputeMax()
,
cpoImputeMean()
,
cpoImputeMedian()
,
cpoImputeMin()
,
cpoImputeMode()
,
cpoImputeNormal()
,
cpoImputeUniform()
,
cpoLogTrafoRegr()
,
cpoMakeCols()
,
cpoMissingIndicators()
,
cpoModelMatrix()
,
cpoOversample()
,
cpoPca()
,
cpoProbEncode()
,
cpoQuantileBinNumerics()
,
cpoRegrResiduals()
,
cpoResponseFromSE()
,
cpoSample()
,
cpoScaleMaxAbs()
,
cpoScaleRange()
,
cpoScale()
,
cpoSelect()
,
cpoSmote()
,
cpoSpatialSign()
,
cpoTransformParams()
,
cpoWrap()
,
makeCPOCase()
,
makeCPOMultiplex()
Other imputation CPOs:
cpoImputeConstant()
,
cpoImputeHist()
,
cpoImputeLearner()
,
cpoImputeMax()
,
cpoImputeMean()
,
cpoImputeMedian()
,
cpoImputeMin()
,
cpoImputeMode()
,
cpoImputeNormal()
,
cpoImputeUniform()