Target#

class obsidian.parameters.targets.Target(name: str, f_transform: str | None = 'Standard', aim: str = 'max')[source]#

Bases: object

Base class for optimization response targets.

__init__(name: str, f_transform: str | None = 'Standard', aim: str = 'max')[source]#

Methods

__init__(name[, f_transform, aim])

load_state(obj_dict)

Loads the state of the target object from a dictionary.

save_state()

Saves the state of the object as a dictionary.

transform_f(f[, inverse, fit])

Converts a raw response to an objective function value ("score").

classmethod load_state(obj_dict: dict)[source]#

Loads the state of the target object from a dictionary.

Parameters:
  • cls (class) – The class of the target object.

  • obj_dict (dict) – A dictionary containing the state of the target object.

Returns:

The loaded target object.

save_state() dict[source]#

Saves the state of the object as a dictionary.

Returns:

A dictionary containing the state of the object.

Return type:

dict

transform_f(f: float | int | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], inverse=False, fit=False)[source]#

Converts a raw response to an objective function value (“score”). Cost-penalization and response transformation should be handled here.

Parameters:
  • f (array-like) – The column(s) containing the response values (y)

  • inverse (bool, optional) – An indicator to perform the inverse transform. Defaults to False.

  • fit (bool, optional) – An indicator to fit the properties of the transform function. Defaults to False.

Returns:

An array of transformed f values matching the responses in Z

Return type:

pd.Series

Raises:
  • TypeError – If f is not numeric or array-like

  • UnfitError – If the transform function is called without being fit first