Skip to main content

Scalable asynchronous neural architecture and hyperparameter search for deep neural networks.

Project description

DOI GitHub tag (latest by date) Documentation Status PyPI - License PyPI - Downloads Open In Colab

What is DeepHyper?

DeepHyper is a powerful Python package for automating machine learning tasks, particularly focused on optimizing hyperparameters, searching for optimal neural architectures, and quantifying uncertainty through the use of deep ensembles. With DeepHyper, users can easily perform these tasks on a single machine or distributed across multiple machines, making it ideal for use in a variety of environments. Whether you're a beginner looking to optimize your machine learning models or an experienced data scientist looking to streamline your workflow, DeepHyper has something to offer. So why wait? Start using DeepHyper today and take your machine learning skills to the next level!

Install instructions

From PyPI:

pip install deephyper

From Github:

git clone https://github.com/deephyper/deephyper.git
pip install -e deephyper/

If you want to install deephyper with test and documentation packages:

From PyPI:

pip install 'deephyper[dev]'

From Github:

git clone https://github.com/deephyper/deephyper.git
pip install -e 'deephyper/[dev]'

Quickstart

Open In Colab

The black-box function named run is defined by taking an input dictionnary named config which contains the different variables to optimize. Then the run-function is binded to an Evaluator in charge of distributing the computation of multiple evaluations. Finally, a Bayesian search named CBO is created and executed to find the values of config which maximize the return value of run(config).

def run(config: dict):
    return -config["x"]**2


# Necessary IF statement otherwise it will enter in a infinite loop
# when loading the 'run' function from a new process
if __name__ == "__main__":
    from deephyper.problem import HpProblem
    from deephyper.search.hps import CBO
    from deephyper.evaluator import Evaluator

    # define the variable you want to optimize
    problem = HpProblem()
    problem.add_hyperparameter((-10.0, 10.0), "x")

    # define the evaluator to distribute the computation
    evaluator = Evaluator.create(
        run,
        method="process",
        method_kwargs={
            "num_workers": 2,
        },
    )

    # define your search and execute it
    search = CBO(problem, evaluator)

    results = search.search(max_evals=100)
    print(results)

Which outputs the following where the best x found is clearly around 0.

         p:x  job_id     objective  timestamp_submit  timestamp_gather
0  -7.744105       1 -5.997117e+01          0.011047          0.037649
1  -9.058254       2 -8.205196e+01          0.011054          0.056398
2  -1.959750       3 -3.840621e+00          0.049750          0.073166
3  -5.150553       4 -2.652819e+01          0.065681          0.089355
4  -6.697095       5 -4.485108e+01          0.082465          0.158050
..       ...     ...           ...               ...               ...
95 -0.034096      96 -1.162566e-03         26.479630         26.795639
96 -0.034204      97 -1.169901e-03         26.789255         27.155481
97 -0.037873      98 -1.434366e-03         27.148506         27.466934
98 -0.000073      99 -5.387088e-09         27.460253         27.774704
99  0.697162     100 -4.860350e-01         27.768153         28.142431

We also asked ChatGPT to explain this example and here is the reply:

"The code defines a function run that takes a dictionary config as input and returns the negative of x squared. The if block at the end of the code defines a black-box optimization process using the CBO (Centralized Bayesian Optimization) algorithm from the deephyper library.

The optimization process is defined as follows:

  1. A hyperparameter optimization problem is created using the HpProblem class from deephyper. In this case, the problem has a single continuous hyperparameter x that ranges from -10.0 to 10.0.
  2. An evaluator is created using the Evaluator.create method. The evaluator will be used to evaluate the function run with different configurations of the hyperparameters in the optimization problem. The evaluator uses the process method to distribute the evaluations across multiple worker processes, in this case 2 worker processes.
  3. A search object is created using the CBO class and the problem and evaluator defined earlier. The CBO algorithm is a derivative-free optimization method that uses a Bayesian optimization approach to explore the hyperparameter space.
  4. The optimization process is executed by calling the search.search method, which performs the evaluations of the run function with different configurations of the hyperparameters until a maximum number of evaluations (100 in this case) is reached.
  5. The results of the optimization process, including the optimal configuration of the hyperparameters and the corresponding objective value, are printed to the console."

How do I learn more?

Contributions

Find all the list of contributors on the DeepHyper Authors page of the Documentation.

Citing DeepHyper

Find all our publications on the Research & Publication page of the Documentation.

How can I participate?

Questions, comments, feature requests, bug reports, etc. can be directed to:

  • Issues on GitHub

Patches through pull requests are much appreciated on the software itself as well as documentation. Optionally, please include in your first patch a credit for yourself in the list above.

The DeepHyper Team uses git-flow to organize the development: Git-Flow cheatsheet. For tests we are using: Pytest.

Acknowledgements

  • Scalable Data-Efficient Learning for Scientific Domains, U.S. Department of Energy 2018 Early Career Award funded by the Advanced Scientific Computing Research program within the DOE Office of Science (2018--Present)
  • Argonne Leadership Computing Facility: This research used resources of the Argonne Leadership Computing Facility, which is a DOE Office of Science User Facility supported under Contract DE-AC02-06CH11357.
  • SLIK-D: Scalable Machine Learning Infrastructures for Knowledge Discovery, Argonne Computing, Environment and Life Sciences (CELS) Laboratory Directed Research and Development (LDRD) Program (2016--2018)

Copyright and license

Copyright © 2019, UChicago Argonne, LLC

DeepHyper is distributed under the terms of BSD License. See LICENSE

Argonne Patent & Intellectual Property File Number: SF-19-007

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deephyper-0.5.0.tar.gz (232.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deephyper-0.5.0-py2.py3-none-any.whl (319.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file deephyper-0.5.0.tar.gz.

File metadata

  • Download URL: deephyper-0.5.0.tar.gz
  • Upload date:
  • Size: 232.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for deephyper-0.5.0.tar.gz
Algorithm Hash digest
SHA256 89e9733cbe122bdf4056910e24b88e08c38c9cd5f5f4bc7de342cded777c540a
MD5 1df7c9f91858c8ca15fd18a46981b523
BLAKE2b-256 f78f56a7b380e46931396d0a0f314f29d5df9a96536924544ffae3528b2dd947

See more details on using hashes here.

File details

Details for the file deephyper-0.5.0-py2.py3-none-any.whl.

File metadata

  • Download URL: deephyper-0.5.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 319.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for deephyper-0.5.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 75ac7c4b79b93e206afeb3c8f52858827fd3ac9119661e2d49d84676db49494c
MD5 206db28d0652736bbc1e49dd2c597b03
BLAKE2b-256 c8e0ca4f3ad10d4dc847f5497e870730c80b82f0008207114b45b04773ed7f55

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page