Table of Contents

Class BaseDistribution

Namespace
OptunaSharp.Distributions
Assembly
OptunaSharp.dll

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.

public abstract class BaseDistribution : IEquatable<BaseDistribution>
Inheritance
BaseDistribution
Implements
Derived
Inherited Members

Methods

Equals(BaseDistribution?)

Python eq: same concrete type and equal attributes.

public abstract bool Equals(BaseDistribution? other)

Parameters

other BaseDistribution

Value to compare with this instance; null compares unequal.

Returns

bool

True when the distributions have compatible types and equal attributes.

Equals(object?)

Compares distribution types and their defining attributes.

public override bool Equals(object? obj)

Parameters

obj object

Object to compare with this instance.

Returns

bool

True when the distributions have compatible types and equal attributes.

GetHashCode()

Computes a hash from the distribution type and defining attributes.

public override abstract int GetHashCode()

Returns

int

Hash code consistent with distribution equality.

Single()

Test whether the range of this distribution contains just a single value.

public abstract bool Single()

Returns

bool

True when sampling can be replaced by the sole allowed value.

ToExternalRepr(double)

Convert internal representation of a parameter value into external representation.

public virtual object? ToExternalRepr(double paramValueInInternalRepr)

Parameters

paramValueInInternalRepr double

Optuna's internal representation of a parameter value.

Returns

object

Optuna's external representation of a parameter value.

ToInternalRepr(object?)

Convert external representation of a parameter value into internal representation.

public abstract double ToInternalRepr(object? paramValueInExternalRepr)

Parameters

paramValueInExternalRepr object

Optuna's external representation of a parameter value.

Returns

double

Optuna's internal representation of a parameter value.

Exceptions

ValueError

The value cannot be converted, is NaN for a numeric distribution, is nonpositive in a logarithmic distribution, or is not a categorical candidate.

ToString()

Python repr: ClassName(key1=value1, key2=value2) with keys sorted.

public override string ToString()

Returns

string

Python-style distribution representation with attribute names sorted ordinally.

Operators

operator ==(BaseDistribution?, BaseDistribution?)

Applies the == comparison using the type's value equality.

public static bool operator ==(BaseDistribution? left, BaseDistribution? right)

Parameters

left BaseDistribution

Left operand of the comparison.

right BaseDistribution

Right operand of the comparison.

Returns

bool

True when the comparison holds.

operator !=(BaseDistribution?, BaseDistribution?)

Applies the != comparison using the type's value equality.

public static bool operator !=(BaseDistribution? left, BaseDistribution? right)

Parameters

left BaseDistribution

Left operand of the comparison.

right BaseDistribution

Right operand of the comparison.

Returns

bool

True when the comparison holds.