Logging

Creating & debugging surrogate models can be tricky so JuliaSimSurrogates.jl provides a dedicated component to help. Logging is generic and available at every step of the surrogate generation process. One can imagine many useful cases. For example, record how data was generated for training this surrogate.

Parts

There are two main areas where logging becomes crucial: performance & reproducibility.

  • Performace
    • Speed: How performant is your code?
  • Reproducibility
    • MLOps: How are experiments tracked?

Logging can help improve engineering productivity by identifying runtime bottlenecks and keeping detailed experiment logs.

Macros

Users interact with the Logging component through its exported macros.

  • @log
  • @restore
  • @list

@log

Users may generate various data structures which change throughout a program. The @log macro is used to log a revision of a structure. To use this macro, just provide the variable name representing the structure of interest. Say for example the variable x exists, to create a record of x just write:

@log x

@restore

So @log gives users the ability to record revisions of various structures. Then @restore provides the useful feature of easily jumping between different revisions. This can be achieved by specifying the variable name along with the desired revision. For example, variable x can be restored to its first logged state by:

@restore x 1

@list

Now that users can @log & @restore versions of structures, the only other quesion is what versions of a given structure exist? Users can use the @list macro to display all version of a given variable. All reversions of variable x can be shown with:

@list x
Tip

If custom show methods are defined for a specified structure, then the @list macro will use it to display the versions.