Skip to content

Commit

Permalink
Remove usage of MinimumTrialsInStatus in AEPsych (#2134)
Browse files Browse the repository at this point in the history
Summary:
X-link: facebookresearch/aepsych#326

Pull Request resolved: #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

Reviewed By: crasanders

Differential Revision: D52848140

fbshipit-source-id: cfbc96052f3898e4b3466d76f9cb11b18452fd9a
  • Loading branch information
mgarrard authored and facebook-github-bot committed Jan 18, 2024
1 parent 2157ebd commit e11eff7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
14 changes: 0 additions & 14 deletions ax/modelbridge/completion_criterion.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from ax.modelbridge.transition_criterion import (
MinimumPreferenceOccurances,
MinimumTrialsInStatus,
TransitionCriterion,
)
from ax.utils.common.logger import get_logger
Expand Down Expand Up @@ -38,16 +37,3 @@ class MinimumPreferenceOccurances(MinimumPreferenceOccurances):
" deprecated. Please use TransitionCriterion instead."
)
pass


class MinimumTrialsInStatus(MinimumTrialsInStatus):
"""
Deprecated child class that has been replaced by `MinimumTrialsInStatus`
in `TransitionCriterion`, and will be fully reaped in a future release.
"""

logger.warning(
"CompletionCriterion, which MinimumTrialsInStatus inherits from, is"
" deprecated. Please use TransitionCriterion instead."
)
pass
8 changes: 3 additions & 5 deletions ax/modelbridge/tests/test_completion_criterion.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
import pandas as pd
from ax.core.base_trial import TrialStatus
from ax.core.data import Data
from ax.modelbridge.completion_criterion import (
MinimumPreferenceOccurances,
MinimumTrialsInStatus,
)
from ax.modelbridge.completion_criterion import MinimumPreferenceOccurances
from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
from ax.modelbridge.registry import Models
from ax.modelbridge.transition_criterion import MinTrials
from ax.utils.common.testutils import TestCase
from ax.utils.testing.core_stubs import get_experiment

Expand Down Expand Up @@ -76,7 +74,7 @@ def test_single_criterion(self) -> None:
def test_many_criteria(self) -> None:
criteria = [
MinimumPreferenceOccurances(metric_name="m1", threshold=3),
MinimumTrialsInStatus(status=TrialStatus.COMPLETED, threshold=5),
MinTrials(only_in_statuses=[TrialStatus.COMPLETED], threshold=5),
]

experiment = get_experiment()
Expand Down

0 comments on commit e11eff7

Please sign in to comment.