PEtab-dev / petab_select

Repository for development of the model selection extension
BSD 3-Clause "New" or "Revised" License
9 stars 0 forks source link

Fix multi-subspace stepwise moves #65

Closed dilpath closed 9 months ago

dilpath commented 9 months ago

This fixes a major bug in the stepwise logic.

Consider the model space table model_subspace_id petab_yaml k1 k2
M1 full_petab_problem.yaml 1;estimate 1;estimate
M2 full_petab_problem.yaml 1;estimate 1

Let the current model in a backward search be in M1, with k1=1, k2=estimate.

Valid backward moves are k1=1 and k2=1 in M2, and k1=1 and k2=1 in M2.

M2 will never return k1=1 and k2=1. The current logic first checks the largest possible model in the space, then all combinations involving at least one "optionally fixed" parameter. k1 is not "optionally fixed" -- it must be fixed based on the current model. Hence, no model is returned from M2.

This PR changes the logic so that the first check is now "largest possible model in the space, but fix the parameters that were fixed in the other model subspace", and the corresponding fix for the forward moves.

An alternative fix would be to remove these lines from the backward method: https://github.com/PEtab-dev/petab_select/blob/316b4375b20af23c171e8ab4924f54ac3f0aa2bd/petab_select/model_subspace.py#L435-L439