JuliaDecisionFocusedLearning / InferOpt.jl

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

Test rrules with finite differences #118

Open gdalle opened 2 months ago

gdalle commented 2 months ago

Or ChainRulesTestUtils, but beware to keep the same seed.

Problem: our real-life function is an average over a finite number of samples, so its finite-differences (and true) gradient is almost zero. What we define as its gradient through the rrule is actually the Monte-Carlo approximation of the expectation (over an infinite number of samples). Take a large enough finite difference step or enough samples to mitigate piecewise-constantness.

Our functions are not smooth, but for FYL + SPO + SSVM for instance we return a subgradient. Can we test that property in the convex case?