NumericalTarget

class baybe.targets.numerical.NumericalTarget[source]

Bases: Target, SerialMixin

Class for numerical targets.

Public methods

__init__(name, *args[, ...])

Translate legacy target specifications.

abs()

Apply an absolute transformation to the target.

clamp([min, max])

Clamp the target to a given range.

exp()

Apply an exponential transformation to the target.

from_dict(dictionary)

Create an object from its dictionary representation.

from_json(string)

Create an object from its JSON representation.

from_legacy_interface(name, mode[, bounds, ...])

A deprecation helper for creating targets using the legacy interface.

from_modern_interface(name[, ...])

A deprecation helper for creating targets using the modern interface.

get_codomain([interval])

Get the codomain of an interval (assuming transformation continuity).

get_image([interval])

Get the image of an interval (assuming transformation continuity).

log()

Apply a logarithmic transformation to the target.

match_absolute(name, match_value, *[, metadata])

Create a target to match a given value using an absolute transformation.

match_bell(name, match_value, sigma, *[, ...])

Create a target to match a given value using a bell transformation.

match_power(name, match_value, exponent, *)

Create a target to match a given value using a power transformation.

match_quadratic(name, match_value, *[, metadata])

Create a target to match a given value using a quadratic transformation.

match_triangular(name[, match_value, ...])

Create a target to match a given value using a triangular transformation.

negate()

Apply a negation transformation to the target.

normalize()

Normalize the target to the unit interval using an affine transformation.

normalized_ramp(name, cutoffs, *[, ...])

Create a target that is affine in a given range and clamped to 0/1 outside.

normalized_sigmoid(name, anchors, *[, metadata])

Create a sigmoid-transformed target.

power(exponent)

Apply a power transformation to the target.

summary()

Return a custom summarization of the target.

to_dict()

Create an object's dictionary representation.

to_json()

Create an object's JSON representation.

to_objective()

Create a single-task objective from the target.

transform([series, data])

Transform target measurements to computational representation.

Public attributes and properties

transformation

An optional target transformation.

minimize

Boolean flag indicating if the target is to be minimized.

description

The description of the target.

is_normalized

Boolean flag indicating if the target is normalized to the unit interval.

metadata

Optional metadata containing description, unit, and other information.

name

The name of the target.

unit

The unit of measurement for the target.

__init__(name: str, *args, _enforce_modern_interface: bool = False, **kwargs)[source]

Translate legacy target specifications.

For details on the parameters, see Public attributes and properties.

abs()[source]

Apply an absolute transformation to the target.

Return type:

NumericalTarget

Returns:

The target with applied absolute transformation.

clamp(min: float | None = None, max: float | None = None)[source]

Clamp the target to a given range.

Parameters:
  • min (Optional[float]) – The minimum value of the clamping range.

  • max (Optional[float]) – The maximum value of the clamping range.

Return type:

NumericalTarget

Returns:

The clamped target.

exp()[source]

Apply an exponential transformation to the target.

Return type:

NumericalTarget

Returns:

The target with applied exponential transformation.

classmethod from_dict(dictionary: dict)

Create an object from its dictionary representation.

Parameters:

dictionary (dict) – The dictionary representation.

Return type:

TypeVar(_T, bound= SerialMixin)

Returns:

The reconstructed object.

classmethod from_json(string: str)

Create an object from its JSON representation.

Parameters:

string (str) – The JSON representation of the object.

Return type:

TypeVar(_T, bound= SerialMixin)

Returns:

The reconstructed object.

classmethod from_legacy_interface(name: str, mode: TargetMode, bounds: Interval | Iterable[float] | None = None, transformation: TargetTransformation | None = None, *, metadata: MeasurableMetadata | dict[str, Any] | None = None)[source]

A deprecation helper for creating targets using the legacy interface.

Parameters:
  • name (str) – The name of the target.

  • mode (TargetMode) – The target mode (MAX, MIN, MATCH).

  • bounds (Union[Interval, Iterable[float], None]) – Optional target bounds.

  • transformation (Optional[TargetTransformation]) – An optional target transformation.

  • metadata (Union[MeasurableMetadata, dict[str, Any], None]) – Optional metadata containing description, unit, and other information.

Return type:

NumericalTarget

Returns:

The created target object.

classmethod from_modern_interface(name: str, transformation: Transformation | None = None, *, minimize: bool = False, metadata: MeasurableMetadata | dict[str, Any] | None = None)[source]

