lenskit.logging.progress#

class lenskit.logging.progress.Progress(*args, **kwargs)#

Bases: object

Base class for progress reporting. The default implementations do nothing.

Parameters:
  • args (Any)

  • kwargs (Any)

update(advance=1, **kwargs)#

Update the progress bar.

Parameters:
finish()#

Finish and clean up this progress bar. If the progresss bar is used as a context manager, this is automatically called on context exit.

lenskit.logging.progress.item_progress(label, total, fields=None)#

Create a progress bar for distinct, counted items.

Parameters:
  • label (str) – The progress bar label.

  • total (int) – The total number of items.

  • fields (dict[str, str | None] | None) – Additional fields to report with the progress bar (such as a current loss). These are specified as a dictionary mapping field names to format strings (the pieces inside {...} in str.format()), and the values come from extra kwargs to Progress.update(); mapping to None use default str formatting.

Return type:

Progress