FSelectorRandomSearch class that implements a simple Random Search.

In order to support general termination criteria and parallelization, we evaluate feature sets in a batch-fashion of size batch_size. Larger batches mean we can parallelize more, smaller batches imply a more fine-grained checking of termination criteria.

Source

Bergstra J, Bengio Y (2012). “Random Search for Hyper-Parameter Optimization.” Journal of Machine Learning Research, 13(10), 281--305. https://jmlr.csail.mit.edu/papers/v13/bergstra12a.html.

Dictionary

This FSelector can be instantiated via the dictionary mlr_fselectors or with the associated sugar function fs():

mlr_fselectors$get("random_search")
fs("random_search")

Parameters

max_features

integer(1)
Maximum number of features. By default, number of features in mlr3::Task.

batch_size

integer(1)
Maximum number of feature sets to try in a batch.

Super class

mlr3fselect::FSelector -> FSelectorRandomSearch

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage

FSelectorRandomSearch$new()


Method clone()

The objects of this class are cloneable with this method.

Usage

FSelectorRandomSearch$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

library(mlr3) terminator = trm("evals", n_evals = 5) instance = FSelectInstanceSingleCrit$new( task = tsk("iris"), learner = lrn("classif.rpart"), resampling = rsmp("holdout"), measure = msr("classif.ce"), terminator = terminator ) fselector = fs("random_search") # \donttest{ # Modifies the instance by reference fselector$optimize(instance)
#> Petal.Length Petal.Width Sepal.Length Sepal.Width features #> 1: TRUE FALSE TRUE FALSE Petal.Length,Sepal.Length #> classif.ce #> 1: 0.04
# Returns best scoring evaluation instance$result
#> Petal.Length Petal.Width Sepal.Length Sepal.Width features #> 1: TRUE FALSE TRUE FALSE Petal.Length,Sepal.Length #> classif.ce #> 1: 0.04
# Allows access of data.table of full path of all evaluations as.data.table(instance$archive)# }
#> Petal.Length Petal.Width Sepal.Length Sepal.Width classif.ce #> 1: FALSE TRUE TRUE TRUE 0.06 #> 2: FALSE FALSE FALSE TRUE 0.40 #> 3: TRUE FALSE TRUE FALSE 0.04 #> 4: TRUE FALSE TRUE TRUE 0.04 #> 5: FALSE FALSE FALSE TRUE 0.40 #> runtime_learners timestamp batch_nr resample_result #> 1: 0.062 2021-09-17 04:15:56 1 <ResampleResult[20]> #> 2: 0.066 2021-09-17 04:15:56 2 <ResampleResult[20]> #> 3: 0.083 2021-09-17 04:15:57 3 <ResampleResult[20]> #> 4: 0.062 2021-09-17 04:15:57 4 <ResampleResult[20]> #> 5: 0.068 2021-09-17 04:15:57 5 <ResampleResult[20]>