When to use cost function or error function for fitting

조회 수: 1 (최근 30일)
Arbol
Arbol 2017년 6월 26일
댓글: Arbol 2017년 6월 26일
I have look around different ways to fit. So when do you know you have to use the cost function: sum((realdata-fittingdata).^2) or error = realdata-fittingdata? For example, for lsqnonlin, you would use 'error' to find do the optimization. However, for fminsearch or patternsearch, you would use the 'cost function.'

채택된 답변

Alan Weiss
Alan Weiss 2017년 6월 26일
I'm sorry that you don't find the documentation clear on this issue.
  • If you are using lsqnonlin or lsqcurvefit, then your objective function should return the vector of function values (I mean fittingdata - realdata in your vocabulary).
  • If you are using any other nonlinear optimizer, then your objective function should be the sum of squares of the function values.
For an example comparing these approaches, including efficiency of each solver, see Nonlinear Data-Fitting.
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 1
Arbol
Arbol 2017년 6월 26일
It's probably my fault that I'm not familiar with the fitting language. Thank you though!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by