|
Hi biomass developers, Thank you for this excellent library! I have a question about parameter handling in What I observedWhile working with biomass==0.14.0, I noticed that the order of parameters in
This appears to be a general behavior affecting all models, not specific to any particular model. My questionIs this ordering requirement intentional? I couldn't find documentation mentioning that parameters need to be listed in a specific order in Potential impactIf this is indeed a requirement, it might be worth documenting clearly, as it can be quite puzzling to debug when users unknowingly define parameters in a different order across their models. Possible solutions (if this is unintended)One approach could be to auto-sort the parameter lists internally: # in search_param.py
class SearchParam(object):
def __init__(self):
# User-defined order (for readability/organization)
_idx_params = [
C.param_b, # Users can group parameters logically
C.param_a,
C.param_d,
C.param_c,
# ...
]
# Library uses sorted order internally
self.idx_params = sorted(_idx_params)But I wanted to check with you first whether this behavior is by design or if it's something that could be improved. |
Replies: 2 comments 1 reply
|
Thanks for raising this issue and for the clear description! This behavior is expected. The order of self.idx_params is critical because BioMASS uses enumerate(self.idx_params) when constructing search bounds. For example: for i, j in enumerate(self.idx_params):
search_rgn[0, j] = search_param[i] * 0.1 # lower bound
search_rgn[1, j] = search_param[i] * 10.0 # upper boundHere, the index i (from enumeration) must match the position of the corresponding parameter value in search_param. If you change the order of self.idx_params, you effectively change which parameter each value in search_param is mapped to, which explains the different results you observed in get_obj_val. To avoid unexpected behavior, it’s important to keep the parameter order consistent before and after parameter estimation. That said, I agree this should be mentioned more explicitly in the documentation to help new users avoid confusion. We’ll look into clarifying this in the docs. |
|
@himoto The code example showing how I really appreciate you updating the documentation so quickly! This will definitely help other users in the future. |
Thanks for raising this issue and for the clear description!
This behavior is expected. The order of self.idx_params is critical because BioMASS uses enumerate(self.idx_params) when constructing search bounds. For example:
Here, the index i (from enumeration) must match the position of the corresponding parameter value in search_param. If you change the order of self.idx_params, you effectively change which parameter each value in search_param is mapped to, which explains the different results you observed in get_obj_val.
To avoid…