Giter Club home page Giter Club logo

how-to-autorl's Introduction

AutoRL Hydra Sweepers

This repository contains hydra sweeper versions of proven AutoRL tuning tools for plug-and-play use. Currently included:

We recommend starting in the examples directory to see how the sweepers work. Assume that everything here is a minimizer! You can maximize instead by passing 'maximize=true' as a sweeper kwarg. For more background information, see here.

Installation

We recommend creating a conda environment to install the sweeper in. Choose which you want to use and install the dependencies for these sweepers. For all available options, use 'all' or:

conda create -n autorl-sweepers python==3.9
conda activate autorl-sweepers
pip install -e .[dehb,pb2,bgt]

If you want to work on the code itself, you can also use:

make install-dev

Examples

In 'examples' you can see example configurations and setups for all sweepers on Stable Baselines 3 agents. To run an example with the sweeper, you need to set the '--multirun' flag:

python examples/dehb_for_pendulum_ppo.py -m

Usage in your own project

In your yaml-configuration file, set hydra/sweeper to the sweeper name, e.g. DEHB:

defaults:
  - override hydra/sweeper: DEHB

You can also add hydra/sweeper=<sweeper_name> to your command line. The sweepers will only be found if the hydra_plugins directory is in your PYTHONPATH. You can check if it's loaded by running your script with --info plugins.

Hyperparameter Search Space

The definition of the hyperparameters is based on ConfigSpace. The syntax of the hyperparameters is according to ConfigSpace's json serialization. Please see their user guide for more information on how to configure hyperparameters.

Your yaml-configuration file must adhere to following syntax:

hydra:
  sweeper:
    ...
    search_space:
      hyperparameters:  # required
        hyperparameter_name_0:
          ...
        hyperparameter_name_1:
          ...
        ...

The configspace fields conditions and forbiddens aren't implemented for the solvers (except possibly DEHB?). Please don't use them, they'll be ignored.

Defining a uniform integer parameter is easy:

n_neurons:
  type: uniform_int  # or have a float parameter by specifying 'uniform_float'
  lower: 8
  upper: 1024
  log: true  # optimize the hyperparameter in log space
  default_value: ${n_neurons}  # you can set your default value to the one normally used in your config

Same goes for categorical parameters:

activation:
  type: categorical
  choices: [logistic, tanh, relu]
  default_value: ${activation}

Contribute

See the CONTRIBUTING file for how to help out.

License

This package is Apache 2.0 licensed, as found in the LICENSE file.

how-to-autorl's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.