This a python notebook to understand alternate optimization approach for a simple function in two variables.
- Pytorch as general optimizer: https://towardsdatascience.com/how-to-use-pytorch-as-a-general-optimizer-a91cbf72a7fb
- Alternate minimization problem: https://kusemanohar.info/2019/10/15/alternating-minimization/
We need to minimize a function f(x, y) for x and y defines as follows
The solution is
Refer reference 2) for details.
- Initialize a value of x
- For the fixed value of x, optimize f(x, y) for y(keeping x constant)
- For the optimzed value of y(y*), optimize f(x, y) for x(keeping y* constant)
x = 2.0051544
y = -1.1908405
f(x, y) = -5.9291
As we can see, the solution is quite accutate as compared to the numerical solution.