MATLAB Answers

0

Parametrizing Initial Points for fminunc

Asked by Yasin Simsek on 26 Sep 2019
Latest activity Edited by Matt J
on 30 Sep 2019
I want to minimize a function. When doing this I want also to parameterize initial points and try to optimze them. Indeed, i have a function which includes another optimization function. The main aim is selecting the optimal initial values for optimization of "likelihood" function.
function [loglik_value] = initialpoint(x1, x2, x3, x4, x5, x6, x7, x8)
x0 = [x1, x2, x3, x4, x5, x6, x7, x8];
options = optimoptions(@fminunc,'MaxFunctionEvaluations', 3000, 'MaxIterations', 1000, 'OptimalityTolerance', 10^(-8), 'UseParallel', true);
likelihood = @(x) gas_likelihood(x(1), x(2), x(3), x(4), x(5), x(6), x(7), x(8));
[~, val] = fminunc(likelihood, x0, options);
loglik_value = val;
end
But I get an error: Failure in initial objective function evaluation. FMINUNC cannot continue.
I think matlab cannot start to optimize likelihood function because it does not consider x0 as real numbers maybe it sees as a symbols. I am not sure. How can I deal with?

  0 Comments

Sign in to comment.

2 Answers

Answer by Raunak Gupta on 30 Sep 2019

Hi,
In my understanding you are trying to find an optimal initial value that will minimize the ‘gas_likelihood’ function that is mentioned in the question. Here since fminunc uses a gradient descent-based algorithm, for getting any solution it needs a numerical input so that in subsequent iterations the values can be updated numerically. If we give a parametric function as initial value, the gradient or trust region algorithm cannot give a numerical value of update and hence there is no property with which we can be assured that we are indeed going into the right direction while minimizing the function.
For the need of calculating the optimal initial value, it is well known that if the optimization function is convex, then solution will be the same after reasonable number of iterations irrespective of the starting point. For non-convex optimization function, we know that global optimum cannot be achieved every time (or we can say that convergence to global optimum is not guaranteed), we can only suggest a local optimum that is based on initialization point. So, finding the optimal initialization point in case of Non-convex functions is currently not feasible.

  0 Comments

Sign in to comment.


Answer by Matt J
on 30 Sep 2019
Edited by Matt J
on 30 Sep 2019

Failure in initial objective function evaluation. FMINUNC cannot continue.
Since gas_likelihood is generating an error, then you should debug it.

  0 Comments

Sign in to comment.