### Install dependencies Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_hpo/plot_hpo_text_classification.rst Install necessary libraries for the tutorial, including PyTorch and TorchText. ```bash %%bash pip install deephyper ray numpy==1.26.4 torch torchtext==0.17.2 torchdata==0.7.1 'portalocker>=2.0.0' ``` -------------------------------- ### Execute Installation Script Source: https://github.com/deephyper/deephyper/wiki/Todo-list:-deploy-new-module-with-latest-DeepHyper-version-on-ThetaGPU Run the installation script in the background and monitor the output log. ```bash ./install_dh_hvd_tf_torch.sh > module_build_log.txt 2>&1 & ``` ```bash watch tail module_build_log.txt ``` -------------------------------- ### Install Wheel from Test PyPI Source: https://github.com/deephyper/deephyper/wiki/Todo-list:-Create-a-new-release Install the package from Test PyPI to verify the build and installation process. ```bash python setup.py testinstall ``` -------------------------------- ### Install DeepHyper and Benchmarks Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_bbo/plot_multi_objective_optimization.ipynb Install the required packages via pip. ```bash pip install deephyper pip install "git+https://github.com/deephyper/benchmark.git@main#egg=deephyper-benchmark" ``` -------------------------------- ### Install Distributed Computation Backends Source: https://github.com/deephyper/deephyper/blob/master/docs/install/pip.rst Install Python bindings for distributed backends. Note that system-level libraries for MPI and Redis must be installed separately. ```console $ pip install "deephyper[mpi]" # install python bindings for MPI $ pip install "deephyper[ray]" # install Ray $ pip install "deephyper[redis]" # install Redis client $ pip install "deephyper[redis-hiredis]" # install Redis client with Hiredis for better performance ``` -------------------------------- ### Ray instance startup log Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_uq/plot_hpo_tree_ensemble_uq_classification_sklearn.rst Example output showing the initialization of a local Ray instance. ```none 2025-08-18 15:31:34,448 INFO worker.py:1852 -- Started a local Ray instance. ``` -------------------------------- ### Run Decentralized Optimization Example Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_parallelism/plot_scaling_bo.ipynb Example execution of the decentralized optimization function with specified parameters, utilizing all available CPU cores. ```python if __name__ == "__main__": results["decentralized"] = execute_decentralized_bo( problem=problem, run_function=run_ackley, run_function_kwargs=run_function_kwargs, num_workers=num_workers, log_dir="search_decentralized", search_kwargs=search_kwargs, timeout=timeout, n_processes=multiprocessing.cpu_count(), ) ``` -------------------------------- ### Install DeepHyper and Benchmark Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_bbo/plot_multi_objective_optimization.rst Install the necessary libraries for DeepHyper and the benchmark suite. Ensure Python version is 3.10 or higher. ```bash %%bash pip install deephyper pip install "git+https://github.com/deephyper/benchmark.git@main#egg=deephyper-benchmark" ``` -------------------------------- ### Install Dependencies Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_hpo/plot_hpo_text_classification.ipynb Installs necessary libraries including deephyper, ray, numpy, torch, torchtext, and torchdata. ```bash pip install deephyper ray numpy==1.26.4 torch torchtext==0.17.2 torchdata==0.7.1 'portalocker>=2.0.0' ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://github.com/deephyper/deephyper/blob/master/docs/install/conda.rst Command to install necessary build tools for MacOS environments. ```console xcode-select --install ``` -------------------------------- ### Install Spack Source: https://github.com/deephyper/deephyper/blob/master/docs/install/spack.rst Clone the Spack repository to your local system and set up the environment variables. This is a prerequisite for using Spack. ```console $ git clone -c feature.manyFiles=true https://github.com/spack/spack.git $ . ./spack/share/spack/setup-env.sh ``` -------------------------------- ### Evaluation Output Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_hpo/plot_hpo_for_rf_and_overfitting.rst Example output showing the best configuration and the resulting accuracy metrics. ```none Best config is: {'p:classifier': 'RandomForest', 'p:criterion': 'gini', 'p:max_depth': 39, 'p:min_samples_leaf': 10, 'p:min_samples_split': 4, 'p:n_estimators': 888, 'p:learning_rate': 0.01, 'p:loss': 'log_loss', 'p:subsample': 0.01, 'objective': 0.6424223112914856, 'job_id': 93, 'job_status': 'DONE'} Scoring model: RandomForest Accuracy on Training: 0.751 Accuracy on Validation: 0.666 Accuracy on Testing: 0.666 ``` -------------------------------- ### Initialize and install DeepHyper with uv Source: https://github.com/deephyper/deephyper/blob/master/docs/install/uv.rst Use these commands to create a new project directory and add the deephyper package as a dependency. ```console $ uv init myproject $ cd myproject $ uv add deephyper ``` -------------------------------- ### Install DeepHyper Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_bbo/plot_black_box_optimization.ipynb Install the DeepHyper library using pip. This is the first step before importing and using its functionalities. ```bash pip install deephyper ``` -------------------------------- ### Run Doctests Source: https://github.com/deephyper/deephyper/wiki/Todo-list:-Create-a-new-release Run documentation tests to ensure examples and documentation are consistent. ```bash $ make doctest ``` -------------------------------- ### Request Interactive Compute Node Source: https://github.com/deephyper/deephyper/wiki/Todo-list:-deploy-new-module-with-latest-DeepHyper-version-on-ThetaGPU Allocate a compute node for the installation process using the qsub command. ```bash qsub -t 360 -n 1 -q full-node -A datascience -I ``` -------------------------------- ### View optimization results output Source: https://github.com/deephyper/deephyper/blob/master/docs/index.rst Example console output showing the optimization progress and the identified optimum values. ```console p:b p:function p:x objective job_id job_status m:timestamp_submit m:timestamp_gather 0 7 cubic -1.103350 5.656803 0 DONE 0.011795 0.905777 1 3 cubic 8.374450 590.312101 1 DONE 0.011875 0.906027 2 6 cubic 4.680560 108.540056 2 DONE 0.917542 0.918856 3 9 linear 8.787395 17.787395 3 DONE 0.917645 0.929052 4 6 cubic 9.109560 761.948419 4 DONE 0.928757 0.938856 .. ... ... ... ... ... ... ... ... 96 9 cubic 9.998937 1008.681250 96 DONE 33.905465 34.311504 97 10 cubic 9.999485 1009.845416 97 DONE 34.311124 34.777270 98 10 cubic 9.996385 1008.915774 98 DONE 34.776732 35.236710 99 10 cubic 9.997400 1009.220073 99 DONE 35.236190 35.687774 100 10 cubic 9.999833 1009.949983 100 DONE 35.687380 36.111318 [101 rows x 12 columns] Optimum values function: cubic x: 9.99958232225758 b: 10 y: 1009.8747019108424 ``` -------------------------------- ### Clone Installation Scripts Source: https://github.com/deephyper/deephyper/wiki/Todo-list:-deploy-new-module-with-latest-DeepHyper-version-on-ThetaGPU Download the repository containing the Anaconda installation scripts to the home directory. ```bash git clone git@github.com:felker/conda_install_scripts.git $HOME/conda_install_scripts ``` -------------------------------- ### Define Optimization Problem and Constraints Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_bbo/plot_constrained_black_box_optimization.ipynb Setup the search space, objective function, and feasibility constraint function. ```python pb = HpProblem() pb.add((-10.0, 10.0), "x") pb.add((-10.0, 10.0), "y") def f(job): """Objective function: maximize x^2 + y^2.""" return job.parameters["x"] ** 2 + job.parameters["y"] ** 2 def constraint_fn_test(s: pd.DataFrame): """Feasibility condition: |x| + |y| <= 10.""" return np.abs(s["x"]) + np.abs(s["y"]) <= 10 pb.set_constraint_fn(constraint_fn_test) ``` -------------------------------- ### Install Pytest-Profiling Plugin Source: https://github.com/deephyper/deephyper/blob/master/docs/developer_guides/running_tests.rst Installs the 'pytest-profiling' plugin, which can be used to profile slow tests and identify performance bottlenecks. ```bash pip install pytest-profiling ``` -------------------------------- ### Install Wheel from PyPI Source: https://github.com/deephyper/deephyper/wiki/Todo-list:-Create-a-new-release Install the DeepHyper package from PyPI using pip. Replace $VERSION with the actual version number. ```bash pip install deephyper==$VERSION ``` -------------------------------- ### Use Sphinx-Design Dropdown in Examples Source: https://github.com/deephyper/deephyper/blob/master/docs/developer_guides/documentation.rst Syntax for hiding non-essential code blocks within Sphinx-Gallery examples using the dropdown directive. ```python # %% # The title of a text block # ------------------------- # # Some text here... # .. dropdown:: A title for my dropdown bar = foo(x) ``` -------------------------------- ### Install DeepHyper with Development Tools Source: https://github.com/deephyper/deephyper/blob/master/docs/install/spack.rst Add the '+dev' feature to the 'deephyper' package to include development tools. Run 'spack install' again after adding features. ```console $ spack add deephyper +dev ``` -------------------------------- ### Install Deephyper with Ray Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_hpo/plot_hpo_for_rf_and_overfitting.ipynb Install the deephyper library with Ray support and openml. Ensure Python version is 3.10 or higher. ```bash %%bash pip install "deephyper[ray] openml==0.15.1" ``` -------------------------------- ### Ensemble Selection Progress Output Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_uq/plot_nas_deep_ensemble_uq_regression_pytorch.rst Example output showing the progress of model collection. ```none 0%| | 0/251 [00:00>> [475, 21, 30, 5286] ``` -------------------------------- ### Search Progress Output Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_hpo/plot_hpo_text_classification_with_stopper.rst Example of the console output generated during the search process, showing progress bars and evaluation metrics. ```none 0%| | 0/30 [00:00>> f(x={config['x']:.3f}) = {y:.3f}") search.tell([(config, y)]) ``` -------------------------------- ### Execute Search with Ask-and-Tell Interface Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_bbo/plot_black_box_optimization.rst Demonstrates the manual loop for requesting configurations and reporting objective results using the Ask-and-Tell interface. ```Python search = create_search() max_evals = 100 for i in range(max_evals): config = search.ask(1)[0] y = -config["x"] ** 2 print(f"[{i=:03d}] >>> f(x={config['x']:.3f}) = {y:.3f}") search.tell([(config, y)]) ``` ```none [i=000] >>> f(x=-0.150) = -0.022 [i=001] >>> f(x=-9.819) = -96.421 [i=002] >>> f(x=3.473) = -12.065 [i=003] >>> f(x=-1.518) = -2.305 [i=004] >>> f(x=-3.703) = -13.709 [i=005] >>> f(x=-0.002) = -0.000 [i=006] >>> f(x=-0.501) = -0.251 [i=007] >>> f(x=-0.878) = -0.771 [i=008] >>> f(x=0.194) = -0.038 [i=009] >>> f(x=-0.610) = -0.372 [i=010] >>> f(x=-0.814) = -0.662 [i=011] >>> f(x=-0.195) = -0.038 [i=012] >>> f(x=-0.089) = -0.008 [i=013] >>> f(x=-0.433) = -0.188 [i=014] >>> f(x=1.639) = -2.685 [i=015] >>> f(x=-1.606) = -2.580 [i=016] >>> f(x=0.245) = -0.060 [i=017] >>> f(x=-0.028) = -0.001 [i=018] >>> f(x=-0.062) = -0.004 [i=019] >>> f(x=0.003) = -0.000 [i=020] >>> f(x=0.082) = -0.007 [i=021] >>> f(x=-0.060) = -0.004 [i=022] >>> f(x=0.091) = -0.008 [i=023] >>> f(x=0.097) = -0.009 [i=024] >>> f(x=0.394) = -0.155 [i=025] >>> f(x=0.668) = -0.446 [i=026] >>> f(x=0.085) = -0.007 [i=027] >>> f(x=0.002) = -0.000 [i=028] >>> f(x=-0.085) = -0.007 [i=029] >>> f(x=-0.099) = -0.010 [i=030] >>> f(x=-0.064) = -0.004 [i=031] >>> f(x=-0.050) = -0.003 [i=032] >>> f(x=-0.056) = -0.003 [i=033] >>> f(x=-0.017) = -0.000 [i=034] >>> f(x=0.443) = -0.196 [i=035] >>> f(x=-0.216) = -0.046 [i=036] >>> f(x=0.187) = -0.035 [i=037] >>> f(x=-0.080) = -0.006 [i=038] >>> f(x=-0.042) = -0.002 [i=039] >>> f(x=0.084) = -0.007 [i=040] >>> f(x=-0.010) = -0.000 [i=041] >>> f(x=0.021) = -0.000 [i=042] >>> f(x=0.021) = -0.000 [i=043] >>> f(x=0.022) = -0.000 [i=044] >>> f(x=-0.305) = -0.093 [i=045] >>> f(x=0.262) = -0.069 [i=046] >>> f(x=-0.007) = -0.000 [i=047] >>> f(x=0.023) = -0.001 [i=048] >>> f(x=0.031) = -0.001 [i=049] >>> f(x=0.030) = -0.001 [i=050] >>> f(x=0.026) = -0.001 [i=051] >>> f(x=0.022) = -0.000 [i=052] >>> f(x=0.016) = -0.000 [i=053] >>> f(x=0.020) = -0.000 [i=054] >>> f(x=0.287) = -0.082 [i=055] >>> f(x=-0.123) = -0.015 [i=056] >>> f(x=0.102) = -0.010 [i=057] >>> f(x=0.015) = -0.000 [i=058] >>> f(x=-0.008) = -0.000 [i=059] >>> f(x=-0.007) = -0.000 [i=060] >>> f(x=-0.006) = -0.000 [i=061] >>> f(x=-0.019) = -0.000 [i=062] >>> f(x=-0.013) = -0.000 [i=063] >>> f(x=-0.008) = -0.000 [i=064] >>> f(x=0.132) = -0.017 [i=065] >>> f(x=0.016) = -0.000 [i=066] >>> f(x=0.016) = -0.000 [i=067] >>> f(x=0.013) = -0.000 [i=068] >>> f(x=0.015) = -0.000 [i=069] >>> f(x=-0.011) = -0.000 [i=070] >>> f(x=-0.006) = -0.000 [i=071] >>> f(x=0.008) = -0.000 [i=072] >>> f(x=0.012) = -0.000 [i=073] >>> f(x=0.014) = -0.000 [i=074] >>> f(x=0.033) = -0.001 [i=075] >>> f(x=0.041) = -0.002 [i=076] >>> f(x=0.004) = -0.000 [i=077] >>> f(x=0.010) = -0.000 [i=078] >>> f(x=0.007) = -0.000 [i=079] >>> f(x=0.009) = -0.000 [i=080] >>> f(x=0.007) = -0.000 [i=081] >>> f(x=0.005) = -0.000 [i=082] >>> f(x=0.004) = -0.000 [i=083] >>> f(x=0.005) = -0.000 [i=084] >>> f(x=0.050) = -0.002 [i=085] >>> f(x=-0.010) = -0.000 [i=086] >>> f(x=0.011) = -0.000 [i=087] >>> f(x=0.000) = -0.000 [i=088] >>> f(x=-0.010) = -0.000 [i=089] >>> f(x=-0.011) = -0.000 [i=090] >>> f(x=-0.010) = -0.000 [i=091] >>> f(x=-0.009) = -0.000 [i=092] >>> f(x=0.003) = -0.000 [i=093] >>> f(x=-0.008) = -0.000 [i=094] >>> f(x=0.063) = -0.004 ``` -------------------------------- ### Install DeepHyper dependencies Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_uq/plot_nas_deep_ensemble_uq_regression_pytorch.ipynb Install the necessary packages for DeepHyper with Ray and PyTorch support. ```bash pip install "deephyper[ray,torch]" ``` -------------------------------- ### Print Best Configuration Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_hpo/plot_hpo_text_classification.rst Displays the best configuration dictionary in a formatted JSON string. ```Python print(json.dumps(best_config, indent=4)) ``` -------------------------------- ### Install DeepHyper dependencies Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_uq/plot_hpo_tree_ensemble_uq_classification_sklearn.ipynb Install the necessary DeepHyper package with Ray support using pip. ```bash pip install "deephyper[ray]" ``` -------------------------------- ### Build Documentation Commands Source: https://github.com/deephyper/deephyper/blob/master/docs/developer_guides/documentation.rst Commands to navigate to the documentation directory and trigger the HTML build process. ```bash $ cd deephyper/docs/ $ make html ``` -------------------------------- ### Install DeepHyper via pip Source: https://github.com/deephyper/deephyper/blob/master/docs/index.rst Standard installation command for DeepHyper. Requires Python 3.10 or higher. ```python pip install deephyper ``` ```python pip install "deephyper[core]" ``` -------------------------------- ### Add and Install DeepHyper Source: https://github.com/deephyper/deephyper/blob/master/docs/install/spack.rst Add the 'py-deephyper' package to the active Spack environment and then install all packages in the environment. ```console $ spack add py-deephyper $ spack install ``` -------------------------------- ### Import and Check DeepHyper Version Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_bbo/plot_black_box_optimization.ipynb Import the DeepHyper library and print its installed version to verify the installation. ```python import deephyper print(deephyper.__version__) ``` -------------------------------- ### Text and Label Pipeline Example Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_hpo/plot_hpo_text_classification.ipynb Shows how text strings are converted into sequences of integer IDs using a text pipeline, and how labels are converted to integers using a label pipeline. ```python text_pipeline('here is the an example') >>> [475, 21, 2, 30, 5286] label_pipeline('10') >>> 9 ``` -------------------------------- ### Install DeepHyper via Pip Source: https://github.com/deephyper/deephyper/blob/master/docs/install/conda.rst Commands to upgrade pip and install the DeepHyper package within the active environment. ```console $ pip install pip --upgrade $ pip install deephyper ``` -------------------------------- ### Import Dependencies and Initialize Benchmark Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_bbo/plot_multi_objective_optimization.ipynb Import necessary modules and initialize the DTLZ benchmark with a specified number of objectives. ```python import matplotlib.pyplot as plt from deephyper.hpo import CBO from deephyper_benchmark.benchmarks.dtlz import DTLZBenchmark WIDTH_PLOTS = 8 HEIGHT_PLOTS = WIDTH_PLOTS / 1.618 n_objectives = 2 bench = DTLZBenchmark(nobj=n_objectives) ``` -------------------------------- ### Install DeepHyper via pip Source: https://github.com/deephyper/deephyper/blob/master/docs/install/pip.rst Install the core DeepHyper package or specific feature sets using pip extras. ```console $ # Core set of features $ pip install "deephyper[core]" # <=> "deephyper[jax-cpu,torch]" $ # Isolated features $ pip install "deephyper" # install hyperparameter optimization (HPO) $ pip install "deephyper[jax-cpu]" # install JAX with CPU support for Learning Curve Extrapolation Stopper $ pip install "deephyper[jax-cuda]" # install JAX with GPU (Cuda) support for Learning Curve Extrapolation Stopper $ pip install "deephyper[torch]" # install with Pytorch support $ # For developers (Tests, Documentation, etc...) $ pip install "deephyper[dev]" # install developer stack (tests, documentation, etc.) ``` -------------------------------- ### Build and Upload Wheel to PyPI Source: https://github.com/deephyper/deephyper/wiki/Todo-list:-Create-a-new-release Build the Python wheel package and upload it to the official PyPI server. ```bash python setup.py upload ``` -------------------------------- ### Build and Upload Wheel to Test PyPI Source: https://github.com/deephyper/deephyper/wiki/Todo-list:-Create-a-new-release Build the Python wheel package and upload it to the Test PyPI server for preliminary testing. ```bash python setup.py testupload ``` -------------------------------- ### Install DeepHyper with Ray and PyTorch Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_uq/plot_nas_deep_ensemble_uq_regression_pytorch.rst Install the necessary DeepHyper package with support for Ray and PyTorch. Ensure Python version is 3.10 or higher. ```bash %%bash pip install "deephyper[ray,torch]" ``` -------------------------------- ### Navigate to Software Directory Source: https://github.com/deephyper/deephyper/wiki/Todo-list:-deploy-new-module-with-latest-DeepHyper-version-on-ThetaGPU Change the current working directory to the shared software location on ThetaGPU. ```bash cd /lus/theta-fs0/software/thetagpu/conda/ ``` -------------------------------- ### Evaluate best configuration performance Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_hpo/plot_hpo_text_classification_with_stopper.ipynb Run the best configuration through the performance evaluation function. ```python objective_best = perf_run(RunningJob(parameters=best_config)) print(f"Accuracy Best Configuration: {objective_best["objective"]:.3f}") ``` -------------------------------- ### Install DeepHyper with Ray Support Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_uq/plot_hpo_tree_ensemble_uq_classification_sklearn.rst Install the deephyper library with support for Ray for distributed computing. This command is typically run in a bash environment. ```bash %%bash pip install "deephyper[ray]" ``` -------------------------------- ### Importing necessary modules Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_bbo/plot_experimental_design.rst Initializes the environment and imports required libraries for the experimental design workflow. ```Python import os import shutil import matplotlib.pyplot as plt from deephyper.analysis._matplotlib import update_matplotlib_rc from deephyper.hpo import HpProblem from deephyper.hpo import ExperimentalDesignSearch update_matplotlib_rc() ``` -------------------------------- ### Clone DeepHyper Develop Branch Source: https://github.com/deephyper/deephyper/blob/master/docs/developer_guides/development.rst Clone the develop branch of the DeepHyper repository and install it with core and development dependencies. Ensure git-lfs is installed beforehand. ```console $ git clone -b develop git@github.com:deephyper/deephyper.git $ cd deephyper/ $ pip install -e ".[core,dev]" ``` -------------------------------- ### Install DeepHyper with Machine Learning Features Source: https://github.com/deephyper/deephyper/blob/master/docs/install/spack.rst Add optional features to the 'deephyper' package for machine learning support, such as SDV, Jax, Tensorflow/Keras, or PyTorch. Run 'spack install' again after adding features. ```console $ spack add deephyper +sdv # SDV support ``` ```console $ spack add deephyper +jax-cpu # Jax support ``` ```console $ spack add deephyper +tf-keras2 # Tensorflow and Keras support ``` ```console $ spack add deephyper +torch # PyTorch support ``` -------------------------------- ### Evaluate Best Configuration Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_hpo/plot_hpo_text_classification.ipynb Finds the best configuration from the search results and evaluates it. Prints comparison metrics and the best configuration in JSON format. ```python import json ``` ```python i_max = results.objective.argmax() best_config = results.iloc[i_max][:-3].to_dict() best_config = {k[2:]: v for k, v in best_config.items() if k.startswith("p:")} print(f"The default configuration has an accuracy of {objective_default:.3f}. " f"The best configuration found by DeepHyper has an accuracy {results['objective'].iloc[i_max]:.3f}, " f"finished after {results['m:timestamp_gather'].iloc[i_max]:.2f} secondes of search. ") print(json.dumps(best_config, indent=4)) ``` -------------------------------- ### Import Libraries Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_hpo/plot_hpo_text_classification.ipynb Imports essential libraries for the tutorial, including ray, torch, torchtext components, and PyTorch data utilities. ```python # .. dropdown:: Imports import ray import json from functools import partial import torch from torchtext.data.utils import get_tokenizer from torchtext.data.functional import to_map_style_dataset from torchtext.vocab import build_vocab_from_iterator from torchtext.datasets import AG_NEWS from torch.utils.data import DataLoader from torch.utils.data.dataset import random_split from torch import nn ``` -------------------------------- ### Install DeepHyper with Storage and Parallel Backends Source: https://github.com/deephyper/deephyper/blob/master/docs/install/spack.rst Add optional features to the 'deephyper' package for enhanced storage and parallel processing capabilities, including MPI, Ray, and Redis. Run 'spack install' again after adding features. ```console $ spack add deephyper +mpi # MPI support for MPICommEvaluator ``` ```console $ spack add deephyper +ray # Ray support for RayEvaluator ``` ```console $ spack add deephyper +redis # Redis/RedisJSON/py-redis support for RedisStorage and Distributed Search ``` -------------------------------- ### Configure and Run CBO Search with Failure Strategies Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_bbo/plot_notify_failures_hpo.rst Initializes and runs the CBO search algorithm with different failure handling strategies ('ignore', 'mean', 'min') to compare their impact on optimization. ```Python results = {} max_evals = 100 ``` ```Python for failure_strategy in ["ignore", "mean", "min"]: evaluator = Evaluator.create( run, method="thread", method_kwargs={ "callbacks": [TqdmCallback(f"Failure Strategy: {failure_strategy}")]} ) search = CBO( problem, acq_optimizer="ga", acq_optimizer_kwargs=dict( filter_duplicated=False, filter_failures=failure_strategy, ), log_dir=f"search_{failure_strategy}", random_state=42, ) ``` -------------------------------- ### Instantiate CBO Search Algorithm Source: https://github.com/deephyper/deephyper/blob/master/docs/examples/examples_hpo/plot_hpo_text_classification.ipynb Initializes the CBO search algorithm with a defined problem configuration. ```python search = CBO(problem) ```