JuliaDecisionFocusedLearning / InferOpt.jl

Combinatorial optimization layers for machine learning pipelines
https://juliadecisionfocusedlearning.github.io/InferOpt.jl/
MIT License
113 stars 4 forks source link

Allow more general objectives in combinatorial layers #25

Closed BatyLeo closed 1 year ago

BatyLeo commented 2 years ago

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.