probfit icon indicating copy to clipboard operation
probfit copied to clipboard

Make the try_* functions into FitStatistic.grid_search methods?

Open cdeil opened this issue 11 years ago • 5 comments

I just read through the tutorial and I think maybe one aspect of the probfit API could be improved.

At the moment there are try_uml and try_binlh functions that evaluate the unbinned or binned likelihood function for a grid of values and return the best result as a dict.

Wouldn't it be nicer to have a FitStatistic.grid_search(parameters) method? (I didn't look if the different fit statistics, a.k.a. cost functions, have a base class, but that's what I mean with FitStatistic here, i.e. UnbinnnedLH and Chi2Regression and ...)

cdeil avatar May 11 '13 17:05 cdeil

I was gonna remove them though it's there since this thing is call distfit... Do you think they are useful? If so, yes it should be a method instead of a function.

piti118 avatar May 13 '13 21:05 piti118

Yes, I think having a grid_search method as well as a quick way to visualize model vs. data (and maybe residuals) to find good start values for MIGRAD and debug what the model is doing is very useful. http://code.google.com/p/pyminuit/wiki/FunctionReference#scan((param,_bins,_low,high),...[,_corners[,_output]])

cdeil avatar May 13 '13 21:05 cdeil

Scan does something else though...

piti118 avatar May 14 '13 19:05 piti118

Oh... it's pyminuit scan not minuit scan.

piti118 avatar May 14 '13 19:05 piti118

Related suggestion for improvement: the six functions fit_uml, try_uml, fit_binx2, try_chi2, fit_binlh and try_binlh in oneshot.py are not included in the [probfit docs]((http://iminuit.github.io/probfit/search.html?q=fit_uml) Either remove them or add them to the docs.

If they are kept, I would suggest to make the fit_* methods simply return minuit instead of (fval, minuit), as fval is simply available as minuit.fval, right?

cdeil avatar May 16 '13 11:05 cdeil