Parametrizing Initial Points for fminunc

6 次查看(过去 30 天)
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?

回答(2 个)

Raunak Gupta
Raunak Gupta 2019-9-30
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.

Matt J
Matt J 2019-9-30
编辑:Matt J 2019-9-30
Failure in initial objective function evaluation. FMINUNC cannot continue.
Since gas_likelihood is generating an error, then you should debug it.

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by