<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kaito Baba on Medium]]></title>
        <description><![CDATA[Stories by Kaito Baba on Medium]]></description>
        <link>https://medium.com/@kAIto47802?source=rss-fecf9529c62f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dlViAyw51Ms34j3i0xWXxA.jpeg</url>
            <title>Stories by Kaito Baba on Medium</title>
            <link>https://medium.com/@kAIto47802?source=rss-fecf9529c62f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 16:18:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kAIto47802/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[[Optuna v5 & Rustuna] PED-ANOVA Is Now the Default Hyperparameter Importance Evaluator]]></title>
            <link>https://medium.com/optuna/optuna-v5-rustuna-ped-anova-is-now-the-default-hyperparameter-importance-evaluator-9016dd7be03f?source=rss-fecf9529c62f------2</link>
            <guid isPermaLink="false">https://medium.com/p/9016dd7be03f</guid>
            <category><![CDATA[optuna]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[automl]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Kaito Baba]]></dc:creator>
            <pubDate>Wed, 14 Oct 2026 04:51:39 GMT</pubDate>
            <atom:updated>2026-10-14T04:51:39.739Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>This article introduces <a href="https://optuna.readthedocs.io/en/latest/reference/generated/optuna.importance.PedAnovaImportanceEvaluator.html">PedAnovaImportanceEvaluator</a> the new default hyperparameter importance evaluator in Optuna v5 and Rustuna.</p><p>Hyperparameter importance (HPI) quantifies how strongly each hyperparameter influences the observed objective values and plays an important role in hyperparameter optimization. HPI helps interpret optimization results, identify important design choices, detect irrelevant or redundant hyperparameters, and guide subsequent search or manual tuning.</p><p>While Optuna previously used f-ANOVA [2] as its default HPI evaluator, PED-ANOVA [4] becomes the new default in Optuna v5, offering several practical advantages:</p><ul><li>it is substantially faster than f-ANOVA;</li><li>requires no additional dependencies beyond Optuna’s minimal installation; and</li><li>can support conditional search spaces as well as multi-objective optimization.</li></ul><p>In particular, support for conditional search spaces is enabled by a new method we developed, which was accepted at KDD 2026, one of the top conferences in the machine learning and data mining field. For more details, please see our paper [1]:</p><ul><li><a href="https://arxiv.org/abs/2601.20800">Conditional PED-ANOVA: Hyperparameter Importance in Hierarchical &amp; Dynamic Search Spaces</a></li></ul><h3>How to Use PED-ANOVA in Optuna &amp; Rustuna</h3><h4>Basic Usage</h4><p>PED-ANOVA can be used with Optuna or Rustuna without any additional installation:</p><pre># Using Optuna:<br>uv add &quot;optuna&gt;=5.0.0&quot;<br><br># Using Rustuna:<br>uv add &quot;rustuna&gt;=0.1.0&quot;<br><br># If you use pip:<br>pip install &quot;optuna&gt;=5.0.0&quot;<br># or<br>pip install &quot;rustuna&gt;=0.1.0&quot;</pre><p>Once the installation is done, you can easily use PED-ANOVA by passing a study containing completed trials to optuna.importance.get_param_importances:</p><pre>import optuna<br># If you use Rustuna:<br># import rustuna as optuna<br><br><br>def objective(trial: optuna.Trial) -&gt; float:<br>    x = trial.suggest_float(&quot;x&quot;, -5.0, 5.0)<br>    y = trial.suggest_float(&quot;y&quot;, -1.0, 1.0)<br>    return x**2 + y**2<br><br>sampler = optuna.samplers.RandomSampler(seed=42)<br>study = optuna.create_study(sampler=sampler, direction=&quot;minimize&quot;)<br>study.optimize(objective, n_trials=100)<br><br>importance = optuna.importance.get_param_importances(study) # Use PedAnovaImportanceEvaluator as default<br>print(importance) # {&#39;x&#39;: 0.9773158726469768, &#39;y&#39;: 0.022684127353023158}</pre><p>If you are using Optuna, you can also visualize the importance scores with the following code. Note that Plotly or Matplotlib must be installed separately for visualization.</p><pre># Use Plotly<br>fig = optuna.visualization.plot_param_importances(study)<br>fig.show()<br><br># Use Matplotlib<br>import matplotlib.pyplot as plt<br>ax = optuna.visualization.matplotlib.plot_param_importances(study)<br>plt.show()</pre><h4>Interpretation of Importance Scores</h4><p>HPI is defined based on how much each hyperparameter contributes to the variance of the objective values. PedAnovaImportanceEvaluator estimates this importance within a specified performance region using two key arguments, target_quantile and region_quantile. The returned importance indicates how important each hyperparameter is for achieving performance within the top target_quantile fraction, when focusing on the region corresponding to the top region_quantile fraction of the observed performance.</p><pre>evaluator = optuna.importance.PedAnovaImportanceEvaluator(target_quantile=0.1, region_quantile=1.0) # The default settings<br>importance = optuna.importance.get_param_importances(study, evaluator=evaluator)<br>print(importance)</pre><h3>Experimental Results</h3><p>In this section, we present experimental results on a real-world benchmark problem to illustrate how PED-ANOVA behaves in practice. For a more comprehensive empirical analysis of PED-ANOVA’s handling of conditional search spaces, including performance comparisons with baseline methods, please refer to <a href="https://arxiv.org/abs/2601.20800">our paper</a> [1].</p><h4>Experimental Setup</h4><p><strong>Benchmarking Problem.</strong> We use instance 1053 of the rbv2_super scenario from YAHPO Gym [3]. This benchmark represents a model selection problem over six machine learning algorithms: approximate k-NN (aknn), a regularized linear model (glmnet), random forest (ranger), decision tree (rpart), support vector machine (svm), and XGBoost (xgboost). The algorithm is selected by the categorical hyperparameter learner_id, and only the hyperparameters associated with the selected algorithm are active, naturally forming a conditional search space.</p><p><strong>Evaluation Settings.</strong> We use a sample size of 𝑁 = 1000 and maximize the accuracy (acc) as the objective. We use target_quantile = 0.1 and region_quantile = 1.0. We use Python version 3.13.11 and Optuna v5.0.0. Please refer to <a href="https://github.com/kAIto47802/condPED-ANOVA">our GitHub repository</a> for the experimental code.</p><h4>Results and Discussion</h4><p>Figure 1 shows the HPIs estimated by PED-ANOVA. We observe that trainsize and learner_id, as well as several SVM- and XGBoost-related hyperparameters, have relatively large importance scores. This is consistent with the actual objective values, where SVM and XGBoost achieve higher performance than the other learners, suggesting that PED-ANOVA successfully captures the importance of the learner choice.</p><p>We further calculate the correlation between the maximum objective value achieved by each learner and its estimated importance. PED-ANOVA shows the highest correlation among the evaluated methods, outperforming naive extensions of existing HPI approaches to conditional search spaces. Moreover, unlike these baselines, PED-ANOVA does not exhibit unstable behavior such as negative correlations. For further details, please refer to <a href="https://arxiv.org/abs/2601.20800">our paper</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cuIBKbaTP49lLYv_-UVjkw.png" /><figcaption>Figure1: PED-ANOVA on a real-world problem from YAHPO Gym rbv2_super scenario (instance ID 1053). The bars denote the mean, and the error bars denote the standard error, both computed over ten independent runs with different random seeds.</figcaption></figure><p><strong>Runtime Comparison.</strong> Figure 2 compares the runtime of PED-ANOVA in Optuna v5, PED-ANOVA in Rustuna, and f-ANOVA, the previous default evaluator in Optuna, on the same YAHPO Gym benchmark problem. Optuna’s PED-ANOVA is dramatically faster than f-ANOVA, delivering speedups of roughly 180× to 1,600× across the tested trial counts. Rustuna’s PED-ANOVA takes this further, running approximately 2–4× faster than Optuna’s implementation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*N4tnF4N4gGMb8Qhbb9q4sg.png" /><figcaption>Figure 2: Runtime comparison of PED-ANOVA in Optuna v5, PED-ANOVA in Rustuna, and f-ANOVA, the previous default evaluator in Optuna, on the YAHPO Gym rbv2_super scenario (instance ID 1053). The lines denote the mean, and the shaded regions denote the standard error, both computed over five independent runs with different random seeds.</figcaption></figure><h3>Conclusion</h3><p>In this article, we introduced PED-ANOVA, which is now the default HPI evaluator in Optuna v5 and Rustuna. PED-ANOVA enables fast and practical HPI evaluation while supporting conditional search spaces and multi-objective optimization.</p><p>Please give it a try!</p><h3>References</h3><p>[1] Baba, K., Ozaki, Y., and Watanabe, S. Conditional PED-ANOVA: Hyperparameter importance in hierarchical &amp; dynamic search spaces. In Proceedings of the 32nd ACM SIGKDD Conference on Knowledge Discovery and Data Mining V.2, pp. 57–68. Association for Computing Machinery, 2026. ISBN 9798400722592. doi: 10.1145/3770855.3817758.</p><p>[2] Hutter, F., Hoos, H., and Leyton-Brown, K. An efficient approach for assessing hyperparameter importance. In Proceedings of the 31st International Conference on Machine Learning, pp. 754–762. PMLR, 2014.</p><p>[3] Pﬁsterer, F., Schneider, L., Moosbauer, J., Binder, M., and Bischl, B. YAHPO Gym — an eﬃcient multi-objective multi-ﬁdelity benchmark for hyperparameter optimization. In Proceedings of the First International Conference on Automated Machine Learning, volume 188, pp. 3/1–39. PMLR, 2022.</p><p>[4] Watanabe, S., Bansal, A., and Hutter, F. PED-ANOVA: Eﬃciently quantifying hyperparameter importance in arbitrary subspaces. In Proceedings of the 32nd International Joint Conference on Artiﬁcial Intelligence, pp. 4389–4396, 2023.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9016dd7be03f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/optuna/optuna-v5-rustuna-ped-anova-is-now-the-default-hyperparameter-importance-evaluator-9016dd7be03f">[Optuna v5 &amp; Rustuna] PED-ANOVA Is Now the Default Hyperparameter Importance Evaluator</a> was originally published in <a href="https://medium.com/optuna">Optuna</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Optuna v4.5] Constrained Multi-Objective Gaussian Process-Based Sampler (GPSampler)]]></title>
            <link>https://medium.com/optuna/optuna-v4-5-81e78d8e077a?source=rss-fecf9529c62f------2</link>
            <guid isPermaLink="false">https://medium.com/p/81e78d8e077a</guid>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[automl]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Kaito Baba]]></dc:creator>
            <pubDate>Mon, 22 Sep 2025 05:05:03 GMT</pubDate>
            <atom:updated>2025-09-22T05:11:32.928Z</atom:updated>
            <content:encoded><![CDATA[<h3>[Optuna v4.5] Gaussian Process-Based Sampler (GPSampler) Can Now Perform Constrained Multi-Objective Optimization</h3><h3>Introduction</h3><p>This article introduces the constrained multi-objective optimization feature of GPSampler released in Optuna v4.5.</p><p>Gaussian process-based Bayesian optimization (GPBO) has gained popularity in various domains, including materials science and machine learning. <a href="https://medium.com/optuna/introducing-optunas-native-gpsampler-0aa9aa3b4840">The initial release of </a><a href="https://medium.com/optuna/introducing-optunas-native-gpsampler-0aa9aa3b4840">GPSampler</a> aimed to provide a simple and user-friendly implementation of GPBO. While its component customization, such as kernels and acquisition functions, is less flexible than that of BoTorch and Ax (maintained by Meta Platforms, Inc.), GPSampler runs faster with fewer dependencies.</p><p>At the same time, the first version of GPSampler supported only limited problem setups, motivating further development. Optuna v4.2 extended GPSampler to handle inequality constraints, as announced in <a href="https://medium.com/optuna/optuna-v4-2-gaussian-process-based-sampler-can-now-handle-inequality-constraints-a4f68e8ee810">this article</a>. Optuna v4.4 then supported the multi-objective optimization. With the latest release, Optuna v4.5 now supports constrained multi-objective optimization.</p><p>The new feature is useful in many domains, including materials science, machine learning, and drug discovery, where multiple objectives must be balanced under realistic physical or experimental constraints. Our constrained multi-objective GPBO in Optuna v4.5 directly offers this capability, with the potential to accelerate scientific progress across a wide range of domains.</p><p>In this article, we explain its usage, provide a brief technical overview, and present benchmarking results against samplers available in Optuna.</p><h3>How to Use GPSampler in Optuna</h3><p>GPSampler requires additional dependencies on top of optuna:</p><pre>$ pip install optuna==4.5.0<br><br># scipy and torch are also necessary for GPSampler.<br>$ pip install scipy<br>$ pip install torch --index-url https://download.pytorch.org/whl/cpu</pre><p>Once the installation is done, you can easily use GPSampler by passing it to your study:</p><pre>import optuna<br><br><br>def objective(trial: optuna.Trial) -&gt; tuple[float, float]:<br>    x = trial.suggest_float(&quot;x&quot;, -5.0, 5.0)<br>    y = trial.suggest_float(&quot;y&quot;, -5.0, 5.0)<br>    c = x**2 + y**2 - 4.0<br>    trial.set_user_attr(&quot;c&quot;, c)<br>    return x**2 + y**2, (x - 2) ** 2 + (y - 2) ** 2<br><br><br>def constraints(trial: optuna.trial.FrozenTrial) -&gt; tuple[float]:<br>    c = trial.user_attrs[&quot;c&quot;]<br>    return (c,)<br><br><br>sampler = optuna.samplers.GPSampler(constraints_func=constraints)<br>study = optuna.create_study(sampler=sampler, directions=[&quot;minimize&quot;] * 2)<br>study.optimize(objective, n_trials=100)</pre><h3>Multi-Objective Optimization with GPSampler</h3><p>The acquisition function of our implementation is the logarithm of the Expected Hypervolume Improvement (log EHVI), which essentially relies on Eq. (1) of Daulton et al. [1] and Algorithm 2 of Lacour et al [6]. Technical details are available in the following PRs:</p><ul><li><a href="https://github.com/optuna/optuna/pull/6039">#6039</a>: Implement the box decomposition algorithm to speed up the hypervolume improvement calculations.</li><li><a href="https://github.com/optuna/optuna/pull/6052">#6052</a>: Implement the quasi Monte-Carlo-based log EHVI.</li><li><a href="https://github.com/optuna/optuna/pull/6069">#6069</a>: Add support for multi-objective optimization in GPSampler.</li></ul><p>As discussed in <a href="https://github.com/optuna/optuna/pull/6039#issuecomment-2824447737">the PR</a>, the box decomposition algorithm improves the time complexity of log EHVI, resulting in a 6–800 times speedup over the naive approach and making our implementation practical up to four-objective problems. Note that although our implementation mostly aligns with the BoTorch implementation, some details rely on different logic. For further information, please refer to <a href="https://github.com/optuna/optuna/pull/6069#issuecomment-2875949475">this PR</a>.</p><h3>Constrained Multi-Objective Optimization with GPSampler</h3><p>On top of the multi-objective optimization described above, we extend GPSampler to handle inequality constraints following the approaches of J. Gardner et al. [3] and M. Gelbart et al. [4]. In this setting, GP models are employed for both the objective functions and the constraint functions, with correlations between them being ignored. See the following PRs for more details:</p><ul><li><a href="https://github.com/optuna/optuna/pull/6198">#6198</a>: Implement the constrained log EHVI.</li><li><a href="https://github.com/optuna/optuna/pull/6224">#6224</a>: Add support for constrained multi-objective optimization in GPSampler.</li></ul><p>In our implementation, the feasibility of a candidate point is evaluated using the Probability of Improvement (PI). The overall acquisition function is constructed as the product of the EHVI and the feasibility probabilities derived from PI.</p><h3>Performance Benchmarking</h3><p>We conduct benchmarking to see the effectiveness of constrained multi-objective optimization by GPSampler. Specifically, we compare this new feature against: (i) multi-objective GPSampler without constraint handling (hereafter referred to as unconstrained GPSampler) to assess the benefit of incorporating constraints; and (ii) TPESampler and NSGAIISampler in Optuna, that support constrained multi-objective optimization.</p><h4>Benchmarking Setup</h4><p><strong>Benchmarking Problem.</strong> We use the C2-DTLZ2 problem [5], newly added to OptunaHub for constrained multi-objective optimization benchmarking. See <a href="https://hub.optuna.org/benchmarks/dtlz_constrained/">the OptunaHub documentation</a> and <a href="https://github.com/optuna/optunahub-registry/pull/283">the corresponding PR</a> for more details, and refer to the original papers [2, 6] for the detailed definitions of the objective and constraint functions. We set the number of objectives to two and the number of variables to three.</p><p><strong>Implementation Details.</strong> We run each optimization for 300 trials and repeat it five times with different random seeds to evaluate the standard error. Since the C2-DTLZ2 problem is deterministic, i.e., no noise is included in the objective functions, we use deterministic_objective=True for GPSampler. See <a href="https://github.com/optuna/optuna/pull/6224">this PR</a> for the implementation we used.</p><p><strong>Machine Specifications. </strong>The benchmarks are conducted on a computer running Arch Linux with Intel® Core™ i9–14900HX processor (24 cores, 32 threads, up to 5.8GHz) and Python 3.11.0.</p><h3>Results and Discussion</h3><h4>Analysis of Obtained Pareto Fronts and the Effects of Constraint Consideration</h4><p>Figure 1 illustrates the obtained Pareto fronts to highlight the distribution and quality of the solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*enXex5YhrgxULvAAUmeWag.png" /><figcaption>Figure 1. Obtained Pareto fronts for the C2-DTLZ2 problem after 300 trials. The results show that the constrained GPSampler (shown in (a)) effectively reduces wasted evaluations (colored gray) in infeasible regions compared to unconstrained GPSampler (shown in (b)) and TPESampler (shown in (c)), while NSGAIISampler (shown in (d)) remains far from convergence after 300 trials.</figcaption></figure><p><strong>Effectiveness of Constraint Handling in GPSampler</strong></p><p>The C2-DTLZ2 problem directly introduces infeasible regions on the Pareto front to evaluate the algorithm’s ability to handle disconnected Pareto fronts [5]. As a result, while it is possible to obtain Pareto solutions without considering the constraints, such attempts often include wasted evaluations in infeasible regions, making constrained optimization particularly important.</p><p>Comparing the constrained GPSampler (Figure 1(a)) with the unconstrained GPSampler (Figure 1(b)), the former yields fewer infeasible observations (colored gray) between feasible Pareto solutions (colored blue), showing that the constrained one successfully captures the constraints and reduces wasted evaluations.</p><p><strong>Comparison with Other Samplers</strong></p><p>Compared to TPESampler (Figure 1(c)), GPSampler (Figure 1(a)) also generates fewer wasted evaluations in infeasible regions. At the same time, the Pareto front close to where one of the objective values approaches zero is more thoroughly covered by TPESampler. This is because, owing to the nature of GP-based acquisition functions, the optimization tends to oversample near the boundaries, which reduces variance in those regions and makes further exploration of the adjacent Pareto front more difficult.</p><p>Furthermore, as shown in Figure 1(d), NSGAIISampler has not yet converged after 300 trials, with few optimal solutions achieved, highlighting the superior performance of GPSampler.</p><h4>Analysis of Feasible Hypervolume History</h4><p>Figure 2 shows the feasible hypervolume history, enabling us to assess how quickly and effectively each sampler improves performance under the given constraints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b_c5ACquQ4SWQReM-Q2L4A.png" /><figcaption>Figure2. Feasible hypervolume history on <a href="https://hub.optuna.org/benchmarks/dtlz_constrained/">the C2-DTLZ2 problem</a> [5]. The solid lines denote the mean, and the shaded regions denote the standard error, both computed over five independent runs with different random seeds. Constrained GPSampler (blue) achieves faster convergence to higher hypervolume values compared to TPESampler (pink) and NSGAIISampler (yellow), demonstrating the effectiveness of the new feature in reducing evaluation cost.</figcaption></figure><p>As shown in Figure 2, the hypervolume history of GPSampler reaches the final performance of TPESampler with fewer than 50 trials and surpasses NSGAIISampler much earlier, demonstrating its superior sample efficiency. The rapid convergence to the best hypervolume is particularly important for computationally expensive objectives, since reducing function evaluations directly leads to substantial overall time savings.</p><h3>Conclusion</h3><p>We extended GPSampler to support constrained multi-objective optimization in Optuna v4.5. Benchmarks on <a href="https://hub.optuna.org/benchmarks/dtlz_constrained/">the C2-DTLZ2 problem</a> [5] confirmed that the new feature reduces wasted evaluations in infeasible regions and achieves faster convergence in feasible hypervolume compared to TPESampler and NSGAIISampler. This new functionality marked a major step forward for Optuna, making it a strong candidate for black-box optimization of computationally expensive objectives. Please give it a try!</p><h3>References</h3><p>[1] Daulton, S., Balandat, M., and Bakshy, E. Differentiable expected hypervolume improvement for parallel multi-objective Bayesian optimization. In <em>Advances in Neural Information Processing Systems</em>, volume 33, pp. 9851–9864, 2020.</p><p>[2] Deb, K., Thiele, L., Laumanns, M., and Zitzler, E. Scalable test problems for evolutionary multi-objective optimization. In <em>Evolutionary Multi-objective Optimization</em>, pp. 105–145. Springer-Verlag, 2005.</p><p>[3] Gardner, J., Kusner, M., Zhixiang, W., Weinberger, K., and Cunningham, J. Bayesian Optimization with Inequality Constraints. In <em>Proceedings of the 31st International Conference on Machine Learning</em>, volume 32, pp. 937–945. PMLR, 2014.</p><p>[4] Gelbart, M. A., Snoek, J., and Adams, R. P. In <em>Proceedings of the 30th Conference on Uncertainty in Artificial Intelligence,</em> pp. 250–259. AUAI Press, 2014.</p><p>[5] Jain, H., and Deb, K. An Evolutionary Many-Objective Optimization Algorithm Using Reference-Point Based Nondominated Sorting Approach, Part II: Handling Constraints and Extending to an Adaptive Approach. In <em>IEEE Transactions on Evolutionary Computation</em>, 18(4):602–622, 2014.</p><p>[6] Lacour, R., Klamroth, K., and Fonseca, CM. A box decomposition algorithm to compute the hypervolume indicator. <em>Computers &amp; Operations Research</em>, volume 79, pp. 347–360, 2017.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81e78d8e077a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/optuna/optuna-v4-5-81e78d8e077a">[Optuna v4.5] Constrained Multi-Objective Gaussian Process-Based Sampler (GPSampler)</a> was originally published in <a href="https://medium.com/optuna">Optuna</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Optuna v4.2] Gaussian Process-Based Sampler Can Now Handle Inequality Constraints]]></title>
            <link>https://medium.com/optuna/optuna-v4-2-gaussian-process-based-sampler-can-now-handle-inequality-constraints-a4f68e8ee810?source=rss-fecf9529c62f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4f68e8ee810</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Kaito Baba]]></dc:creator>
            <pubDate>Tue, 11 Mar 2025 04:08:21 GMT</pubDate>
            <atom:updated>2025-06-20T01:36:31.216Z</atom:updated>
            <content:encoded><![CDATA[<h3>[Optuna v4.2] Gaussian Process-Based Sampler (GPSampler) Can Now Handle Inequality Constraints</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n0joe-fHCOjwqx5ImI0XYQ.png" /></figure><h3><strong>Introduction</strong></h3><p><a href="https://github.com/optuna/optuna/releases/tag/v4.2.0">Optuna v4.2</a> expands <a href="https://optuna.readthedocs.io/en/stable/reference/samplers/generated/optuna.samplers.GPSampler.html">GPSampler</a> to the constrained optimization and we explain this feature in this article.</p><p>GPSampler is a Gaussian process-based Bayesian optimization sampler introduced in Optuna v3.6. Originally, the only option for Gaussian process-based Bayesian optimization in Optuna was to use the BoTorch integration. Although BoTorch is a very flexible framework that enables researchers to use cutting-edge Gaussian process-based Bayesian optimization algorithms, Optuna Integration needs only a fraction of BoTorch features, having motivated our native Gaussian process-based Bayesian optimization implementation. As mentioned in <a href="https://medium.com/optuna/introducing-optunas-native-gpsampler-0aa9aa3b4840">the article that announced the </a><a href="https://medium.com/optuna/introducing-optunas-native-gpsampler-0aa9aa3b4840">GPSampler release</a>, the native support allowed faster suggest API call compared to BoTorchSampler and fewer dependencies on external libraries, making it easier to install in more environments.</p><p>Meanwhile, GPSampler only supports single-objective optimization at the time and many features are still missing, such as multi-objective optimization, constrained optimization, and batch optimization. Optuna v4.2 supports constrained optimization as a starting point for our further development.</p><p>By using constrained optimization, we can consider constraints along with the objective of interest. For instance, when we deploy a machine learning algorithm, the real-world environment often imposes some limits such as memory capacity and inference time. Our new feature enables users to find high-performance models that satisfy these constraints.</p><h3>How to Use GPSampler in Optuna</h3><p>To enjoy GPSampler, please first install Optuna along with the necessary dependencies:</p><pre>$ pip install optuna==4.2.0<br><br># scipy and torch are also necessary for GPSampler.<br>$ pip install scipy<br>$ pip install torch --index-url https://download.pytorch.org/whl/cpu</pre><p>Once all the dependencies are successfully installed, you can easily use GPSampler by passing its instance to optuna.create_study:</p><pre>import numpy as np<br>import optuna<br><br><br>def objective(trial: optuna.Trial) -&gt; float:<br>    x = trial.suggest_float(&quot;x&quot;, 0.0, 2 * np.pi)<br>    y = trial.suggest_float(&quot;y&quot;, 0.0, 2 * np.pi)<br>    return float(np.sin(x) + y)<br><br><br>sampler = optuna.samplers.GPSampler()<br>study = optuna.create_study(sampler=sampler)<br>study.optimize(objective, n_trials=100)</pre><h3>Constrained Optimization with GPSampler</h3><p>This implementation is based on J. Gardner <em>et al. </em>[1] and M. Gelbart <em>et al. </em>[2]. Here, Gaussian processes are also used for the constraint functions, optimizing the objective function values with the constraints satisfied. Note that constraints increase the sampling time since the Gaussian process is calculated as many as constraint functions. For more information, please refer to this PR:</p><ul><li><a href="https://github.com/optuna/optuna/pull/5715">#5715</a>: Enable GPSampler to support constraint functions.</li></ul><p>We can easily perform constrained optimization with GPSampler by creating a constraint function that returns a tuple of floats and passing it to the constructor of GPSampler. Note that we consider this trial as feasible when all the returned constraint values are less than or equal to zero. The sample code is as follows:</p><pre>import numpy as np<br>import optuna<br><br><br>def objective(trial: optuna.Trial) -&gt; float:<br>    x = trial.suggest_float(&quot;x&quot;, 0.0, 2 * np.pi)<br>    y = trial.suggest_float(&quot;y&quot;, 0.0, 2 * np.pi)<br>    c = float(np.sin(x) * np.sin(y) + 0.95)<br>    trial.set_user_attr(&quot;c&quot;, c)<br>    return float(np.sin(x) + y)<br><br><br>def constraints(trial: optuna.trial.FrozenTrial) -&gt; tuple[float]:<br>    c = trial.user_attrs[&quot;c&quot;]<br>    return (c, )<br><br><br>sampler = optuna.samplers.GPSampler(constraints_func=constraints)<br>study = optuna.create_study(sampler=sampler)<br>study.optimize(objective, n_trials=100)</pre><h3>Benchmarking Results</h3><p>We compared the constrained GPSampler with the following samplers to benchmark the performance:</p><ul><li><a href="https://optuna.readthedocs.io/en/stable/reference/samplers/generated/optuna.samplers.TPESampler.html">TPESampler</a>: the default sampler in Optuna, which also supports constraints</li><li><a href="https://optuna-integration.readthedocs.io/en/stable/reference/generated/optuna_integration.BoTorchSampler.html">BoTorchSampler</a>: the Gaussian processes-based sampler using BoTorch available in <a href="https://optuna-integration.readthedocs.io/en/stable/index.html">optuna-integration</a></li></ul><p>We compared the best objective value of feasible trials for performance benchmarking and the elapsed time at the end of each trial for the runtime benchmarking. The following functions, cf. see Figure 1, were used in our experiments:</p><ul><li>Objective function: sin⁡ <em>x</em> + <em>y</em></li><li>Constraint function: sin⁡ <em>x</em> sin ⁡<em>y</em> ≤ −0.95</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/0*hWtilr8R2plBLQGv" /><figcaption>Figure 1. The landscape of the objective function in our experiments. This figure was taken from Figure 2 of J. Gardner <em>et al. </em>[1]. The objective function is better when the contour color is bluer. The infeasible region is masked by transparent white, i.e., only the left-top and right-bottom ellipsoidal regions in the figure are feasible.</figcaption></figure><p>The experiments were conducted on a computer running Arch Linux with Intel® Core™ i9–14900HX processor (24 cores, 32 threads, up to 5.8GHz), and Python 3.11.0.</p><p>The results are shown in Figures 2 and 3. These figures indicate that Gaussian Process-based samplers, i.e., GPSampler and BoTorchSampler, outperform TPESampler in exchange for a longer sampling time. In our experiments, GPSampler achieved better performance. This is because TPESampler tends to get stuck in one of the feasible regions in Figure 1 while GPSampler delves into both of the feasible regions thanks to a more expressive surrogate model. For the sampling time, GPSampler samples each trial much quicker than BoTorchSampler while the results are retained nearly the same except for the early stage of the optimization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/0*6WLAgmFiJejbkUH1" /><figcaption>Figure 2: Performance of each sampler at each trial. Multivariate TPE means TPESampler with multivariate=True and TPE means the default TPESampler. The <em>x</em>-axis represents the number of trials and the <em>y</em>-axis represents the best objective value of feasible trials. The solid lines represent the median of the performance, and the weak-color bands indicate the interquartile range. Note that both of them were calculated across 10 studies each with a different random seed.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/0*J6zWBvlMtW7IPp1H" /><figcaption>Figure 3: Elapsed time of each sampler at the end of each trial. The x-axis represents the number of trials and the y-axis represents the elapsed time since the start of the study. The solid lines represent the mean elapsed time, and the weak-color bands indicate the standard error. Note that both of them were calculated across 10 studies each with a different random seed.</figcaption></figure><h3>Wrap-up</h3><p>This article introduced the extension of GPSampler to problems with inequality constraints. The constrained GPSampler demonstrated superior performance to TPESampler with a shorter sampling time than BoTorchSampler in our experiments. Please give it a try!</p><h3>References</h3><p>[1] Gardner, J., Kusner, M., Zhixiang, W., Weinberger, K., and Cunningham, J. Bayesian optimization with inequality constraints. In <em>Proceedings of the 31st International Conference on Machine Learning, </em>2014.</p><p>[2] Gelbart, M. A., Snoek, J., and Adams, R. P. Bayesian optimization with unknown constraints. In <em>Proceedings of the 30th Conference on Uncertainty in Artificial Intelligence</em>, 2014.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4f68e8ee810" width="1" height="1" alt=""><hr><p><a href="https://medium.com/optuna/optuna-v4-2-gaussian-process-based-sampler-can-now-handle-inequality-constraints-a4f68e8ee810">[Optuna v4.2] Gaussian Process-Based Sampler Can Now Handle Inequality Constraints</a> was originally published in <a href="https://medium.com/optuna">Optuna</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>