Skip to content Skip to sidebar Skip to footer

How To Use Scipy.optimize.minimize Within Keras Model.compile?

I have a custom loss f = x + y where I have constraints such that while optimising f, x should be within a range of (0.10, 0.2) and y within the range of (0.6, 0.1), y is the mean

Solution 1:

You can use a custom training loop. The training loop can collect the gradients considering your keras loss function and you can then choose to optimize the weights using a given constraint.

I've implemented something similar; this code calls SciPy minimize to optimize a model's variables.

Post a Comment for "How To Use Scipy.optimize.minimize Within Keras Model.compile?"