Is it possible to use non-differentiable loss functions for discrete / combinatoric problems, e.g. producing a symbolic formula to give a ranking score for the best next city to visit in a traveling salesman problem? (Guess it’s unlikely but would like to ask.)
Yeah you can use loss_function
to write a custom loss. No need for it to be differentiable either, anything is allowed.
You should also check out “template expressions”: Parameterized Template Expressions · SymbolicRegression.jl
Read through the forum for other examples of this: MilesCranmer/PySR · Discussions · GitHub. The forums for PySR and SymbolicRegression are unified to that page. There’s probably over 100 examples of custom loss functions.
2 Likes
Thank you very much.