Skip to content

aspuru-guzik-group/gryffin

Repository files navigation

build Documentation Status License

Gryffin: Bayesian Optimization of Continuous and Categorical Variables

Welcome to Gryffin!

Designing functional molecules and advanced materials requires complex design choices: tuning continuous process parameters such as temperatures or flow rates, while simultaneously selecting catalysts or solvents.

To date, the development of data-driven experiment planning strategies for autonomous experimentation has largely focused on continuous process parameters despite the urge to devise efficient strategies for the selection of categorical variables. Here, we introduce Gryffin, a general purpose optimization framework for the autonomous selection of categorical variables driven by expert knowledge.

Features

  • Gryffin extends the ideas of the Phoenics optimizer to categorical variables. Phoenics is a linear-scaling Bayesian optimizer for continuous spaces which uses a kernel regression surrogate. Gryffin extends this approach to categorical and mixed continuous-categorical spaces.
  • Gryffin is linear-scaling appraoch to Bayesian optimization, whose acquisition function natively supports batched optimization. Gryffin's acquisition function uses an intuitive sampling parameter to bias its behaviour between exploitation and exploration.
  • Gryffin is capable of leveraging expert knowledge in the form of physicochemical descriptors to enhance its optimization performance (static formulation). Also, Gryffin can refine the provided descriptors to further accelerate the optimization (dynamic formulation) and foster scientific understanding.

Use cases of Gryffin/Phoenics

Requirements

  • Python version >= 3.7

Installation

To install gryffin from PyPI:

$ pip install gryffin

To install gryffin from source:

$ git clone [email protected]:aspuru-guzik-group/gryffin.git
$ cd gryffin
$ pip install .

Example Usage

This is a minimalist example of Gryffin in action.

    from gryffin import Gryffin
    import experiment

    # load config
    config = {
        "parameters": [
            {"name": "param_0", "type": "continuous", "low": 0.0, "high": 1.0},
        ],
        objectives: [
            {"name": "obj", "goal": "min"},
        ]
    }

    # initialize gryffin
    gryffin = Gryffin(
        config_dict=config
    )

    observations = [] 
    for iter in range(ITER_BUDGET):

        # query gryffin for new params
        params  = gryffin.recommend(observations=observations)

        # evaluate the proposed parameters
        merit = experiment.run(params)
        params['obj'] = merit

        observations.append(params)

Documentation

Please refer to the documentation website for:

Citation

If you found Gryffin useful, please include the relevant citation in your work.

License

Apache License 2.0