smac.utils.io.traj_logging

Classes

TrajEntry(train_perf, incumbent_id, ...)

TrajLogger(output_dir, stats)

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

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

Bases: tuple

budget

Alias for field number 6

incumbent

Alias for field number 2

incumbent_id

Alias for field number 1

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

Parameters
  • output_dir (str) –

  • logging) (directory for logging (or None to disable) –

  • stats (Stats()) –

  • object (Stats) –

stats
logger
output_dir
aclib_traj_fn
old_traj_fn
trajectory
add_entry(train_perf, incumbent_id, incumbent, budget=0)[source]

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

Parameters
  • train_perf (float or np.ndarray) – estimated performance on training (sub)set

  • incumbent_id (int) – id of incumbent

  • incumbent (Configuration()) – current incumbent configuration

  • budget (float) – budget used in intensifier to limit TA (default: 0)

Return type

None

static read_traj_aclib_format(fn, cs)[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, “wallclock_time”: float, “evaluations”: int “cost”: float or list of floats, “incumbent”: Configuration }

Return type

list

static read_traj_alljson_format(fn, cs)[source]

Reads trajectory from file

Parameters
  • fn (str) – Filename with saved runhistory in self._add_in_alljson_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, “wallclock_time”: float, “evaluations”: int “cost”: float or list of floats, “budget”: budget, “incumbent”: Configuration }

Return type

list