syne_tune.results_callback module

class syne_tune.results_callback.ExtraResultsComposer[source]

Bases: object

Base class for extra_results_composer argument in StoreResultsCallback. Extracts extra results in StoreResultsCallback.on_trial_result() and returns them as dictionary to be appended to the results dataframe.

Why don’t we use a lambda function instead? We would like the tuner, with all its dependent objects, to be dill serializable, and lambda functions are not.

keys()[source]
Return type:

List[str]

Returns:

Key names of dictionaries returned in __call__(), or [] if nothing is returned

class syne_tune.results_callback.StoreResultsCallback(add_wallclock_time=True, extra_results_composer=None)[source]

Bases: TunerCallback

Default implementation of TunerCallback which records all reported results, and allows to store them as CSV file.

Parameters:
  • add_wallclock_time (bool) – If True, wallclock time since call of on_tuning_start is stored as ST_TUNER_TIME.

  • extra_results_composer (Optional[ExtraResultsComposer]) – Optional. If given, this is called in on_trial_result(), and the resulting dictionary is appended as extra columns to the results dataframe

on_trial_result(trial, status, result, decision)[source]

Called when a new result (reported by a trial) is observed

The arguments here are inputs or outputs of scheduler.on_trial_result (called just before).

Parameters:
  • trial (Trial) – Trial whose report has been received

  • status (str) – Status of trial before scheduler.on_trial_result has been called

  • result (Dict[str, Any]) – Result dict received

  • decision (str) – Decision returned by scheduler.on_trial_result

store_results()[source]

Store current results into CSV file, of name {tuner.tuner_path}/{ST_RESULTS_DATAFRAME_FILENAME}.

dataframe()[source]
Return type:

DataFrame

on_tuning_start(tuner)[source]

Called at start of tuning loop

Parameters:

tunerTuner object

on_tuning_end()[source]

Called once the tuning loop terminates

This is called before Tuner object is serialized (optionally), and also before running jobs are stopped.