ExperimentRun<T>
Models & Types · AiDotNet.Models
Represents a single training run within an experiment.
Implements: IExperimentRun<T>
How It Works
This class is thread-safe and can be safely accessed from multiple threads concurrently.
Constructors
| Constructor | Summary |
|---|---|
ExperimentRun(string experimentId, string runName, Dictionary<string, string> tags) |
Initializes a new instance of the ExperimentRun class. |
Properties
| Property | Summary |
|---|---|
ConcurrentDictionary<string, string> Tags { get; set; } |
Gets the tags associated with this run in a thread-safe manner. |
DateTime StartTime { get; set; } |
Gets the timestamp when the run was started. |
DateTime? EndTime { get; set; } |
Gets the timestamp when the run ended. |
string ExperimentId { get; set; } |
Gets the experiment ID this run belongs to. |
string RunId { get; set; } |
Gets the unique identifier for this run. |
string RunName { get; set; } |
Gets or sets the name of this run. |
string Status { get; set; } |
Gets the current status of the run. |
Methods
| Method | Summary |
|---|---|
Dictionary<string, List<ValueTuple<int, T, DateTime>>> GetMetrics() |
Gets all metrics logged for this run. |
Dictionary<string, object> GetParameters() |
Gets all parameters logged for this run. |
List<ValueTuple<DateTime, string>> GetNotes() |
Gets all notes added to this run. |
List<string> GetArtifacts() |
Gets all artifacts logged for this run. |
T GetLatestMetric(string metricName) |
Gets the latest value for a specific metric. |
TimeSpan? GetDuration() |
Gets the duration of the run. |
string GetErrorMessage() |
Gets the error message if the run failed. |
void AddNote(string note) |
Adds a note or comment to the run. |
void Complete() |
Marks the run as completed successfully. |
void Fail(string errorMessage) |
Marks the run as failed with an optional error message. |
void LogArtifact(string localPath, string artifactPath) |
Logs an artifact (file) associated with this run. |
void LogArtifacts(string localDir, string artifactPath) |
Logs a directory of artifacts. |
void LogMetric(string key, T value, int step, DateTime? timestamp) |
Logs a metric value at a specific step/iteration. |
void LogMetrics(Dictionary<string, T> metrics, int step, DateTime? timestamp) |
Logs multiple metrics at once for a specific step. |
void LogModel(IModel<TInput, TOutput, TMetadata> model, string artifactPath) |
Logs a trained model as an artifact. |
void LogParameter(string key, object value) |
Logs a single parameter value for this run. |
void LogParameters(Dictionary<string, object> parameters) |
Logs multiple parameters at once. |