smac.utils.io.traj_logging module

class smac.utils.io.traj_logging.TrajEntry(train_perf, incumbent_id, incumbent, ta_runs, ta_time_used, wallclock_time)

Bases: tuple

Create new instance of TrajEntry(train_perf, incumbent_id, incumbent, ta_runs, ta_time_used, wallclock_time)

count(value) → integer -- return number of occurrences of value
incumbent

Alias for field number 2

incumbent_id

Alias for field number 1

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

ta_runs

Alias for field number 3

ta_time_used

Alias for field number 4

train_perf

Alias for field number 0

wallclock_time

Alias for field number 5

class smac.utils.io.traj_logging.TrajLogger(output_dir, stats)[source]

Bases: object

Writes trajectory logs files and creates output directory if not exists already

stats
logger
output_dir
aclib_traj_fn
old_traj_fn
trajectory

Constructor

Parameters:
  • output_dir (str) – directory for logging (or None to disable logging)
  • stats (Stats()) – Stats object
add_entry(train_perf: float, incumbent_id: int, incumbent: ConfigSpace.configuration_space.Configuration)[source]

Adds entries to trajectory files (several formats) with using the same timestamps for each entry

Parameters:
  • train_perf (float) – estimated performance on training (sub)set
  • incumbent_id (int) – id of incumbent
  • incumbent (Configuration()) – current incumbent configuration
static read_traj_aclib_format(fn: str, cs: ConfigSpace.configuration_space.ConfigurationSpace)[source]

Reads trajectory from file

Parameters:
  • fn (str) – Filename with saved runhistory in self._add_in_aclib_format format
  • cs (ConfigurationSpace) – Configuration Space to translate dict object into Confiuration object
Returns:

trajectory – Each entry in the list is a dictionary of the form { “cpu_time”: float, “total_cpu_time”: None, # TODO “wallclock_time”: float, “evaluations”: int “cost”: float, “incumbent”: Configuration }

Return type:

list