Class StudySummary
- Namespace
- OptunaSharp
- Assembly
- OptunaSharp.dll
Basic attributes and aggregated results of a Study.
Port of optuna/study/_study_summary.py: StudySummary.
See also GetAllStudySummaries(BaseStorage, bool).
public class StudySummary : IEquatable<StudySummary>, IComparable<StudySummary>
- Inheritance
-
StudySummary
- Implements
- Inherited Members
Constructors
StudySummary(string, StudyDirection?, FrozenTrial?, OrderedDict<string, object?>, int, DateTime?, int, IEnumerable<StudyDirection>?)
Builds a study record from persisted metadata and objective directions.
public StudySummary(string studyName, StudyDirection? direction, FrozenTrial? bestTrial, OrderedDict<string, object?> userAttrs, int nTrials, DateTime? datetimeStart, int studyId, IEnumerable<StudyDirection>? directions = null)
Parameters
studyNamestringName identifying the study in the selected storage.
directionStudyDirection?Single objective direction; ignored when a directions sequence is supplied.
bestTrialFrozenTrialBest single-objective trial, or null when unavailable or deliberately omitted.
userAttrsOrderedDict<string, object>User metadata; values should be JSON serializable for persistent storage.
nTrialsintNumber of trials represented by this summary.
datetimeStartDateTime?Local start time, or null when the trial or study has not started.
studyIdintStorage identifier of the study; distinct from its name.
directionsIEnumerable<StudyDirection>Objective directions in the same order as the objective values.
Remarks
Directions are materialized; supplied attribute dictionaries and any best-trial object are retained by reference.
Exceptions
- ValueError
Neither direction nor directions is supplied.
Properties
BestTrial
FrozenTrial with best objective value in the Study.
public FrozenTrial? BestTrial { get; }
Property Value
DatetimeStart
Datetime where the Study started.
public DateTime? DatetimeStart { get; }
Property Value
Direction
StudyDirection of the study. Only available during single-objective optimization.
public StudyDirection Direction { get; }
Property Value
Exceptions
- RuntimeError
There is more than one objective direction.
- ArgumentOutOfRangeException
The directions collection is empty.
Directions
A sequence of StudyDirection objects.
public IReadOnlyList<StudyDirection> Directions { get; }
Property Value
NTrials
The number of trials ran in the Study.
public int NTrials { get; }
Property Value
StudyName
Name of the Study.
public string StudyName { get; }
Property Value
UserAttrs
Dictionary that contains the attributes of the study set with SetUserAttr(string, object?).
public OrderedDict<string, object?> UserAttrs { get; }
Property Value
Methods
CompareTo(StudySummary?)
Python lt / le: StudySummary is ordered by study id.
public int CompareTo(StudySummary? other)
Parameters
otherStudySummaryStudy record to compare by identifier; null sorts before this instance.
Returns
- int
Negative, zero, or positive according to study identifier order; null sorts first.
Equals(StudySummary?)
Python eq: value equality over every field (Optuna compares
other.dict == self.dict) — study name, directions, best trial, user
attributes, trial count, start datetime and study id.
public bool Equals(StudySummary? other)
Parameters
otherStudySummaryValue to compare with this instance; null compares unequal.
Returns
- bool
True when the other value has the same type and equal recorded fields.
Equals(object?)
Compares the fields participating in value equality.
public override bool Equals(object? obj)
Parameters
objobjectObject to compare with this instance.
Returns
- bool
True when the other value has the same type and equal recorded fields.
GetHashCode()
A hash consistent with Equals(StudySummary?). Optuna's StudySummary
is actually unhashable (it defines eq without hash), but — as with
the FrozenTrial port — we expose a usable hash rather than replicate that.
public override int GetHashCode()
Returns
- int
Hash code consistent with this type's equality contract.
Operators
operator ==(StudySummary?, StudySummary?)
Applies the == comparison using the type's value equality.
public static bool operator ==(StudySummary? left, StudySummary? right)
Parameters
leftStudySummaryLeft operand of the comparison.
rightStudySummaryRight operand of the comparison.
Returns
- bool
True when the comparison holds.
operator >(StudySummary, StudySummary)
Applies the > comparison by study identifier.
public static bool operator >(StudySummary left, StudySummary right)
Parameters
leftStudySummaryLeft operand of the comparison.
rightStudySummaryRight operand of the comparison.
Returns
- bool
True when the comparison holds.
operator >=(StudySummary, StudySummary)
Applies the >= comparison by study identifier.
public static bool operator >=(StudySummary left, StudySummary right)
Parameters
leftStudySummaryLeft operand of the comparison.
rightStudySummaryRight operand of the comparison.
Returns
- bool
True when the comparison holds.
operator !=(StudySummary?, StudySummary?)
Applies the != comparison using the type's value equality.
public static bool operator !=(StudySummary? left, StudySummary? right)
Parameters
leftStudySummaryLeft operand of the comparison.
rightStudySummaryRight operand of the comparison.
Returns
- bool
True when the comparison holds.
operator <(StudySummary, StudySummary)
Applies the < comparison by study identifier.
public static bool operator <(StudySummary left, StudySummary right)
Parameters
leftStudySummaryLeft operand of the comparison.
rightStudySummaryRight operand of the comparison.
Returns
- bool
True when the comparison holds.
operator <=(StudySummary, StudySummary)
Applies the <= comparison by study identifier.
public static bool operator <=(StudySummary left, StudySummary right)
Parameters
leftStudySummaryLeft operand of the comparison.
rightStudySummaryRight operand of the comparison.
Returns
- bool
True when the comparison holds.