API Reference

Gryffin

class gryffin.Gryffin(config_file=None, config_dict=None, known_constraints=None, frac_feas=None, silent=False)[source]
__init__(config_file=None, config_dict=None, known_constraints=None, frac_feas=None, silent=False)[source]

Initialize Gryffin from a config dict or file.

A config file or dict must be provided. If both a config file and a config dict are provided, the file will be ignored.

Parameters
  • config_file (Optional[str]) – Gryffin config filepath

  • config_dict (Optional[Dict]) – Gryffin config dict

  • known_constraints (Optional[Callable[[Dict], bool]]) – Function imposing contraints on the Gryffin search space.

  • frac_feas – Feasability fraction TODO: Not sure what this is for

  • silent (bool) – Suppress all standard output. If True, the verbosity settings in config will be overwritten. Default is False.

build_surrogate(observations=None)[source]

Builds surrogate models of Gryffin without proposing any new experiments.

Parameters

observations (Optional[List]) – List of dictionaries with the previous observations

Return type

None

get_acquisition(X)[source]

Retrieve the last acquisition functions for a specific lambda value.

get_descriptor_summary_feasibility()[source]

Retrieve a summary of the descriptor relavances for the feasibility surrogate

get_descriptor_summary_regression()[source]

Retrieve a summary of descriptor relavances for the regression surrogate

get_feasibility_surrogate(params, threshold=None)[source]

Retrieve the feasibility surrogate model.

Parameters
  • params (Union[List, DataFrame]) – List of dicts with input parameters to evaluate. Alternatively it can also be a pandas DataFrame where each column name corresponds to one of the input parameters in Gryffin.

  • threshold (Optional[float]) – Threshold used to classify whether a set of parameters is feasible or not. If None, the probability of feasibility is returned instead of a binary True/False (feasible/infeasible) output. Default is None.

Return y_pred

Surrogate model evaluated at the locations defined in params.

Return type

List

get_kernel_density_estimate(params, separate_kwn_ukwn=False)[source]

Retrieve the feasibility surrogate model.

Parameters
  • params (Union[List, DataFrame]) – List of dicts with input parameters to evaluate. Alternatively it can also be a pandas DataFrame where each column name corresponds to one of the input parameters in Gryffin.

  • separate_kwn_ukwn (bool) – Return the density for all samples, or separate the density for feasible/infeasible samples.

Return y_pred

Kernel density estimates.

Return type

List

get_regression_surrogate(params)[source]

Retrieve the surrogate model.

Parameters

params (Union[List, DataFrame]) – List of dicts with input parameters to evaluate. Alternatively it can also be a pandas DataFrame where each column name corresponds to one of the input parameters in Gryffin.

Return y_pred

Surrigate model evaluated at the locations defined in params.

recommend(observations=None, sampling_strategies=None, num_batches=None, as_array=False)[source]

Recommends the next set(s) of parameters based on the provided observations.

Parameters
  • observations (Optional[List]) – List of dictionaries with the previous observations.

  • sampling_strategies (Optional[List]) – List of the chosen sampling strategies. When providing this argument, the config setting strategies will be ignored.

  • num_batches (Optional[int]) – Number of parameter batches requested. When providing this argument, the config setting batches will be ignored.

  • as_array (bool) – Whether to return suggested samples as numpy arrays instead of a list of dictionaries. Default is False.

Return params

List of dictionaries with the suggested parameters.

Return type

List