Abstract
Define parameter spaces, constraints and dependencies for arbitrary algorithms, to program on such spaces. Also includes statistical designs and random samplers. Objects are implemented as 'R6' classes.
Introduction
Modern machine learning algorithms often involve a vast array of hyperparameters with complex, non-linear relationships. Standard data structures in R, such as lists or data frames, frequently fall short when attempting to describe these spaces programmatically. Without a formal system, researchers are forced to implement brittle, manual validation checks. The paradox package addresses this by providing a declarative, object-oriented framework (using R6 classes) to define, manipulate, and sample from complex parameter spaces.
Methods and Architecture
The package architecture is built around the R6 object-oriented system, ensuring that parameter sets are mutable and efficient. The system is composed of several key components:
Domains and ParamSets
Domains are the fundamental building blocks for individual dimensions, with specific functions for different types: p_dbl() for real numbers, p_int() for integers, p_fct() for categorical factors, and p_lgl() for logicals. These are grouped into a ParamSet, the core container that handles validation, dependency management, and complex transformations.
As shown in the figure above, ParamSet objects can be configured with specific constraints, such as whether untyped domains are allowed or if the set must be bounded.
Dependency Management and Conditions
One of the most powerful features of paradox is its ability to handle hierarchical dependencies. For instance, a parameter might only be active if another parameter is set to a specific value. The package provides tools to define these conditions and even pretty-print them for better readability.
Design Generation
paradox integrates statistical design techniques to sample parameter spaces effectively. It supports systematic Grid Designs, Random Sampling via Sampler classes, and Space-Filling Designs like Latin Hypercube Sampling (LHS) and Sobol sequences. These methods are essential for high-dimensional optimization where simple random sampling is inefficient.
Key Insights and Features
- Decoupling Definition from Logic: By separating the parameter space definition from the algorithm's logic,
paradoxenables "meta-programming." Optimizers can be written to work on anyParamSetwithout knowledge of the underlying algorithm. - Native Transformation Support: The package handles non-linear scales (like log-scales) internally. Users can define a domain with
logscale = TRUE, and the package ensures that optimizers see a linear space while the algorithm receives correctly scaled values. - Data.table Integration: To maintain performance when generating millions of configurations, all design outputs are returned as
data.tableobjects, optimizing both memory footprint and processing speed. - Type Safety: The framework provides rigorous assertions for parameter values, ensuring that only valid configurations are passed to downstream algorithms.
Conclusion and Future Work
paradox serves as a critical foundational tool within the mlr3 ecosystem, providing the infrastructure to define hyperparameter spaces for hundreds of learners. While it currently excels at handling "if-then" dependencies, future work may expand into more complex, multi-level constraint satisfaction problems. Currently, the package focuses on defining and sampling spaces, while actual tuning logic is delegated to sister packages like bbotk or mlr3tuning.
Summary updated