[Insight-users] How to set my own cost function for optimizer?

Luis Ibanez luis.ibanez at kitware.com
Tue Apr 4 09:10:43 EDT 2006


Hi Feng,

When the cost function analytical expression is so complex
that an explicit equation cannot be easily computed, you can
compute the derivatives using finite differences.

This is done in some of the examples in the optimizers.

Of course, the critical decision is the selection of the
"delta" along each one of the parameters.


   Regards,


       Luis


------------------
Feng Ding wrote:
> Hi Luis,
> 
> Thanks. I noticed that for optimizers such as gradient descent and LM, 
> we are required to explicitly write GetDerivative() function. However, 
> sometimes, the cost function is very complicated, and it's almost 
> impossible to formulate such a derivative explicitly. Now, my question 
> is, under such circumstance, what can we do?
> 
> Best regards,
> Carl DING
> 
> On 4/3/06, *Luis Ibanez* <luis.ibanez at kitware.com 
> <mailto:luis.ibanez at kitware.com>> wrote:
> 
> 
>     Hi Carl,
> 
>     You will find examples on how to set your own cost functions
>     to ITK optimizers by looking at the tests in the directory:
> 
>            Insight/Testing/Code/Numerics/
>                itkAmoebaOptimizerTest.cxx
>                itkConjugateGradientOptimizerTest.cxx
>                itkCumulativeGaussianOptimizerTest.cxx
>                itkExhaustiveOptimizerTest.cxx
>                itkFRPROptimizerTest.cxx*
>                itkGradientDescentOptimizerTest.cxx
>                itkLBFGSBOptimizerTest.cxx
>                itkLBFGSOptimizerTest.cxx
>                itkLevenbergMarquardtOptimizerTest.cxx
>                itkOptimizersHierarchyTest.cxx
>                itkPowellOptimizerTest.cxx*
>                itkRegularStepGradientDescentOptimizerTest.cxx
>                itkSPSAOptimizerTest.cxx
>                itkVersorRigid3DTransformOptimizerTest.cxx
>                itkVersorTransformOptimizerTest.cxx
> 
> 
> 
>     All of them set customized cost functions that are different
>     from the ImageMetrics used in the registration framework.
> 
> 
>         Regards,
> 
> 
>            Luis
> 
> 
>     -------------------
>     Feng Ding wrote:
>      > Dear all,
>      >
>      > My question is how to set my own cost function (eg.
>     f(x,y)=x^2+y^2) for
>      > an optimizer. I hope to run the optimization process separately,
>     not in
>      > the image to image registration framework. Thank you!
>      >
>      > Best regards,
>      > Carl DING
>      >
>      >
>      >
>     ------------------------------------------------------------------------
>      >
>      > _______________________________________________
>      > Insight-users mailing list
>      > Insight-users at itk.org <mailto:Insight-users at itk.org>
>      > http://www.itk.org/mailman/listinfo/insight-users
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list