[SciPy-Dev] A few minor changes to distributions .fit and scipy.optimize
Mon Jun 28 18:12:49 CDT 2010
There was some recent discussion about the fact that the .fit functions only use the Nelder Mead fmin algorithm, and that the .fit functions do not allow dependency on other variables.
I would like to check in a quick change to allow an optimizer keyword to the function which can take any optimizer which accepts a similar interface (and I've changed all the fmin_ style optimizers to adjust the few that have trickled in over the past few years which did not have a disp= keyword).
Comments on this are welcome. It is a simple enough change that it seems appropriate to just check-it in.
Regarding the matter of parameterization of the shape and location or scale variables: I think it would be straightforward to use a similar mechanism that allows one to now fix the shape, location, or scale parameters during the optimization, to allow for these variables to be parameterized by additional independent variables via a function. In other words, instead of fixing the value of shape, location, or scale, you could specify that this parameter should be a specific function of some other variables.
Then, the optimization would proceed using these underlying functions. This interface should also be flexible enough to allow you to specify a function that returns several of the shape, location, and/or scale values given the same set of underlying functions.
I'm thinking of merging this with the fixing of the parameters approach using a couple of object factory functions that are passed in via a single keyword argument to the .fit function. This would be a simple yet sufficiently flexible approach. I don't have a great name for the keyword function, perhaps params
# s0..sn fix any shape parameters
.fit(data, params=expand(s1=func, loc=(func3, start))) # passing a tuple in fixes starting guess for underlying function.
TBD: how to specify a function that returns several of the parameters: perhaps a keyword with names strung together: s0_loc_scale = func4
More information about the SciPy-Dev