Currently, InferOpt fully supports predictors of the form $\arg\max_y \theta^\top y$ in combinatorial layers.
It would be interesting to allow the more general form $$\arg\max_y \theta^\top g(y) + h(y)$$
For the moment, a workaround is to make your predictor return $g(y)$ instead of $y$. This way, gradient computation are correct, but loss value computations are not when $h\neq0$ (there is a missing term), therefore the training will work but the loss metric value will be slightly incorrect.
One implementation option would be to enforce returning the objective value as an additional output of the predictor.
Currently,
InferOpt
fully supports predictors of the form $\arg\max_y \theta^\top y$ in combinatorial layers. It would be interesting to allow the more general form $$\arg\max_y \theta^\top g(y) + h(y)$$ For the moment, a workaround is to make yourpredictor
return $g(y)$ instead of $y$. This way, gradient computation are correct, but loss value computations are not when $h\neq0$ (there is a missing term), therefore the training will work but the loss metric value will be slightly incorrect.One implementation option would be to enforce returning the objective value as an additional output of the
predictor
.