Share via


IProgressChannel Interface

Definition

A common interface for progress reporting. It is expected that the progress channel interface is used from only one thread.

Supported workflow:

  1. Create the channel via StartProgressChannel(String).
  2. Call SetHeader(ProgressHeader, Action<IProgressEntry>) as many times as desired (including 0). Each call to SetHeader(ProgressHeader, Action<IProgressEntry>) supersedes the previous one.
  3. Report checkpoints (0 or more) by calling Checkpoint(Nullable<Double>[]).
  4. Repeat steps 2-3 as often as necessary.
  5. Dispose the channel.
public interface IProgressChannel : IDisposable, Microsoft.ML.Runtime.IProgressChannelProvider
type IProgressChannel = interface
    interface IProgressChannelProvider
    interface IDisposable
Public Interface IProgressChannel
Implements IDisposable, IProgressChannelProvider
Implements

Methods

Checkpoint(Nullable<Double>[])

Submit a 'checkpoint' entry. These entries are guaranteed to be delivered to the progress listener, if it is interested. Typically, this would contain some intermediate metrics, that are only calculated at certain moments ('checkpoints') of the computation.

For example, SDCA may report a checkpoint every time it computes the loss, or LBFGS may report a checkpoint every iteration.

The only parameter, values, is interpreted in the following fashion:

  • First MetricNames.Length items, if present, are metrics.
  • Subsequent ProgressNames.Length items, if present, are progress units.
  • Subsequent ProgressNames.Length items, if present, are progress limits.
  • If any more values remain, an exception is thrown.
SetHeader(ProgressHeader, Action<IProgressEntry>)

Set up the reporting structure:

  • Set the 'header' of the progress reports, defining which progress units and metrics are going to be reported.
  • Provide a thread-safe delegate to be invoked whenever anyone needs to know the progress.

It is acceptable to call SetHeader(ProgressHeader, Action<IProgressEntry>) multiple times (or none), regardless of whether the calculation is running or not. Because of synchronization, the computation should not deny calls to the 'old' fillAction delegates even after a new one is provided.

StartProgressChannel(String)

Create a progress channel for a computation named name.

(Inherited from IProgressChannelProvider)

Applies to