A deprecation helper for creating targets using the modern interface.

Parameters:
Return type:

NumericalTarget

Returns:

The created target object.

get_codomain(interval: Interval | None = None, /)[source]

Get the codomain of an interval (assuming transformation continuity).

Return type:

Interval

get_image(interval: Interval | None = None, /)[source]

Get the image of an interval (assuming transformation continuity).

Return type:

Interval

log()[source]

Apply a logarithmic transformation to the target.

Return type:

NumericalTarget

Returns:

The target with applied logarithmic transformation.

classmethod match_absolute(name: str, match_value: float, *, metadata: MeasurableMetadata | dict[str, Any] | None = None)[source]

Create a target to match a given value using an absolute transformation.

Parameters:
Return type:

NumericalTarget

Returns:

The target with applied absolute matching transformation.

classmethod match_bell(name: str, match_value: float, sigma: float, *, metadata: MeasurableMetadata | dict[str, Any] | None = None)[source]

Create a target to match a given value using a bell transformation.

Parameters:
Return type:

NumericalTarget

Returns:

The target with applied bell matching transformation.

classmethod match_power(name: str, match_value: float, exponent: int, *, metadata: MeasurableMetadata | dict[str, Any] | None = None)[source]

Create a target to match a given value using a power transformation.

Parameters:
Return type:

NumericalTarget

Returns:

The target with applied power matching transformation.

classmethod match_quadratic(name: str, match_value: float, *, metadata: MeasurableMetadata | dict[str, Any] | None = None)[source]

Create a target to match a given value using a quadratic transformation.

Parameters:
Return type:

NumericalTarget

Returns:

The target with applied quadratic matching transformation.

classmethod match_triangular(name: str, match_value: float | None = None, *, cutoffs: Interval | Iterable[float] | None = None, width: float | None = None, margins: Sequence[float] | None = None, metadata: MeasurableMetadata | dict[str, Any] | None = None)[source]

Create a target to match a given value using a triangular transformation.

Parameters:
Raises:

ValueError – If more than one of cutoffs, width, or margins is provided.

Return type:

NumericalTarget

Returns:

The target with applied triangular matching transformation.

negate()[source]

Apply a negation transformation to the target.

Return type:

NumericalTarget

Returns:

The target with applied negation transformation.

normalize()[source]

Normalize the target to the unit interval using an affine transformation.

Raises:

IncompatibilityError – If the target image is not bounded.

Return type:

NumericalTarget

Returns:

The normalized target.

classmethod normalized_ramp(name: str, cutoffs: Interval | Iterable[float] | None, *, descending: bool = False, metadata: MeasurableMetadata | dict[str, Any] | None = None)[source]

Create a target that is affine in a given range and clamped to 0/1 outside.

Parameters:
Return type:

NumericalTarget

Returns:

The target with applied clamped affine transformation.

classmethod normalized_sigmoid(name: str, anchors: Sequence[Sequence[float]], *, metadata: MeasurableMetadata | dict[str, Any] | None = None)[source]

Create a sigmoid-transformed target.

Parameters:
Return type:

NumericalTarget

Returns:

The target with applied sigmoid transformation.

power(exponent: int)[source]

Apply a power transformation to the target.

Parameters:

exponent (int) – The exponent of the power transformation.

Return type:

NumericalTarget

Returns:

The target with applied power transformation.

summary()[source]

Return a custom summarization of the target.

to_dict()

Create an object’s dictionary representation.

Return type:

dict

Returns:

The dictionary representation of the object.

to_json()

Create an object’s JSON representation.

Return type:

str

Returns:

The JSON representation as a string.

to_objective()

Create a single-task objective from the target.

Return type:

SingleTargetObjective

transform(series: Series | None = None, /, *, data: DataFrame | None = None)[source]

Transform target measurements to computational representation.

Parameters:

series (Optional[Series]) – The target measurements in experimental representation to be transformed.

Return type:

Series

Returns:

A series containing the transformed measurements. The series name matches that of the input.

property description: str | None

The description of the target.

property is_normalized: UncertainBool

Boolean flag indicating if the target is normalized to the unit interval.

metadata: MeasurableMetadata

Optional metadata containing description, unit, and other information.

minimize: bool

Boolean flag indicating if the target is to be minimized.

name: str

The name of the target.

transformation: Transformation

An optional target transformation.

property unit: str | None

The unit of measurement for the target.