TargetLoss
- class pmrf.evaluators.TargetLoss(predictor: Callable[[PyTree, Frequency], jnp.ndarray], target: Any, loss: Callable[[jnp.ndarray, jnp.ndarray], jnp.ndarray], *, name: str | None = None, metadata: Any = None)
Bases:
AbstractEvaluatorComputes a loss between a model prediction and some target.
- Parameters:
predictor (Callable[[jaxtyping.PyTree, pmrf.frequency.Frequency], jax.jaxlib._jax.Array]) – The predictor (e.g. another Evaluator) that extracts model features. Can be a function or a PyTree with optional parameters.
target (numpy.ndarray) – The fixed or ‘true’ target that the loss function should compare the prediction to.
loss (Callable[[jax.jaxlib._jax.Array, jax.jaxlib._jax.Array], jax.jaxlib._jax.Array]) – The loss function that takes (y_true, y_pred) and returns a loss metric. Can be a function or a PyTree with optional parameters. See
pmrf.lossesfor common losses.
- __call__(model: PyTree, frequency: Frequency, **kwargs) Array
Evaluate the model response over the specified frequency range.
- Parameters:
model (PyTree) – The parameter PyTree to evaluate.
freq (Frequency) – The frequency object defining the evaluation points.
**kwargs (dict) – Additional keyword arguments for the evaluation process.
- Returns:
The evaluated model response.
- Return type:
jnp.ndarray
- loss: Callable[[Array, Array], Array]
The active loss function.
- target: ndarray
The fixed target data.