Fitting time length

The question is, what takes time during fitting, when fit converges and no limits are reached.

I have a code that performs many simple fits in a row, unblocking one parameter (of more than 40 parameters) at the time. Than after passing all parameters, the best is chosen, unblocked and other parameters are tested in the same way with the one unblocked.

However, I’ve found, that some fits take much longer time than others. For example one parameter fit took around 1600 iterations and 40 minutes, while other, with more than 1700 iterations only 5 minutes. Both fits converged, no limits reached. What can cause such difference in fitting times?

These are definitely fitting times - I printout time directly before and after the fit command. All fits fit exactly the same function, in mentioned case to the same histogram - only free parameter changes. I use minuit and simple TH2D::Fit(). However, it seems that the same thing is for minuit2 and fumili2, root 5.24 and root 5.20.

Hi,
evaluation the function to minimize is what takes time during fitting. in your case is the loop on the data to evaluate the model function.
Your findings looks very strange to me, since your data are the same.
The only thing that can make such a difference is the evaluation of the model function. I suspect that for some parameter values is much slower to evaluate than for others

Best Regards

Lorenzo

Fitting behaves even more strangly - after a longer time of fitting (on some machines 12 hours, on some more than 24) fit can take suddenly a few hours (previous and next parameter fit taking minutes). It takes little memory, but all the time utilizes 100% CPU. I cannot find any regularities concerning for which parameeters/data sets it happens. It seems to be random, or maybe connected with program running time.

I am afraid, next post will include my long, messy code… :wink:

I attach a log from one of the fitting series. Each fit is a different invokation of root compiled program, but the log is appended. While I’m sending this log, the fit does nothing (except utilizing 100% CPU) for two hours. It can take days like this… What can be the cause?
out5.txt (14.7 KB)

Hi,
from the log I don’t see anything strange. Your fit will take 100% CPU to evaluate your function to minimize, and if you want to reduce the fitting time you need to optimize the function evaluation.

Best Regards

Lorenzo