Skip to content

Commit

Permalink
Update run_indefinetly to directly inherit from TransitionCriterion (f…
Browse files Browse the repository at this point in the history
…acebookresearch#329)

Summary:

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

Reviewed By: crasanders

Differential Revision: D52853023
  • Loading branch information
mgarrard authored and facebook-github-bot committed Jan 29, 2024
1 parent 3392e02 commit 1f952d7
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.transition_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 1f952d7

Please sign in to comment.