Subspace task definition
TaskSubspace.RdR6 class for defining hyperparameter optimization tasks. Encapsulates benchmark data with hyperparameter configurations and performance measures, providing a standardized interface for subspace learners.
Details
Overview:
A subspace task combines:
Benchmark data with hyperparameter configurations and performance measures
Specification of which columns are hyperparameters (continuous and categorical)
Target performance measure to optimize
Data Requirements:
The input data.table must contain:
A
taskcolumn identifying different tasks/datasetsA target measure column (e.g., "auc", "accuracy", "rmse")
One or more numeric hyperparameter columns
Optionally, one categorical hyperparameter column
Initialization Modes:
Mode 1: Explicit specification
task <- TaskSubspace$new(
data = benchmark_data,
target_measure = "accuracy",
hps = c("learning_rate", "max_depth"),
cat_hps = "optimizer"
)Mode 2: Formula interface
task <- TaskSubspace$new(
data = benchmark_data,
formula = accuracy ~ (learning_rate + max_depth) * optimizer
)The formula syntax is: target ~ (hp1 + hp2 + ...) * cat_hp
Left-hand side: target measure
Right-hand side before
*: continuous hyperparametersRight-hand side after
*: categorical hyperparameter (optional)
Categorical Hyperparameters:
Currently supports at most one categorical hyperparameter. When specified, learners will fit separate subspaces for each categorical level.
See also
LearnerSubspace for the base learner class.
LearnerSubspaceBox for axis-aligned hyperrectangles.
LearnerSubspacePolygon for oriented hyperrectangles.
LearnerSubspaceEllipsoid for ellipsoids.
Public fields
dataA
data.tablecontaining hyperparameter configurations, performance measures, and task identifiers. Must have ataskcolumn.target_measureCharacter string specifying the performance measure column name (e.g., "auc", "accuracy", "rmse")
hpsCharacter vector of continuous hyperparameter column names
cat_hpsCharacter string specifying the categorical hyperparameter column name (optional, currently limited to one)
Methods
Method new()
Create a new task instance
Usage
TaskSubspace$new(
data,
formula = NULL,
target_measure = NULL,
hps = NULL,
cat_hps = NULL
)Examples
if (FALSE) { # \dontrun{
# Explicit specification
task <- TaskSubspace$new(
data = benchmark_data,
target_measure = "auc",
hps = c("learning_rate", "max_depth", "min_samples_split")
)
# With categorical hyperparameter
task <- TaskSubspace$new(
data = benchmark_data,
target_measure = "accuracy",
hps = c("learning_rate", "max_depth"),
cat_hps = "optimizer"
)
# Formula interface
task <- TaskSubspace$new(
data = benchmark_data,
formula = auc ~ (learning_rate + max_depth) * optimizer
)
# Use with learner
learner <- LearnerSubspaceBox$new(task)
learner$train(q_val = 0.9)
} # }