pyepo.metric.unambregret

Unambiguous regret loss

Functions

unambRegret(predmodel, optmodel, dataloader[, tolerance])

A function to evaluate model performance with normalized unambiguous regret

calUnambRegret(optmodel, pred_cost, true_cost, true_obj)

A function to calculate normalized unambiguous regret for a batch

Module Contents

pyepo.metric.unambregret.unambRegret(predmodel, optmodel, dataloader, tolerance=1e-05)

A function to evaluate model performance with normalized unambiguous regret

Parameters:
  • predmodel (nn) – a regression neural network for cost prediction

  • optmodel (optModel) – a PyEPO optimization model

  • dataloader (DataLoader) – Torch dataloader from optDataSet

  • tolerance (float) – tolerance for optimization

Returns:

unambiguous regret loss

Return type:

float

pyepo.metric.unambregret.calUnambRegret(optmodel, pred_cost, true_cost, true_obj, tolerance=1e-05, max_iter=10)

A function to calculate normalized unambiguous regret for a batch

Parameters:
  • optmodel (optModel) – optimization model

  • pred_cost (torch.tensor) – predicted costs

  • true_cost (torch.tensor) – true costs

  • true_obj (torch.tensor) – true optimal objective values

  • tolerance (float) – tolerance for precision

  • max_iter (int) – maximum number of recursive retries

Returns:

unambiguous regret losses

Return type:

float