Skip to content

Commit

Permalink
Update run_indefinetly to directly inherit from TransitionCriterion
Browse files Browse the repository at this point in the history
Summary:
We have replaced the more limited MinimumTrialsInStatus with the more flexible TransitionCriterion MinTrials. This diff we update the 4 of 4 aepsych completion criterion to directly rely on transitioncriterion

In following diffs we will:
- Completely remove the completion criterion file
- 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
- determine if additional updates to min_asks and run_indefinetly are necessary

Differential Revision: D52853023
  • Loading branch information
mgarrard authored and facebook-github-bot committed Jan 17, 2024
1 parent 7098515 commit b86a7e9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions aepsych/generators/completion_criterion/run_indefinitely.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,29 @@
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.

from typing import Any, Dict
from typing import Any, Dict, Optional, Set

from aepsych.config import Config, ConfigurableMixin
from ax.core import Experiment
from ax.modelbridge.completion_criterion import CompletionCriterion
from ax.modelbridge.completion_criterion import TransitionCriterion


class RunIndefinitely(CompletionCriterion, ConfigurableMixin):
class RunIndefinitely(TransitionCriterion, ConfigurableMixin):
def __init__(self, run_indefinitely: bool) -> None:
self.run_indefinitely = run_indefinitely

def is_met(self, experiment: Experiment) -> bool:
return not self.run_indefinitely

def block_continued_generation_error(
self,
node_name: Optional[str],
model_name: Optional[str],
experiment: Optional[Experiment],
trials_from_node: Optional[Set[int]] = None,
) -> None:
pass

@classmethod
def get_config_options(cls, config: Config, name: str) -> Dict[str, Any]:
run_indefinitely = config.getboolean(name, "run_indefinitely", fallback=False)
Expand Down

0 comments on commit b86a7e9

Please sign in to comment.