How to handle different independent variables in CompositeModel? #787
-
Hi, My PeakModel uses only 'x' as an independent variable, while my BackroundModel uses 'x' and 'y' as independent variables. I, therefore, expected the CompositeModel (automatically created by
During the fitting procedure, only the following UserWarning is thrown:
This would make perfect sense because my CompositeModel only knows 'x' as the independent variable. However, if I define my Model the other way around, with
The reason for getting two different outcomes by simply changing the order of Models in CompositeModel seems to be, that the CompositeModel class assumes that both Models have the same independent variables and so the independent variables of the left Model (first Model) are taken (model.py, l. 1119).
I do not get why it is necessary, that both Models have ALL independent variables in common. Kind regards, Julian |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@Julian-Hochhaus I think we just didn't carefully think through the case where some sub-components would have independent parameters that others did not. Well, maybe except for "ConstantModel", which has also caused some confusion. I think that it would probably make sense to have the composite use the union of the independent parameters of "left" and "right" when being initialized and then only pass the ones expected for each sub-component. That is, the composite might need a pair (tuple, set, dict, probably doesn't matter) of independent_vars for PR anyone? |
Beta Was this translation helpful? Give feedback.
@Julian-Hochhaus I think we just didn't carefully think through the case where some sub-components would have independent parameters that others did not. Well, maybe except for "ConstantModel", which has also caused some confusion.
I think that it would probably make sense to have the composite use the union of the independent parameters of "left" and "right" when being initialized and then only pass the ones expected for each sub-component. That is, the composite might need a pair (tuple, set, dict, probably doesn't matter) of independent_vars for
left
andright
.PR anyone?