Class FrozenStudy
- Namespace
- OptunaSharp
- Assembly
- OptunaSharp.dll
Basic attributes of a Study. Port of optuna/study/_frozen.py: FrozenStudy.
This class is private in Optuna and not referenced by Optuna users.
public class FrozenStudy : IEquatable<FrozenStudy>, IComparable<FrozenStudy>
- Inheritance
-
FrozenStudy
- Implements
- Inherited Members
Constructors
FrozenStudy(string, StudyDirection?, OrderedDict<string, object?>, OrderedDict<string, object?>, int, IEnumerable<StudyDirection>?)
Builds a study record from persisted metadata and objective directions.
public FrozenStudy(string studyName, StudyDirection? direction, OrderedDict<string, object?> userAttrs, OrderedDict<string, object?> systemAttrs, 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.
userAttrsOrderedDict<string, object>User metadata; values should be JSON serializable for persistent storage.
systemAttrsOrderedDict<string, object>Internal metadata used by samplers and storage; preserve reserved keys.
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
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 list of StudyDirection objects.
public List<StudyDirection> Directions { get; }
Property Value
StudyName
Name of the Study.
public string StudyName { get; }
Property Value
SystemAttrs
Dictionary that contains the attributes internally set by Optuna.
public OrderedDict<string, object?> SystemAttrs { 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(FrozenStudy?)
Python lt / le: FrozenStudy is ordered by study id.
public int CompareTo(FrozenStudy? other)
Parameters
otherFrozenStudyStudy 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(FrozenStudy?)
Python eq: value equality over every field (other.dict == self.dict)
— study name, directions, user attributes, system attributes and study id.
public bool Equals(FrozenStudy? other)
Parameters
otherFrozenStudyValue 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(FrozenStudy?). Optuna's FrozenStudy is
unhashable (eq without hash); as elsewhere in the port we expose a
usable hash instead.
public override int GetHashCode()
Returns
- int
Hash code consistent with this type's equality contract.
Operators
operator ==(FrozenStudy?, FrozenStudy?)
Applies the == comparison using the type's value equality.
public static bool operator ==(FrozenStudy? left, FrozenStudy? right)
Parameters
leftFrozenStudyLeft operand of the comparison.
rightFrozenStudyRight operand of the comparison.
Returns
- bool
True when the comparison holds.
operator >(FrozenStudy, FrozenStudy)
Applies the > comparison by study identifier.
public static bool operator >(FrozenStudy left, FrozenStudy right)
Parameters
leftFrozenStudyLeft operand of the comparison.
rightFrozenStudyRight operand of the comparison.
Returns
- bool
True when the comparison holds.
operator >=(FrozenStudy, FrozenStudy)
Applies the >= comparison by study identifier.
public static bool operator >=(FrozenStudy left, FrozenStudy right)
Parameters
leftFrozenStudyLeft operand of the comparison.
rightFrozenStudyRight operand of the comparison.
Returns
- bool
True when the comparison holds.
operator !=(FrozenStudy?, FrozenStudy?)
Applies the != comparison using the type's value equality.
public static bool operator !=(FrozenStudy? left, FrozenStudy? right)
Parameters
leftFrozenStudyLeft operand of the comparison.
rightFrozenStudyRight operand of the comparison.
Returns
- bool
True when the comparison holds.
operator <(FrozenStudy, FrozenStudy)
Applies the < comparison by study identifier.
public static bool operator <(FrozenStudy left, FrozenStudy right)
Parameters
leftFrozenStudyLeft operand of the comparison.
rightFrozenStudyRight operand of the comparison.
Returns
- bool
True when the comparison holds.
operator <=(FrozenStudy, FrozenStudy)
Applies the <= comparison by study identifier.
public static bool operator <=(FrozenStudy left, FrozenStudy right)
Parameters
leftFrozenStudyLeft operand of the comparison.
rightFrozenStudyRight operand of the comparison.
Returns
- bool
True when the comparison holds.