Replies: 2 comments 5 replies
-
Thanks for starting to think about it. I like the idea of the implementation but have to think about it and if there is a better way of doing things (from the perspective of the user). Why using dictionaries with (arbitrary?) keys, when lists of lists would suffice? I think we should spend some time to think about the smoothest way to integrate this feature (as it is possible already to do such fits, but not very easily). In the end, also for the chisquared etc., you just need N tuples (x, y, func), where x may be an array, y is your data and func the corresponding function for this pair of (x, y). In that sense, you could even have the same interface as before, but just add another list containing the fit functions (instead of a single function). However, this is probably also not the user-friendliest way (or is it?). In the correlated case, you would most likely need a full covariance matrix, right? If you, e.g., fit 2- and 3-point functions from the same configurations, and you would like to do this in a correlated fashion, the "off-block-diagonal" terms should be taken into account. I would like to enable the user to provide a covariance matrix, regardless of the other changes. When scanning over fit ranges, the repeated computation of (smaller and smaller) covariance matrices with basically the same entries generates some overhead. In my opinion, it would be enough to ask for a full covariance matrix and the user may decide how to construct it. It could be very helpful to provide a function to construct block-diagonal covariance matrices from several smaller ones. As there are some other open questions regarding improvements of the fit functions: Is this the right place or should we separate the different issues? |
Beta Was this translation helpful? Give feedback.
-
We thought about using dictionaries as we had the impression that this gives the user a better idea which sets of data enter a fit. It would also make adding or removing a data set simpler (simply add or pop a key in all three I agree on the suggestion to add a way of passing a covariance. Concerning efficiency it might be beneficial to not have a block diagonal matrix with explicit zeros but use a more efficient way of computing the product, for example via If your other suggestions are unrelated to these type of combined fits I would suggest to open a separate discussion. |
Beta Was this translation helpful? Give feedback.
-
@PiaLJP and I started discussing a possible idea for an interface for combined fits without breaking backward compatibility. We thought about extending
fits.least_squares
in such a way that inputting lists forx
andy
and a single function forfunc
results in the known behavior. Alternatively one can pass (non-nested) dictionaries forx
,y
andfunc
which have to have identical keys. Following this proposal one would define a separate fit function for every data set, but the fit functions can share parameters. The keys of the dictionaries are only used for identification and would in no way propagate into the fit result.A simple example would be fitting two correlations functions with the same mass but different amplitudes:
The check for the number of fit parameters could be done by performing the usual check on the sum of all fit functions. This should require very little modification of the existing code.
The biggest changes would be in the part where chisquare is constructed, the part for the error propagation probably only requires minimal changes.
A bit more care is required in the correlated case. We could think about the option of passing another dictionary containing the block diagonal covariances for each data set.
Any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions