cotengra.hyperoptimizers.hyper_optuna

Hyper optimization using optuna.

Classes

OptunaOptLib

Hyper-optimization using optuna.

Functions

make_getter(name, param)

make_retriever(methods, space)

Module Contents

cotengra.hyperoptimizers.hyper_optuna.make_getter(name, param)[source]
cotengra.hyperoptimizers.hyper_optuna.make_retriever(methods, space)[source]
class cotengra.hyperoptimizers.hyper_optuna.OptunaOptLib[source]

Bases: cotengra.hyperoptimizers.hyper.HyperOptLib

Hyper-optimization using optuna.

setup(methods, space, optimizer=None, sampler='TPESampler', sampler_opts=None, **create_study_opts)[source]

Initialize the optimizer state.

Parameters:
  • methods (list[str]) – The list of contraction methods to optimize over.

  • space (dict[str, dict[str, dict]]) – The search space for each method.

  • optimizer (HyperOptimizer, optional) – The parent HyperOptimizer instance, for accessing attributes like max_repeats.

  • kwargs – Extra options specific to the optimizer library.

get_setting()[source]

Suggest the next setting to trial.

Returns:

setting – Must contain at least {"method": str, "params": dict}. May also include tokens for reporting.

Return type:

dict

report_result(setting, trial, score)[source]

Report the result of a trial.

Parameters:
  • setting (dict) – The setting dict returned by get_setting.

  • trial (dict) – The trial result dict.

  • score (float) – The scalar score for this trial.