Table of Contents

Interface IExperimentRun<T>

Namespace
AiDotNet.Interfaces
Assembly
AiDotNet.dll

Represents a single training run within an experiment.

public interface IExperimentRun<T>

Type Parameters

T

The numeric data type used for calculations (e.g., float, double).

Remarks

For Beginners: A run represents one attempt at training a model with specific settings. Each run records everything about that training session: what settings you used (parameters), how well it performed (metrics), and what it created (artifacts like the trained model).

Think of a run like a single entry in a lab notebook - it captures all the details of one specific experiment attempt.

Properties

EndTime

Gets the timestamp when the run ended.

DateTime? EndTime { get; }

Property Value

DateTime?

ExperimentId

Gets the experiment ID this run belongs to.

string ExperimentId { get; }

Property Value

string

RunId

Gets the unique identifier for this run.

string RunId { get; }

Property Value

string

RunName

Gets or sets the name of this run.

string? RunName { get; set; }

Property Value

string

StartTime

Gets the timestamp when the run was started.

DateTime StartTime { get; }

Property Value

DateTime

Status

Gets the current status of the run (Running, Completed, Failed, etc.).

string Status { get; }

Property Value

string

Tags

Gets the tags associated with this run.

ConcurrentDictionary<string, string> Tags { get; }

Property Value

ConcurrentDictionary<string, string>

Remarks

This property returns a thread-safe concurrent dictionary for safe multi-threaded access.

Methods

AddNote(string)

Adds a note or comment to the run.

void AddNote(string note)

Parameters

note string

The note content.

Complete()

Marks the run as completed successfully.

void Complete()

Fail(string?)

Marks the run as failed with an optional error message.

void Fail(string? errorMessage = null)

Parameters

errorMessage string

Description of the failure.

GetArtifacts()

Gets all artifacts logged for this run.

List<string> GetArtifacts()

Returns

List<string>

List of artifact paths.

GetLatestMetric(string)

Gets the latest value for a specific metric.

T? GetLatestMetric(string metricName)

Parameters

metricName string

The name of the metric.

Returns

T

The latest metric value, or null if not found.

GetMetrics()

Gets all metrics logged for this run.

Dictionary<string, List<(int Step, T Value, DateTime Timestamp)>> GetMetrics()

Returns

Dictionary<string, List<(int Step, T Value, DateTime Timestamp)>>

Dictionary where keys are metric names and values are lists of (step, value, timestamp) tuples.

GetNotes()

Gets all notes added to this run.

List<(DateTime Timestamp, string Note)> GetNotes()

Returns

List<(DateTime Timestamp, string Note)>

List of notes with timestamps.

GetParameters()

Gets all parameters logged for this run.

Dictionary<string, object> GetParameters()

Returns

Dictionary<string, object>

Dictionary of parameter names and values.

LogArtifact(string, string?)

Logs an artifact (file) associated with this run.

void LogArtifact(string localPath, string? artifactPath = null)

Parameters

localPath string

Path to the file to log.

artifactPath string

Optional path within the artifact store.

Remarks

For Beginners: Artifacts are files produced during training, like:

  • Saved models
  • Training plots/visualizations
  • Configuration files
  • Log files

LogArtifacts(string, string?)

Logs a directory of artifacts.

void LogArtifacts(string localDir, string? artifactPath = null)

Parameters

localDir string

Path to the directory to log.

artifactPath string

Optional path within the artifact store.

LogMetric(string, T, int, DateTime?)

Logs a metric value at a specific step/iteration.

void LogMetric(string key, T value, int step = 0, DateTime? timestamp = null)

Parameters

key string

The metric name (e.g., "loss", "accuracy").

value T

The metric value.

step int

The training step/iteration number.

timestamp DateTime?

Optional timestamp for the metric.

Remarks

For Beginners: Metrics are measurements of how well your model is performing, like accuracy or loss. Unlike parameters, metrics change over time as the model trains. The step parameter lets you track how the metric changes over iterations.

LogMetrics(Dictionary<string, T>, int, DateTime?)

Logs multiple metrics at once for a specific step.

void LogMetrics(Dictionary<string, T> metrics, int step = 0, DateTime? timestamp = null)

Parameters

metrics Dictionary<string, T>

Dictionary of metric names and values.

step int

The training step/iteration number.

timestamp DateTime?

Optional timestamp for the metrics.

LogModel<TInput, TOutput, TMetadata>(IModel<TInput, TOutput, TMetadata>, string?)

Logs a trained model as an artifact.

void LogModel<TInput, TOutput, TMetadata>(IModel<TInput, TOutput, TMetadata> model, string? artifactPath = null) where TInput : class where TOutput : class where TMetadata : class

Parameters

model IModel<TInput, TOutput, TMetadata>

The model to log.

artifactPath string

Optional path within the artifact store.

Type Parameters

TInput
TOutput
TMetadata

LogParameter(string, object)

Logs a single parameter value for this run.

void LogParameter(string key, object value)

Parameters

key string

The parameter name.

value object

The parameter value.

Remarks

For Beginners: Parameters are the settings you chose for this training run, like learning rate, batch size, or number of layers. These are typically set at the start of training and don't change during the run.

LogParameters(Dictionary<string, object>)

Logs multiple parameters at once.

void LogParameters(Dictionary<string, object> parameters)

Parameters

parameters Dictionary<string, object>

Dictionary of parameter names and values.