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 #> x_domain classif.ce #> 1: <list[4]> 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 #> x_domain classif.ce #> 1: <list[4]> 0.04
# Allows access of data.table of full path of all evaluations instance$archive$data()# }
#> 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 x_domain timestamp batch_nr #> 1: e38c191b-1723-4c95-90ef-1ec22780b6ca <list[4]> 2020-10-31 04:26:25 1 #> 2: cd1320c9-1e5f-42a2-86a8-fcd20774f1e1 <list[4]> 2020-10-31 04:26:25 1 #> 3: ae06d9e1-7610-4caa-a4b7-9bf683fc569d <list[4]> 2020-10-31 04:26:25 1 #> 4: 4fff6bcd-125d-4ba8-a8fb-1a63039d03e0 <list[4]> 2020-10-31 04:26:25 1 #> 5: 01f662bd-c97d-45a2-8696-9f6e23ae83c8 <list[4]> 2020-10-31 04:26:25 1 #> 6: f42842d6-7f7a-47b3-b388-8e195c3569b2 <list[4]> 2020-10-31 04:26:25 1 #> 7: 6cfe268a-4e18-44cf-820b-23bc67816b5e <list[4]> 2020-10-31 04:26:25 1 #> 8: 897cecc3-a980-4251-b56c-d7c37ed7a2c6 <list[4]> 2020-10-31 04:26:25 1 #> 9: 48a27715-6770-4ad4-8a34-4358c2b20c1e <list[4]> 2020-10-31 04:26:25 1 #> 10: 8406e219-2663-415d-9433-295cbec8f520 <list[4]> 2020-10-31 04:26:25 1