Abstract
Bayesian Optimization (BO) methods are useful for optimizing functions that are expensive to evaluate, lack an analytical expression, and whose evaluations can be contaminated by noise. These methods rely on a probabilistic model of the objective function, typically a Gaussian process (GP), upon which an acquisition function is built. GPs assume continuous input variables. When this is not the case—for example, when some input variables take categorical or integer values—one must introduce extra approximations. Common approaches, such as rounding to the closest integer or using one-hot encoding before evaluation, can lead to optimization failures. We describe a more principled approach to account for categorical or integer-valued variables by embedding the transformation logic directly into the GP kernel. We illustrate the utility of our approach in both synthetic and real experiments, showing significant improvements over standard BO methods.
Introduction
Bayesian Optimization (BO) is the gold standard for tuning expensive "black-box" functions, such as the hyperparameters of deep neural networks. However, most BO frameworks rely on Gaussian Processes (GPs), which are mathematically designed for continuous, smooth landscapes. When integer variables (e.g., "number of layers") or categorical choices (e.g., "activation function") are introduced, standard GP modeling breaks down. This paper introduces an elegant kernel transformation that allows GPs to natively understand discrete and categorical variables, preventing the optimizer from getting stuck and significantly speeding up the search for the global optimum.
The Mismatch Problem
Standard Bayesian Optimization assumes the search space is a continuous real line. In practice, many variables are discrete:
- Integer Variables: You cannot have 2.4 hidden layers; it must be 2 or 3.
- Categorical Variables: Choosing between "ReLU" and "Tanh" is a choice between distinct labels, not a numerical distance.
The common "naive" fix is to let the optimizer pick a real number (e.g., 2.6) and then round it to the nearest integer (3) before evaluation. This creates a mismatch: the optimizer thinks it is evaluating 2.6, but the data it receives is for 3. This often causes the optimizer to get "stuck," repeatedly suggesting points that round to the same value without realizing it has already explored that "bin." Even if rounding occurs inside the objective function (the "Basic" approach), a standard GP tries to fit a smooth curve to a "staircase" function, leading to poor uncertainty estimates.
Methodology: Kernel Transformation
The core innovation is a Kernel Transformation. Instead of using a standard covariance function $k(x, x')$, the authors propose: $$k'(x, x') = k(T(x), T(x'))$$ Where $T(x)$ is a transformation function that:
- For Integers: Rounds the continuous input to the nearest integer.
- For Categorical Variables: Maps the continuous vector to the nearest valid "one-hot" configuration (setting the largest value to 1 and others to 0).
By applying $T(x)$ inside the kernel, any two points that round to the same integer have a distance of zero. This forces the GP to treat that entire "bin" as having the exact same value and—crucially—zero uncertainty once a single point in that bin has been sampled.
Key Insights and Ideas
The primary advantage of this approach is how it handles uncertainty. In standard BO, the model remains slightly uncertain about the area around a sampled integer. In the proposed method, the uncertainty for the entire integer "step" drops to zero immediately. This forces the acquisition function to look elsewhere, effectively automating the jump to the next discrete possibility.
Furthermore, while methods like SMAC use Random Forests (which handle discrete data naturally), the authors show that GPs with this transformation perform better because they model continuous dimensions (like learning rate) more accurately than tree-based methods.
Experimental Results
The authors evaluated their approach on synthetic functions and real-world machine learning tasks:
- Synthetic Functions: In 2D and 4D tests, the proposed method reached the optimum significantly faster than the Naive and Basic approaches.
- Gradient Boosting: Tuning learning rate, max depth, and min samples for tree ensembles.
- Deep Neural Networks: Tuning learning rate, activation functions, and hidden layers on MNIST.
The proposed GP approach generally outperformed the Tree-structured Parzen Estimator (TPE) and Sequential Model-based Algorithm Configuration (SMAC), particularly as dimensionality increased. On the MNIST task, it found better configurations with fewer evaluations, demonstrating that the "model bias" introduced by the transformation is a beneficial feature.
Conclusion and Future Work
By moving the rounding logic from the wrapper into the kernel, the model finally "knows" the world is discrete. While GPs scale cubically $O(N^3)$, making them less practical for thousands of evaluations than Random Forests, they offer superior performance in the low-to-medium evaluation regime common in hyperparameter tuning. Future work may explore scaling this approach to high-cardinality categorical variables where one-hot encoding significantly increases dimensionality.
Summary updated