Extrapolation and interpolation in line search optimization

Click For Summary
SUMMARY

The discussion centers on the equations used in the MATLAB function fmincg.m for line search optimization, specifically cubic and quadratic fits. The equations for cubic fit are defined as A = 6*(f2-f3)/z3+3*(d2+d3) and B = 3*(f3-f2)-z3*(d3+2*d2), leading to the calculation of z2 as (sqrt(B*B-A*d2*z3*z3)-B)/A. These equations are not found in standard numerical optimization literature, including Peter Glynn and Stephen M. Robinson's book, but are referenced in the Coursera Machine Learning course by Andrew Ng. The discussion emphasizes that understanding the code's logic is more critical than tracing the equations' origins.

PREREQUISITES
  • Understanding of MATLAB programming and syntax
  • Familiarity with optimization techniques, specifically line search methods
  • Knowledge of cubic and quadratic interpolation methods
  • Basic concepts of numerical error analysis
NEXT STEPS
  • Review the MATLAB function fmincg.m for practical implementation of optimization techniques
  • Study cubic interpolation methods in numerical optimization
  • Explore the Coursera Machine Learning course by Andrew Ng for context on optimization algorithms
  • Investigate numerical error analysis techniques in optimization
USEFUL FOR

Data scientists, machine learning practitioners, and MATLAB users interested in optimization techniques and their implementation in code.

mathu2057
Messages
1
Reaction score
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: 145
Physics news on Phys.org
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.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
2
Views
832
  • · Replies 13 ·
Replies
13
Views
4K