Extrapolation and interpolation in line search optimization

In summary, the equations A and B used in the code for fmincg.m in MATLAB come from the Coursera Machine Learning course taught by Andrew Ng. These equations are used for either cubic or quadratic interpolation, depending on a condition in the code. The source of these equations cannot be verified, so it is best to rely on the code for proper implementation.
  • #1
mathu2057
1
0
hi
can you tell me these equations:

A = 6*(f2-f3)/z3+3*(d2+d3); % cubic fit
B = 3*(f3-f2)-z3*(d3+2*d2);
z2 = (sqrt(B*B-A*d2*z3*z3)-B)/A; % numerical error
in MATLAB fmincg.m
https://github.com/emersonmoretto/mlclass-ex3/blob/master/fmincg.m
come from where??
it is either cubic interpolation or cubic interpolation...i look for
these equation in many website and books numerical optimization but
i do not find these equation even the book numerical optimization
for Peter Glynn Stephen M. Robinson p:57.(in the attachment copy of the page).it is not same in matlab
please help me from where these equation come from?
 

Attachments

  • eqq.jpg
    eqq.jpg
    53.7 KB · Views: 81
Mathematics news on Phys.org
  • #2
From the MATLAB site I found some mention that they came from Coursera Machine Learning course taught by Andrew Ng.

https://www.mathworks.com/matlabcen...rization-used-to-classify-hand-written-digits

https://scicomp.stackexchange.com/questions/25876/understanding-matlabs-fmincg-optimization-function

In the code there is a test f2>f1 if true then a quadratic fit is done and if false then a cubit fit is done.

Matlab:
  if f2 > f1
    z2 = z3 - (0.5*d3*z3*z3)/(d3*z3+f2-f3);                 % quadratic fit
  else
    A = 6*(f2-f3)/z3+3*(d2+d3);                                 % cubic fit
    B = 3*(f3-f2)-z3*(d3+2*d2);
    z2 = (sqrt(B*B-A*d2*z3*z3)-B)/A;       % numerical error possible - ok!
  end

so I think you will just have to go with the code and not worry about where it comes from. The code should be sufficient for you to decide why they are needed. Of course, there is always the distinct possibility that the code is wrong but again you will have to test and decide if that's the case.
 

1. What is the difference between extrapolation and interpolation in line search optimization?

Extrapolation and interpolation are both techniques used in line search optimization to estimate the optimal value of a function. Extrapolation involves extending the known data points beyond the range of the data, while interpolation involves estimating values within the range of the data. In line search optimization, extrapolation is used to estimate the optimal step size for a given function, while interpolation is used to estimate the optimal function value at a given step size.

2. How do extrapolation and interpolation affect the efficiency of line search optimization?

The efficiency of line search optimization is greatly affected by the accuracy of extrapolation and interpolation. If the extrapolation or interpolation is inaccurate, it can lead to a suboptimal step size or function value, resulting in slower convergence or even failure to converge. Therefore, it is important to carefully select and validate the extrapolation and interpolation methods used in line search optimization.

3. What are some common methods for extrapolation and interpolation in line search optimization?

There are several commonly used methods for extrapolation and interpolation in line search optimization, including the secant method, quadratic interpolation, and cubic interpolation. These methods use different mathematical techniques to estimate the optimal step size and function value, and their performance can vary depending on the specific function being optimized.

4. How do you determine which extrapolation or interpolation method to use in line search optimization?

The choice of extrapolation or interpolation method in line search optimization depends on several factors, including the complexity of the function being optimized, the availability of derivative information, and the desired level of accuracy. It is important to carefully analyze these factors and select the most appropriate method for the specific optimization problem at hand.

5. Can extrapolation and interpolation be used together in line search optimization?

Yes, extrapolation and interpolation can be used together in line search optimization. In fact, many optimization algorithms use a combination of both techniques to improve the accuracy and efficiency of the optimization process. For example, the Brent method combines the secant method for extrapolation with quadratic interpolation to estimate the optimal step size in line search optimization.

Similar threads

  • Programming and Computer Science
Replies
6
Views
2K
  • Calculus and Beyond Homework Help
Replies
8
Views
2K
  • STEM Academic Advising
Replies
13
Views
2K
Back
Top