Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Optimization doing more function evaluations than claimed?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57197] Optimization doing more function evaluations than claimed?
  • From: Gareth Russell <gjr2008 at columbia.edu>
  • Date: Fri, 20 May 2005 04:43:46 -0400 (EDT)
  • Organization: Columbia University
  • Sender: owner-wri-mathgroup at wolfram.com

Hi All,

I have been using FindMaximize without symbolic derivatives to maximize 
a likelihood function that operates on a large dataset. Because the 
process is slow, I want to track progress as it happens, so I include a 
Print[{parameter1, parameter2, ..., likelihood}] step in the function 
being evaluated. In doing so, I have noticed that the function appears 
to be evaluated twice for each trial of the parameter values. When I 
look at diagnostics after the fit is complete, such as the output of 
the EvaluationMonitor option, it shows each trial only once. For 
example, if Mathematica claims 20 steps after the fact, the number of 
printed outputs is always 40, in identical pairs. The 40 outputs appear 
evenly spaced in time, and the total timing of the fitting process, 
compared to the timing of one evaluation of the function, confirms that 
indeed, it was evaluated 40 times.

Does anyone know why (i.e., under what conditions) FindMinimum might do 
this? You won't be able to evaluate my function, as it calls the 
datasets, but here it is anyway, with some info:

lDistExp[distMaps_, e_, b1_?NumericQ] := Module[{distQ, 
    pMaps, logList, logLike},
    distQ = mapExponential2[distMaps, b1];
    pMaps = Map[toProbs[#] &, distQ];
    logList = Log[MapThread[#1[[#2]] &, {pMaps, e}]];
    loglike=Apply[Plus, logList];
    Print[{b1,logLike}];
    logLike
    ]
   
distMaps is a (large) matrix of reals, e is a vector of integers, and 
b1 is a real.

The functions mapExponential2[] and toProbs[] are compiled functions 
(for speed).

The function is maximized with respect to b1.

As a side note that may be relevant, if I load the 
Optimization`UnconstrainedProblems` package and use the FindMinimumPlot 
function, the target function is be evaluated THREE times per step, 
even though the output again says just 20 steps.

Because the fitting procedure is necessarily slow because of dataset 
size, I don't want to be doing more function evaluations than are 
necessary!

Thanks,

Gareth Russell
Columbia University



  • Prev by Date: Re: Re: How to get an answer as a Root object?
  • Next by Date: Re: How to get an answer as a Root object?
  • Previous by thread: Re: runs test for evaluation of model fit
  • Next by thread: Re: Optimization doing more function evaluations than claimed?