SMAC-PushGP-GECCO-2017
A paper for EuroGP-2017 on using SMAC with PushGP
view repo
Bayesian optimization has become a successful tool for hyperparameter optimization of machine learning algorithms, such as support vector machines or deep neural networks. Despite its success, for large datasets, training and validating a single configuration often takes hours, days, or even weeks, which limits the achievable performance. To accelerate hyperparameter optimization, we propose a generative model for the validation error as a function of training set size, which is learned during the optimization process and allows exploration of preliminary configurations on small subsets, by extrapolating to the full dataset. We construct a Bayesian optimization procedure, dubbed Fabolas, which models loss and training time as a function of dataset size and automatically trades off high information gain about the global optimum against computational cost. Experiments optimizing support vector machines and deep neural networks show that Fabolas often finds high-quality solutions 10 to 100 times faster than other state-of-the-art Bayesian optimization methods or the recently proposed bandit strategy Hyperband.
READ FULL TEXT VIEW PDF
Modern deep learning methods are very sensitive to many hyperparameters,...
read it
Automatically searching for optimal hyperparameter configurations is of
...
read it
In this paper, we propose the use of a black-box optimization method cal...
read it
It is held as a truism that deep neural networks require large datasets ...
read it
Bayesian optimization is popular for optimizing time-consuming black-box...
read it
Performance of machine learning algorithms depends critically on identif...
read it
Bayesian optimization has become a standard technique for hyperparameter...
read it
A paper for EuroGP-2017 on using SMAC with PushGP
The performance of many machine learning algorithms hinges on certain hyperparameters. For example, the prediction error of non-linear support vector machines depends on regularization and kernel hyperparameters and ; and modern neural networks are sensitive to a wide range of hyperparameters, including learning rates, momentum terms, number of units per layer, dropout rates, weight decay, etc. (Montavon et al., 2012). The poor scaling of naïve methods like grid search with dimensionality has driven interest in more sophisticated hyperparameter optimization methods over the past years (Bergstra et al., 2011; Hutter et al., 2011; Bergstra and Bengio, 2012; Snoek et al., 2012; Bardenet et al., 2013; Bergstra et al., 2013; Swersky et al., 2013, 2014; Snoek et al., ; Snoek et al., 2015). Bayesian optimization has emerged as an efficient framework, achieving impressive successes. For example, in several studies, it found better instantiations of convolutional network hyperparameters than domain experts, repeatedly improving the top score on the CIFAR-10 (Krizhevsky, 2009) benchmark without data augmentation (Snoek et al., 2012; Domhan et al., 2015; Snoek et al., 2015).
In the traditional setting of Bayesian hyperparameter optimization, the loss of a machine learning algorithm with hyperparameters is treated as the “black-box” problem of finding , where the only mode of interaction with the objective is to evaluate it for inputs . If individual evaluations of on the entire dataset require days or weeks, only very few evaluations are possible, limiting the quality of the best found value. Human experts instead often study performance on subsets of the data first, to become familiar with its characteristics before gradually increasing the subset size (Bottou, 2012; Montavon et al., 2012). This approach can still outperform contemporary Bayesian optimization methods.
Motivated by the experts’ strategy, here we leverage dataset size as an additional degree of freedom enriching the representation of the optimization problem. We treat the size of a randomly subsampled dataset
as an additional input to the blackbox function, and allow the optimizer to actively choose it at each function evaluation. This allows Bayesian optimization to mimic and improve upon human experts when exploring the hyperparameter space. In the end, is not a hyperparameter itself, but the goal remains a good performance on the full dataset, i.e. .Hyperparameter optimization for large datasets has been explored by other authors before. Our approach is similar to Multi-Task Bayesian optimization by Swersky et al. (2013), where knowledge is transferred between a finite number of correlated tasks. If these tasks represent manually-chosen subset-sizes, this method also tries to find the best configuration for the full dataset by evaluating smaller, cheaper subsets. However, the discrete nature of tasks in that approach requires evaluations on the entire dataset to learn the necessary correlations. Instead, our approach exploits the regularity of performance across dataset size, enabling generalization to the full dataset without evaluating it directly.
Other approaches for hyperparameter optimization on large datasets include work by Nickson et al. (2014)
, who estimated a configuration’s performance on a large dataset by evaluating several training runs on small, random subsets of fixed, manually-chosen sizes.
Krueger et al. (2015) showed that, in practical applications, small subsets can suffice to estimate a configuration’s quality, and proposed a cross-validation scheme that sequentially tests a fixed set of configurations on a growing subset of the data, discarding poorly-performing configurations early.In parallel work^{1}^{1}1Hyperband was first described in a 2016 arXiv paper (Li et al., 2016), and Fabolas was first described in a 2015 NIPS workshop paper (Klein et al., ), Li et al. (2017) proposed a multi-arm bandit strategy, called Hyperband, which dynamically allocates more and more resources to randomly sampled configurations based on their performance on subsets of the data. Hyperband assures that only well-performing configurations are trained on the full dataset while discarding bad ones early. Despite its simplicity, in their experiments the method was able to outperform well-established Bayesian optimization algorithms.
In §2, we review Bayesian optimization, in particular the Entropy Search algorithm and the related method of Multi-Task Bayesian optimization. In §3, we introduce our new Bayesian optimization method Fabolas for hyperparameter optimization on large datasets. In each iteration, Fabolas chooses the configuration and dataset size predicted to yield most information about the loss-minimizing configuration on the full dataset per unit time spent. In §4, a broad range of experiments with support vector machines and various deep neural networks show Fabolas often identifies good hyperparameter settings 10 to 100 times faster than state-of-the-art Bayesian optimization methods acting on the full dataset as well as Hyperband.
Given a black-box function , Bayesian optimization^{2}^{2}2Comprehensive tutorials are presented by Brochu et al. (2010) and Shahriari et al. (2016). aims to find an input that globally minimizes . It requires a prior over the function and an acquisition function quantifying the utility of an evaluation at any . With these ingredients, the following three steps are iterated (Brochu et al., 2010): (1) find the most promising by numerical optimization; (2) evaluate the expensive and often noisy function and add the resulting data point to the set of observations ; and (3) update and . Typically, evaluations of the acquisition function are cheap compared to evaluations of such that the optimization effort is negligible.
Gaussian processes (GP) are a prominent choice for , thanks to their descriptive power and analytic tractability (e.g. Rasmussen and Williams, 2006)
. Formally, a GP is a collection of random variables, such that every finite subset of them follows a multivariate normal distribution. A GP is identified by a mean function
(often set to ), and a positive definite covariance function (kernel) . Given observations with joint Gaussian likelihood , the posterior follows another GP, with mean and covariance functions of tractable, analytic form.The covariance function determines how observations influence the prediction. For the hyperparameters we wish to optimize, we adopt the Matérn kernel (Matérn, 1960), in its Automatic Relevance Determination form (MacKay and Neal, 1994). This stationary, twice-differentiable model constitutes a relatively standard choice in the Bayesian optimization literature. In contrast to the Gaussian kernel popular elsewhere, it makes less restrictive smoothness assumptions, which can be helpful in the optimization setting (Snoek et al., 2012):
(1) |
Here, and are free parameters—hyperparameters of the GP surrogate model—and is the Mahalanobis distance. For the dataset size dependent performance and cost, we construct a custom kernel in 3.1. An additional hyperparameter of the GP model is a overall noise covariance needed to handle noisy observations. For clarity: These GP hyperparameters are internal hyperparameters of the Bayesian optimizer, as opposed to those of the target machine learning algorithm to be tuned. Section 3.4 shows how we handle them.
The role of the acquisition function is to trade off exploration vs. exploitation. Popular choices include Expected Improvement (EI) (Mockus et al., 1978), Upper Confidence Bound (UCB) (Srinivas et al., 2010), Entropy Search (ES) (Hennig and Schuler, 2012), and Predictive Entropy Search (PES) (Hernández-Lobato et al., 2014). In our experiments, we will use EI and ES.
We found EI to perform robustly in most applications, providing a solid baseline; it is defined as
(2) |
where is the best function value known (also called the incumbent
). This expected drop over the best known value is high for points predicted to have small mean and/or large variance.
ES is a more recent acquisition function that selects evaluation points based on the predicted information gain
about the optimum, rather than aiming to evaluate near the optimum. At the heart of ES lies the probability distribution
, the belief about the function’s minimum given the prior on and observations . The information gain atis then measured by the expected Kullback-Leibler divergence (relative entropy) between
and the uniform distribution
, with expectations taken over the measurement to be obtained at :(3) |
The primary numerical challenge in this framework is the computation of and the integral above. Due to the intractability, several approximations have to be made. We refer to Hennig and Schuler (2012) for details, as well as to the supplemental material (Section A), where we also provide pseudocode for our implementation. Despite the conceptual and computational complexity of ES, it offers a well-defined concept for information gained from function evaluations, which can be meaningfully traded off against other quantities, such as the evaluations’ cost.
PES refers to the same acquisition function, but uses different approximations to compute it. In Section 3.4 we describe why, for our application, ES was the more direct choice.
The Multi-Task Bayesian optimization (MTBO) method of Swersky et al. (2013) refers to a general framework for optimizing in the presents of different, but correlated tasks. Given a set of such tasks , the objective function corresponds to evaluating a given on one of the tasks . The relation between points in is modeled via a GP using a product kernel:
(4) |
The kernel is represented implicitly by the Cholesky decomposition of whose entries are sampled via MCMC together with the other hyperparameters of the GP. By considering the distribution over the optimum on the target task , , and computing any information w.r.t. it, Swersky et al. (2013) use the information gain per unit cost as their acquisition function^{3}^{3}3In fact, Swersky et al. (2013) deviated slightly from this formula (which follows the ES approach of Hennig and Schuler (2012)) by considering the difference in information gains in and . They stated this to work better in practice, but we did not find evidence for this in our experiments and thus, for consistency, use the variant presented here throughout.:
(5) |
where . The expectation represents the information gain on the target task averaged over the possible outcomes of based on the current model. If the cost of a configuration on task is not known a priori it can be modelled the same way as the objective function.
This model supports machine learning hyperparameter optimization for large datasets by using discrete dataset sizes as tasks. Swersky et al. (2013) indeed studied this approach for the special case of , representing a small and a large dataset; this will be a baseline in our experiments.
Here, we introduce our new approach for FAst Bayesian Optimization on LArge data Sets (Fabolas). While traditional Bayesian hyperparameter optimizers model the loss of machine learning algorithms on a given dataset as a blackbox function to be minimized, Fabolas models loss and computational cost across dataset size and uses these models to carry out Bayesian optimization with an extra degree of freedom. The blackbox function now takes another input representing the data subset size; we will use relative sizes , with representing the entire dataset. While the eventual goal is to minimize the loss for the entire dataset, evaluating for smaller is usually cheaper, and the function values obtained correlate across . Unfortunately, this correlation structure is initially unknown, so the challenge is to design a strategy that trades off the cost of function evaluations against the benefit of learning about the scaling behavior of and, ultimately, about which configurations work best on the full dataset. Following the nomenclature of Williams et al. (2000), we call an environmental variable that can be changed freely during optimization, but that is set to (i.e., the entire dataset size), at evaluation time.
We propose a principled rule for the automatic selection of the next pair to evaluate. In a nutshell, where standard Bayesian optimization would always run configurations on the full dataset, we use ES to reason about, how much can be learned about performance on the full dataset from an evaluation at any . In doing so, Fabolas automatically determines the amount of data necessary to (usefully) extrapolate to the full dataset.
For an initial intuition on how performance changes with dataset size, we evaluated a grid of configurations of a support vector machine (SVM) on subsets of the MNIST dataset (LeCun et al., 2001) ; MNIST has data points and we evaluated relative subset sizes . Figure 1 visualizes the validation error of these configurations on , , , and . Evidently, just of the dataset is quite representative and sufficient to locate a reasonable configuration. Additionally, there are no deceiving local optima on smaller subsets. Based on these observations, we expect that relatively small fractions of the dataset yield representative performances and therefore vary our relative size parameter on a logarithmic scale.
To transfer the insights from this illustrative example into a formal model for the loss and cost across subset sizes, we extend the GP model by an additional input dimension, namely . This allows the surrogate to extrapolate to the full data set at without necessarily evaluating there. We chose a factorized kernel, consisting of the standard stationary kernel over hyperparameters, multiplied with a finite-rank (“degenerate”) covariance function in :
(6) |
Since any choice of the basis function yields a positive semi-definite covariance function, this provides a flexible language for prior knowledge relating to . We use the same form of kernel to model the loss and cost , respectively, but with different basis functions and .
The loss of a machine learning algorithms usually decreases with more training data. We incorporate this behavior by choosing to enforce monotonic predictions with an extremum at
. This kernel choice is equivalent to Bayesian linear regression with these basis functions and Gaussian priors on the weights.
To model computational cost , we note that the complexity usually grows with relative dataset size . To fit polynomial complexity for arbitrary and simultaneously enforce positive predictions, we model the log-cost and use . As above, this amounts to Bayesian linear regression with shown basis functions.
In the supplemental material (Section B), we visualize scaling of loss and cost with
for the SVM example above and show that our kernels indeed fit them well. We also evaluate the possibility of modelling the heteroscedastic noise introduced by subsampling the data (supplementary material, Section C).
Fabolas starts with an initial design, described in more detail in Section 3.3. Afterwards, at the beginning of each iteration it fits GPs for loss and computational cost across dataset sizes using the kernel from Eq. 6. Then, capturing the distribution of the optimum for using , it selects the maximizer of the following acquisition function to trade off information gain versus cost:
(7) | ||||
Algorithm 1 shows pseudocode for Fabolas. We also provide an open-source implementation at https://github.com/automl/RoBO.
Our proposed acquisition function resembles the one used by MTBO (Eq. 2.3), with two differences: First, MTBO’s discrete tasks are replaced by a continuous dataset size (allowing to learn correlations without evaluations at , and to choose the appropriate subset size automatically). Second, the prediction of computational cost is augmented by the overhead of the Bayesian optimization method. This inclusion of the reasoning overhead is important to appropriately reflect the information gain per unit time spent: it does not matter whether the time is spent with a function evaluation or with reasoning about which evaluation to perform. In practice, due to cubic scaling in the number of data points of GPs and the computational complexity of approximating , the additional overhead of Fabolas is within the order of minutes, such that differences in computational cost in the order of seconds become negligible in comparison.^{4}^{4}4The same is true for standard ES and MTBO, but was never exploited as no emphasis was put on the total wall clock time spent for the hyperparameter optimization. We want to emphasize that we express budgets in terms of wall clock time (not function evaluations) since this is natural in most practical applications.
Being an anytime algorithm, Fabolas keeps track of its incumbent at each time step. To select a configuration that performs well on the full dataset, it predicts the loss of all evaluated configurations at using the GP model and picks the minimizer. We found this to work more robustly than globally minimizing the posterior mean, or similar approaches.
It is common in Bayesian optimization to start with an initial design of points chosen at random or from a Latin hypercube design to allow for reasonable GP models as starting points. To fully leverage the speedups we can obtain from evaluating small datasets, we bias this selection towards points with small (cheap) datasets in order to improve the prediction for dependencies on : We draw random points in ( in our experiments) and evaluate them on different subsets of the data (for instance on the support vector machine experiments we used ). This provides information on scaling behavior, and, assuming that costs increase linearly or superlinearly with , these function evaluations cost less than function evaluations on the full dataset. This is important as the cost of the initial design, of course, counts towards Fabolas’ runtime.
The presentation of Fabolas above omits some details that impact the performance of our method. As it has become standard in Bayesian optimization (Snoek et al., 2012)
, we use Markov-Chain Monte Carlo (MCMC) integration to marginalize over the GPs hyperparameters (we use the emcee package
(Foreman-Mackey et al., 2013)). To accelerate the optimization, we use hyper-priors to emphasize meaningful values for the parameters, chiefly adopting the choices of the spearmint toolbox (Snoek et al., 2012): a uniform prior between for all length scales in log space, a lognormal prior (, ) for the covariance amplitude , and a horseshoe prior with length scale of for the noise variance .We used the original formulation of ES by Hennig and Schuler (2012) rather than the recent reformulation of PES by Hernández-Lobato et al. (2014). The main reason for this is that the latter prohibits non-stationary kernels due to its use of Bochner’s theorem for a spectral approximation. PES could in principle be extended to work for our particular choice of kernels (using an Eigen-expansion, from which we could sample features); since this would complicate making modifications to our kernel, we leave it as an avenue for future work, but note that in any case it may only further improve our method. To maximize the acquisition function we used the blackbox optimizer DIRECT (Jones, 2001) and CMAES (Hansen, 2006).
For our empirical evaluation of Fabolas, we compared it to standard Bayesian optimization (using EI and ES as acquisition functions), MTBO, and Hyperband. For each method, we tracked wall clock time (counting both optimization overhead and the cost of function evaluations, including the initial design), storing the incumbent returned after every iteration. In an offline validation step, we then trained models with all incumbents on the full dataset and measured their test error. We plot these test errors throughout.^{5}^{5}5The residual network in Section 4.4 is an exception: here, we trained networks with the incumbents on the full training set (50000 data points, augmented to 100000 as in the original code) and then measured and plotted performance on the validation set. To obtain error bars, we performed 10 independent runs of each method with different seeds (except on the grid experiment, where we could afford 30 runs per method) and plot medians, along with and percentiles for all experiments. Details on the hyperparameter ranges used in every experiment are given in the supplemental material (Section D).
We implemented Hyperband following Li et al. (2017) using the recommended setting for the parameter that controls the intermediate subset sizes. For each experiment, we adjusted the budget allocated to each Hyperband iteration to allow the same minimum dataset size as for Fabolas: 10 times the number of classes for the support vector machine benchmarks and the maximum batch size for the neural network benchmarks. We also followed the prescribed incumbent estimation after each iteration as the configuration with the best performance on the full dataset size.
First, we considered a benchmark allowing the comparison of the various Bayesian optimization methods on ground truth: our SVM grid on MNIST (described in Section 3), for which we had performed all function evaluations beforehand, measuring loss and cost 10 times for each configuration and subset size to account for performance variations. (In this case, we computed each method’s wall clock time in each iteration as its summed optimization overheads so far, plus the summed costs for the function values it queried so far.)
MTBO requires choosing the number of data points in its auxiliary task. Figure 2 (middle) evaluates MTBO variants with a single auxiliary task with a relative size of , , and , respectively. With auxiliary tasks at either or , MTBO improved quickly, but converged more slowly to the optimum; we believe small correlations between the tasks cause this. Figure 2 (right) shows the dataset sizes chosen by the different algorithms during the optimization; all methods slowly increased the average subset size used over time. An auxiliary task with worked best and we used this for MTBO in the remaining experiments.
At first glance, one might expect many tasks (e.g., with a task for each ) to work best, but quite the opposite is true. In preliminary experiments, we evaluated MTBO with up to 3 auxiliary tasks (, , and ), but found performance to strongly degrade with a growing number of tasks. We suspect that the kernel parameters that have to be learned for the discrete task kernel for tasks are the main reason. If the MCMC sampling is too short, the correlations are not appropriately reflected, especially in early iterations, and an adjusted sampling creates a large computational overhead that dominates wall-clock time. We therefore obtained best performance with only one auxiliary task.
Figure 2 (left) shows results using EI, ES, random search, MTBO and fabolas on this SVM benchmark. EI and ES perform equally well and find the best configuration (which yields an error of , or ) after around seconds, roughly five times faster than random search. MTBO achieves good performance faster, requiring only around seconds to find the global optimum. Fabolas is roughly another order of magnitude faster than MTBO in finding good configurations, and finds the global optimum at the same time.
Test performance of a convolutional neural network on CIFAR10 (left) and SVHN (right).
For a more realistic scenario, we optimized the same SVM hyperparameters without a grid constraint on MNIST and two other prominent UCI datasets (gathered from OpenML (Vanschoren et al., 2014)), vehicle registration (Siebert, 1987) and forest cover types (Blackard and Dean, 1999) with more than 50000 data points, now also comparing to Hyperband. Training SVMs on these datasets can take several hours, and Figure 3 shows that Fabolas found good configurations for them between 10 and 1000 times faster than the other methods.
Hyperband required a relatively long time until it recommended its first hyperparameter setting, but this first recommendation was already very good, making Hyperband substantially faster to find good settings than standard Bayesian optimization running on the full dataset. However, Fabolas typically returned configurations with the same quality another order of magnitude faster.
Convolutional neural networks (CNNs) have shown superior performance on a variety of computer vision and speech recognition benchmarks, but finding good hyperparameter settings remains challenging, and almost no theoretical guarantees exist. Tuning CNNs for modern, large datasets is often infeasible via standard Bayesian optimization; in fact, this motivated the development of
Fabolas.We experimented with hyperparameter optimization for CNNs on two well-established object recognition datasets, namely CIFAR10 (Krizhevsky, 2009) and SVHN (Netzer et al., 2011)
. We used the same setup for both datasets (a CNN with three convolutional layers, with batch normalization
(Ioffe and Szegedy, 2015) in each layer, optimized using Adam (Kingma and Ba, 2014)). We considered a total of five hyperparameters: the initial learning rate, the batch size and the number of units in each layer. For CIFAR10, we used 40000 images for training, 10000 to estimate validation error, and the standard 10000 hold-out images to estimate the final test performance of incumbents. For SVHN, we used 6000 of the 73257 training images to estimate validation error, the rest for training, and the standard 26032 images for testing.The results in Figure 4 show that—compared to the SVM tasks—Fabolas’ speedup was smaller because CNNs scale linearly in the number of datapoints. Nevertheless, it found good configurations about 10 times faster than vanilla Bayesian optimization. For the same reason of linear scaling, Hyperband was substantially slower than vanilla Bayesian optimization to make a recommendation, but it did find good hyperparameter settings when given enough time.
In the final experiment, we evaluated the performance of our method further on a more expensive benchmark, optimizing the validation performance of a deep residual network on the CIFAR10 dataset, using the original architecture from He et al. (2015). As hyperparameters we exposed the learning rate, regularization, momentum and the factor by which the learning rate is multiplied after and epochs.
Figure 5 shows that Fabolas found configurations with reasonable performance roughly 10 times faster than ES and MTBO. Note that due to limited computational capacities, we were unable to run Hyperband on this benchmark: a single iteration took longer than a day, making it prohibitively expensive. (Also note that by that time all other methods had already found good hyperparameter settings.) We want to emphasize that the runtime could be improved by adapting Hyperband’s parameters to the benchmark, but we decided to keep all methods’ parameters fixed throughout the experiments to also show their robustness.
We presented Fabolas, a new Bayesian optimization method based on entropy search that mimics human experts in evaluating algorithms on subsets of the data to quickly gather information about good hyperparameter settings. Fabolas extends the standard way of modelling the objective function by treating the dataset size as an additional continuous input variable. This allows the incorporation of strong prior information. It models the time it takes to evaluate a configuration and aims to evaluate points that yield—per time spent—the most information about the globally best hyperparameters for the full dataset. In various hyperparameter optimization experiments using support vector machines and deep neural networks, Fabolas often found good configurations 10 to 100 times faster than the related approach of Multi-Task Bayesian optimization, Hyperband and standard Bayesian optimization. Our open-source code is available at https://github.com/automl/RoBO, along with scripts for reproducing our experiments.
In future work, we plan to expand our algorithm to model other environmental variables, such as the resolution size of images, the number of classes, and the number of epochs, and we expect this to yield additional speedups. Since our method reduces the cost of individual function evaluations but requires more of these cheaper evaluations, we expect the cubic complexity of Gaussian processes to become the limiting factor in many practical applications. We therefore plan to extend this work to other model classes, such as Bayesian neural networks (Neal, 1996; Hernández-Lobato and Adams, 2015; Blundell et al., 2015; Springenberg et al., 2016; Klein et al., 2017), which may lower the computational overhead while having similar predictive quality.
A tutorial on Bayesian optimization of expensive cost functions, with application to active user modeling and hierarchical reinforcement learning.
CoRR, 2010.Towards a new evolutionary computation. Advances on estimation of distribution algorithms
. Springer, 2006.NIPS Workshop on Deep Learning and Unsupervised Feature Learning 2011
, 2011.Probabilistic backpropagation for scalable learning of Bayesian neural networks.
In Proc. of ICML’15, 2015.
Comments
There are no comments yet.