Functions to read the optimization log

Functions to read data from the database used for logging.

The functions in the module are meant for end users of estimagic. They do not require any knowledge of databases.

When using them internally (e.g. in the dashboard), make sure to supply a database to path_or_database. Otherwise, the functions may be very slow.

estimagic.logging.read_log.read_optimization_iteration(path_or_database, iteration, include_internals=False)[source]

Get information about an optimization iteration.

Parameters
  • path_or_database (pathlib.Path, str or sqlalchemy.MetaData) –

  • iteration (int) – The index of the iteration that should be retrieved. The row_id behaves as Python list indices, i.e. 0 identifies the first iteration, -1 the last one, etc.

  • include_internals (bool) – Whether internally used quantities like the internal parameter vector and the corresponding derivative etc. are included in the result. Default False. This should only be used by advanced users.

Returns

The logged information corresponding to the iteration. The keys correspond

to database columns.

Return type

dict

Raises

KeyError – if the iteration is out of bounds.

estimagic.logging.read_log.read_start_params(path_or_database)[source]

Load the start parameters DataFrame.

Parameters

path_or_database (pathlib.Path, str or sqlalchemy.MetaData) –

Returns

see How to specify start parameters.

Return type

params (pd.DataFrame)