From 59d93f32ff8d02dd93ba53e3bd101ea87e2c37ae Mon Sep 17 00:00:00 2001 From: Mia Garrard Date: Wed, 17 Jan 2024 14:40:04 -0800 Subject: [PATCH] Remove usage of MinimumTrialsInStatus in AEPsych Summary: X-link: https://github.com/facebook/Ax/pull/2134 We have replaced the more limited MinimumTrialsInStatus with the more flexible TransitionCriterion `MinTrials`. This diff is the first in a set of diffs intended to update the legacy usage of CompletionCriterion in AEPsych. In following diffs we will: - Completely remove the completion criterion file - update all four completion criterion defined in aepsych code here: https://www.internalfb.com/code/fbsource/[409e3dfb01ec5c613d34e58c491d63e8051d10d9]/fbcode/frl/ae/aepsych/tests/generators/test_completion_criteria.py?lines=12-15 - revisit storage - remove all todos in gennode, genstrat, and transitioncriterion classes related to maintaining this deprecated code - update AEPsych GSs as needed - determine if run indefinetly can be replaced by simply having gen_unlimited_trials = true Additional info: https://docs.google.com/document/d/1JWaD20ux8dRVWom3VhTBkh4_1v170XNJ3Xf7EdWsMc8/edit?usp=sharing Differential Revision: D52848140 fbshipit-source-id: 8a2afb518671521f58d39fa4e4578a29d2d5fa1b --- .../generators/completion_criterion/min_total_tells.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/aepsych/generators/completion_criterion/min_total_tells.py b/aepsych/generators/completion_criterion/min_total_tells.py index 25c4887f4..1a8bfff9f 100644 --- a/aepsych/generators/completion_criterion/min_total_tells.py +++ b/aepsych/generators/completion_criterion/min_total_tells.py @@ -9,12 +9,15 @@ from aepsych.config import Config, ConfigurableMixin from ax.core.base_trial import TrialStatus -from ax.modelbridge.completion_criterion import MinimumTrialsInStatus +from ax.modelbridge.transition_criterion import MinTrials -class MinTotalTells(MinimumTrialsInStatus, ConfigurableMixin): +class MinTotalTells(MinTrials, ConfigurableMixin): @classmethod def get_config_options(cls, config: Config, name: str) -> Dict[str, Any]: min_total_tells = config.getint(name, "min_total_tells", fallback=1) - options = {"status": TrialStatus.COMPLETED, "threshold": min_total_tells} + options = { + "only_in_statuses": [TrialStatus.COMPLETED], + "threshold": min_total_tells, + } return options