R/FeatSelWrapper.R
Fuses a base learner with a search strategy to select variables. Creates a learner object, which can be used like any other learner object, but which internally uses [selectFeatures]. If the train function is called on it, the search strategy and resampling are invoked to select an optimal set of variables. Finally, a model is fitted on the complete training data with these variables and returned. See [selectFeatures] for more details.
After training, the optimal features (and other related information) can be retrieved with [getFeatSelResult].
makeFeatSelWrapper(learner, resampling, measures, bit.names, bits.to.features, control, show.info = getMlrOption("show.info"))
| learner | (Learner | |
|---|---|
| resampling | ([ResampleInstance] | [ResampleDesc]) |
| measures | (list of Measure | Measure) |
| bit.names | [character] |
| bits.to.features | [function(x, task)] |
| control | [see [FeatSelControl]) Control object for search method. Also selects the optimization algorithm for feature selection. |
| show.info | ( |
Other featsel: FeatSelControl,
analyzeFeatSelResult,
getFeatSelResult,
selectFeatures
Other wrapper: makeBaggingWrapper,
makeClassificationViaRegressionWrapper,
makeConstantClassWrapper,
makeCostSensClassifWrapper,
makeCostSensRegrWrapper,
makeDownsampleWrapper,
makeDummyFeaturesWrapper,
makeExtractFDAFeatsWrapper,
makeFilterWrapper,
makeImputeWrapper,
makeMulticlassWrapper,
makeMultilabelBinaryRelevanceWrapper,
makeMultilabelClassifierChainsWrapper,
makeMultilabelDBRWrapper,
makeMultilabelNestedStackingWrapper,
makeMultilabelStackingWrapper,
makeOverBaggingWrapper,
makePreprocWrapperCaret,
makePreprocWrapper,
makeRemoveConstantFeaturesWrapper,
makeSMOTEWrapper,
makeTuneWrapper,
makeUndersampleWrapper,
makeWeightedClassesWrapper
# nested resampling with feature selection (with a pretty stupid algorithm for selection) outer = makeResampleDesc("CV", iters = 2L) inner = makeResampleDesc("Holdout") ctrl = makeFeatSelControlRandom(maxit = 1) lrn = makeFeatSelWrapper("classif.ksvm", resampling = inner, control = ctrl) # we also extract the selected features for all iteration here r = resample(lrn, iris.task, outer, extract = getFeatSelResult)