[Insight-users] itk Gradient Descent Optimizer:

Luis Ibanez luis.ibanez@kitware.com
Tue, 22 Oct 2002 09:44:26 -0400


Hi digvijay,

There are no limitations in the numbers of
parameters that the itk::Optimizers can
accept. Parameters are passed in an Array
that can be resized. This array derives from
the vnl_vector. It should be able to manage
at least thousands of parameters (it will
not be fast... but it shouldn't crash).

Are you sure that the error is a segmentation
fault ? It could be an exception not being
caught.

Could you make sure that the StartOptimization()
method is placed in a try/catch block, something
like:


    try  {
       optimizer->StartOptimization();
       }
    catch( itk::ExceptionObject & exp )
      {
      std::cerr << "ITK exception caught ";
      std::cerr << exp << std::endl;
      }
    catch( std::exception & exp )
      {
      std::cerr << "STL exception caught ";
      std::cerr << exp.what() << std::endl;
      }
    catch( ... )
      {
      std::cerr << "Unknown exception caught";
      std::cerr << std::endl;
      }


If it happens that the error is not an exception
being caught. The next usual suspect is the lack
of initialization of the parameters. Make sure
that before you invoke StartOptimization(), you
provide an initial value to start the optimization.

In your case this will be a vector of size 4, with
values that you think may be close to the optimal
value or at least in the same hill.

Something like:

typename  OptimizerType::ParametersType  parameters(4);
paramaters[0] = ??  ;
paramaters[1] = ??  ;   // up to you to select
paramaters[2] = ??  ;   // these values
paramaters[3] = ??  ;

optimizer->SetInitialPosition( parameters );
optimizer->SetLearningRate( learningRate );
optimizer->SetNumberOfIterations( numberOfIterations );

try {
   optimizer->StartOptimization();
    }
catch( itk::ExceptionObject & exp )
   {
   //.....etc
   }



Please take a look at the code in

     Insight/Testing/Code/Numerics/

     itkGradientDescentOptimizerTest.cxx



Let us know if you have further questions,


   Thanks

     Luis


==========================================

digvijay singh wrote:
> hi luis!!
> I tried to modify the itk gradient descent optimizer.
> At run time the program gives a segmentation fault ,
> right after the startoptimization() is called. 
> i am trying to pass 4 parameters to it. Is there a
> restriction on the number of parameters that can be
> given(space dimension is 4). please lemme know.
> ciao
> digvijay
> 
> __________________________________________________
> Do you Yahoo!?
> Y! Web Hosting - Let the expert host your web site
> http://webhosting.yahoo.com/
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
> 
>