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 TRUE FALSE FALSE Petal.Length,Petal.Width #> classif.ce #> 1: 0.04
# Returns best scoring evaluation instance$result
#> Petal.Length Petal.Width Sepal.Length Sepal.Width features #> 1: TRUE TRUE FALSE FALSE Petal.Length,Petal.Width #> 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 FALSE FALSE TRUE 0.46 #> 2: FALSE FALSE FALSE TRUE 0.46 #> 3: TRUE FALSE FALSE FALSE 0.08 #> 4: TRUE TRUE FALSE FALSE 0.04 #> 5: TRUE FALSE FALSE TRUE 0.08 #> 6: FALSE TRUE TRUE FALSE 0.04 #> 7: TRUE TRUE TRUE TRUE 0.04 #> 8: TRUE TRUE TRUE TRUE 0.04 #> 9: FALSE TRUE FALSE TRUE 0.04 #> 10: TRUE TRUE TRUE TRUE 0.04 #> uhash timestamp batch_nr #> 1: 6384cfa2-9094-4b4b-bb18-6b12e73bd9e2 2021-03-21 04:30:41 1 #> 2: 2e971f2d-cfb7-4ae9-8fd6-db8f1a1f8f9f 2021-03-21 04:30:41 1 #> 3: b37e5052-fd47-4f3c-bf8e-594e62b4eaf6 2021-03-21 04:30:41 1 #> 4: 41991a04-22dc-46a5-b02e-5e99820b5db7 2021-03-21 04:30:41 1 #> 5: d09e6421-c034-4780-9588-cb8aade82e31 2021-03-21 04:30:41 1 #> 6: d758b295-6241-4c9e-a232-0f6e64159ffc 2021-03-21 04:30:41 1 #> 7: 0d560f8b-79ea-41c8-a98d-b79b1a22718b 2021-03-21 04:30:41 1 #> 8: 9aa78744-2ceb-4006-bc24-23885d7ad33f 2021-03-21 04:30:41 1 #> 9: 4079becc-1f19-4c07-a8a1-652e7a1a4866 2021-03-21 04:30:41 1 #> 10: d7f12ede-ffad-4157-8402-23a0a2e53ad7 2021-03-21 04:30:41 1