Goal

class pmrf.evaluators.Goal(feature: str | AbstractExpression, operator: Literal['<', '<=', '>', '>=', '==', '='] = '==', target: Any = 0.0, weight: float | jnp.ndarray = 1.0, mask: jnp.ndarray | None = None, loss: Callable[[jnp.ndarray, jnp.ndarray], jnp.ndarray] = RMSELoss(), multioutput: str | Any = 'uniform_average')

Bases: TargetLoss

Computes a design goal using a hinge-based loss evaluator.

Initializes the optimization goal.

Parameters:
  • feature (str or AbstractExpression) – The feature to be evaluated. If a string is provided, it is automatically wrapped in a Feature expression.

  • operator ({'<', '<=', '>', '>=', '==', '='}, optional) – The relational operator defining the goal condition. ‘==’ and ‘=’ are treated as equivalent (equality). Default is ‘==’.

  • target (float or jnp.ndarray, optional) – The target value or array of values for the goal. Default is 0.0.

  • weight (float or jnp.ndarray, optional) – A scaling factor applied to the computed loss. Can be a scalar or an array for element-wise weighting. Default is 1.0.

  • mask (jnp.ndarray, optional) – A boolean or numerical mask used to include or exclude specific data points (e.g., specific frequencies) from the loss calculation. Default is None.

  • loss (str or Any, optional) – The base loss function. Defaults to RMSE. See pmrf.losses for common losses.

  • multioutput (str or Any, optional) – Defines how to aggregate losses across multiple outputs. Default is ‘uniform_average’.