Table of Contents

Namespace OptunaSharp.Distributions

Classes

BaseDistribution

Base class for distributions. Port of optuna/distributions.py: BaseDistribution.

Note that distribution classes are not supposed to be called by library users. They are used by Trial and samplers internally.

CategoricalDistribution

A categorical distribution. Port of optuna/distributions.py: CategoricalDistribution.

This object is instantiated by SuggestCategorical(string, IEnumerable<CategoricalChoice>), and passed to samplers in general.

DiscreteUniformDistribution

A discretized uniform distribution in the linear domain. Deprecated since Optuna 3.0.0: use FloatDistribution instead.

Distribution

Module-level functions of optuna/distributions.py: JSON round-trip (distribution_to_json / json_to_distribution) and check_distribution_compatibility. The storage layer depends on the JSON forms.

EnumCategorical

Bridges CLR enums to the string-only categorical machinery. An enum is convenience sugar over a CategoricalDistribution whose choices are the member-name strings: the type is never persisted โ€” it is a stateless lens the caller re-supplies at each boundary (SuggestCategorical<TEnum> on the way in, GetCategorical<TEnum> on the way out). Consequences to know: (1) the store cannot enforce that the same enum is used to write and read a parameter โ€” that consistency lives in your source; (2) renaming a member changes the emitted string, so trials stored before the rename no longer resolve. This keeps the wire, storage, and samplers byte-identical to a hand-written string categorical.

FloatDistribution

A distribution on floats. Port of optuna/distributions.py: FloatDistribution.

This object is instantiated by SuggestFloat(string, double, double, double?, bool), and passed to samplers in general.

IntDistribution

A distribution on integers. Port of optuna/distributions.py: IntDistribution.

This object is instantiated by SuggestInt(string, long, long, long, bool), and passed to samplers in general.

IntLogUniformDistribution

A uniform distribution on integers in the log domain. Deprecated since Optuna 3.0.0: use IntDistribution instead.

IntUniformDistribution

A uniform distribution on integers. Deprecated since Optuna 3.0.0: use IntDistribution instead.

LogUniformDistribution

A uniform distribution in the log domain. Deprecated since Optuna 3.0.0: use FloatDistribution instead.

UniformDistribution

A uniform distribution in the linear domain. Deprecated since Optuna 3.0.0: use FloatDistribution instead.

Structs

CategoricalChoice

A categorical parameter value โ€” Python's CategoricalChoiceType = Union[None, bool, int, float, str] as a value type.

Equality implements Python == semantics, which is a plan ยง2 ground rule: True == 1, 1.0 == 1, nan != nan, and cross-type number/string comparisons are false. This is the one place C# object equality would silently diverge from Optuna, so it is pinned by dedicated tests.

Enums

CategoricalChoiceKind

The kind of value a CategoricalChoice holds.