Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Nov 12, 2024
1 parent da69d6a commit 8ea19bd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
27 changes: 12 additions & 15 deletions petab_select/candidate_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,6 @@ def update_after_calibration(
**kwargs,
) -> None:
"""See `CandidateSpace.update_after_calibration`."""

super().update_after_calibration(
*args,
iteration_calibrated_models=iteration_calibrated_models,
Expand Down Expand Up @@ -1073,8 +1072,8 @@ def update_from_iteration_calibrated_models(
) -> bool:
"""Update ``self.best_models`` with the latest ``iteration_calibrated_models``
and determine if there was a new best model. If so, return
``False``. ``True`` otherwise."""

``False``. ``True`` otherwise.
"""
go_into_switch_method = True
for model in iteration_calibrated_models.values():
if (
Expand Down Expand Up @@ -1112,7 +1111,8 @@ def update_from_iteration_calibrated_models(

def insert_model_into_best_models(self, model_to_insert: Model) -> None:
"""Inserts a model into the list of best_models which are sorted
w.r.t. the criterion specified."""
w.r.t. the criterion specified.
"""
insert_index = bisect.bisect_left(
[
model.get_criterion(self.criterion)
Expand All @@ -1125,8 +1125,8 @@ def insert_model_into_best_models(self, model_to_insert: Model) -> None:
def consider(self, model: Union[Model, None]) -> bool:
"""Re-define ``consider`` of FAMoS to be the ``consider`` method
of the ``inner_candidate_space``. Update all the attributes
changed in the ``consider`` method."""

changed in the ``consider`` method.
"""
if self.limit.reached():
return False

Expand Down Expand Up @@ -1157,7 +1157,8 @@ def is_plausible(self, model: Model) -> bool:

def check_swap(self, model: Model) -> bool:
"""Check if parameters that are swapped are contained in the
same swap parameter set."""
same swap parameter set.
"""
if self.method != Method.LATERAL:
return True

Expand All @@ -1177,7 +1178,6 @@ def check_swap(self, model: Model) -> bool:

def check_critical(self, model: Model) -> bool:
"""Check if the model contains all necessary critical parameters"""

estimated_parameters_ids = set(model.get_estimated_parameter_ids_all())
for critical_set in self.critical_parameter_sets:
if not estimated_parameters_ids.intersection(set(critical_set)):
Expand All @@ -1188,8 +1188,8 @@ def switch_method(
self,
) -> None:
"""Switch to the next method with respect to the history
of methods used and the switching scheme in ``self.method_scheme``."""

of methods used and the switching scheme in ``self.method_scheme``.
"""
previous_method = self.method
next_method = previous_method
logging.info("SWITCHING", self.method_history)
Expand Down Expand Up @@ -1248,7 +1248,6 @@ def switch_method(

def update_method(self, method: Method):
"""Update ``self.method`` to ``method``."""

self.method = method

def switch_inner_candidate_space(
Expand All @@ -1261,7 +1260,6 @@ def switch_inner_candidate_space(
excluded_hashes:
Hashes of excluded models.
"""

# if self.method != Method.MOST_DISTANT:
self.inner_candidate_space = self.inner_candidate_spaces[self.method]
# reset the next inner candidate space with the current history of all
Expand All @@ -1275,8 +1273,8 @@ def jump_to_most_distant(
self,
):
"""Jump to most distant model with respect to the history of all
calibrated models."""

calibrated models.
"""
predecessor_model = self.get_most_distant()

logging.info("JUMPING: ", predecessor_model.parameters)
Expand Down Expand Up @@ -1319,7 +1317,6 @@ def get_most_distant(
If not we choose the model in a subspace that has least distance to this
complement model.
"""

most_distance = 0
most_distant_indices = []

Expand Down
1 change: 0 additions & 1 deletion petab_select/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def start_iteration(
:const:`petab_select.constants.MODELS`:
The uncalibrated models of the current iteration.
"""

"""
FIXME(dilpath)
- currently takes predecessor model from
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ line-length = 79
exclude = ["amici_models"]
extend-include = ["*.ipynb"]
lint.ignore = [
# FIXME: we should be able to remive move of those
# FIXME: we should be able to remove move of those
"D103", # Missing docstring in public function
"S101", # Use of assert detected
"E501", # Line too long
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def read(fname):

def absolute_links(txt):
"""Replace relative petab github links by absolute links."""

raw_base = f"(https://raw.githubusercontent.com/{org}/{repo}/main/"
embedded_base = f"(https://github.com/{org}/{repo}/tree/main/"
# iterate over links
Expand Down

0 comments on commit 8ea19bd

Please sign in to comment.