Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Tensorflow optimizer for noisy non-differentiable loss function

I have build a model using the low-level tensorflow API that has only a couple of variables (about 10) that I want to optimize. Therefore I want to implement a custom loss function that produces noisy loss values (kind of like a simulation based optimization approach).

Usually I would a derivative free optimizer like the SPSA optimizer.

Is there a way to implement a loss function that is not differentiable and an optimizer like SPSA with the low-level tensorflow API?

PS: One might ask why use tensorflow for this? This is because I want to use tensorflow for convenient saving of the model and tensorboard for convenient and comprehensive visualization. Also I want to be able to switch and compare different models in a standardized framework.

like image 649
flxh Avatar asked Mar 11 '26 23:03

flxh


1 Answers

I think SPSA will work with non-differentiable functions also. For SPSA implementation: https://github.com/fraunhofer-iais/tensorflow_spsa

like image 102
v-i-s-h Avatar answered Mar 13 '26 12:03

v-i-s-h



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!