# Updating fixed fit parameter values between Minuit2 minimization steps

Dear fellow ROOTers,

Longtime ROOT forum lurker here with a question which current documentation doesn’t seem to address yet.

I am currently using Minuit2 to fit a function of many parameters. The fit works, but takes too long. In order to speed things up, I wish to separate fit parameters which are linear from those which are nonlinear. The linear parameters can be calculated directly, but depend on the nonlinear parameters.

My attempt at a solution starts with fixing the linear parameters and making the nonlinear parameters variable during the initialization phase. Then, during each step of the minimization routine, I imagine recalculating the linear parameter values given what the nonlinear parameters currently are at that step. At the end of that step, I “update” the linear parameters. This would be repeated for each step of the minimization. I am doing this so that I can directly control the linear parameters, while letting Minuit do its thing with the nonlinear ones.

Currently, I’m using the SetValue() method to “update” the linear parameters during each minimization step. Printing the appropriate MnUserParameters element to the screen proves that they are not actually being updated. Why is that? Is there a better choice of function to use? Or am I truly locked out of changing any fit parameters during the minimization?

~Larisa

ROOT Version: 6.10/04
Platform: Mac, running macOS Sierra
Compiler: Whichever ROOT uses during interactive sessions

@moneta, perhaps you can help here please?

Oksana

Hi,

What you are asking is not really possible. Also changing parameters change completely the function values and shape during minimisation and it will confuse Minuit. In its iterative procedure it uses estimation of Hessian matrix from previous iteration. If you change the function fixed parameter values, you can get a completely different values.
What you can try is to do different minimisations for different fixed values. You can stop earlier by fixing the number of maximum function calls and use the output parameter values as input to the next minimization

Lorenzo

Thanks for the quick reply, moneta.

I think your suggestion to try different minimizations in series sounds reasonable, but it doesn’t give me any advantage (in speed of the total fit) over my naive first attempt to fit over a large number of parameters.

Recently, I tried to modify the approach I proposed above in the following way: again I initialize the fit with both linear and nonlinear parameters, but fix the linear parameters (they can be considered “dead”; I could probably just not use them at all). I take the nonlinear parameters from MnUserParameters and use these nonlinear parameter values to calculate what the linear parameter values should be. The nonlinear parameters and the directly calculated linear parameters are given to the chi-squared function.

But I am suspicious that this new attempt is still “cheating”. When Minuit updates its free parameters to improve the chi square, that chi square is changing in unpredictable ways due to the recalculation of the linear parameter values (which Minuit no longer owns/controls). This is reflected in the terrible chi squared values that my fit is getting, no matter how much I crank up the max function call to give it “more tries” or how strict I make the tolerance in the hopes of forcing it to try for better chi square values. For comparison, the naive original method which I’m trying to optimize has great chi square values.

Could you confirm whether my new method is a valid approach? I just need to know whether I need to try something completely new, or if this is salvageable.

Thank you,
~Larisa

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.