Beispiel #1
0
    def __init__(self,
                 time_attr='training_iteration',
                 reward_attr='episode_reward_mean',
                 max_t=100,
                 grace_period=10,
                 reduction_factor=3,
                 brackets=3):
        assert max_t > 0, "Max (time_attr) not valid!"
        assert max_t >= grace_period, "grace_period must be <= max_t!"
        assert grace_period > 0, "grace_period must be positive!"
        assert reduction_factor > 1, "Reduction Factor not valid!"
        assert brackets > 0, "brackets must be positive!"
        FIFOScheduler.__init__(self)
        self._reduction_factor = reduction_factor
        self._max_t = max_t

        self._trial_info = {}  # Stores Trial -> Bracket

        # Tracks state for new trial add
        self._brackets = [
            _Bracket(grace_period, max_t, reduction_factor, s)
            for s in range(brackets)
        ]
        self._counter = 0  # for
        self._num_stopped = 0
        self._reward_attr = reward_attr
        self._time_attr = time_attr
Beispiel #2
0
 def __init__(
         self, time_attr="time_total_s", reward_attr="episode_reward_mean",
         grace_period=60.0, min_samples_required=3, hard_stop=True):
     FIFOScheduler.__init__(self)
     self._stopped_trials = set()
     self._completed_trials = set()
     self._results = collections.defaultdict(list)
     self._grace_period = grace_period
     self._min_samples_required = min_samples_required
     self._reward_attr = reward_attr
     self._time_attr = time_attr
     self._hard_stop = hard_stop
Beispiel #3
0
 def __init__(
         self, time_attr='time_total_s', reward_attr='episode_reward_mean',
         grace_period=60.0, min_samples_required=3, hard_stop=True):
     FIFOScheduler.__init__(self)
     self._stopped_trials = set()
     self._completed_trials = set()
     self._results = collections.defaultdict(list)
     self._grace_period = grace_period
     self._min_samples_required = min_samples_required
     self._reward_attr = reward_attr
     self._time_attr = time_attr
     self._hard_stop = hard_stop
Beispiel #4
0
    def __init__(
            self, time_attr='training_iteration',
            reward_attr='episode_reward_mean',
            grace_period=10.0, perturbation_interval=6.0,
            hyperparameter_mutations=None):
        FIFOScheduler.__init__(self)
        self._completed_trials = set()
        self._results = collections.defaultdict(list)
        self._last_perturbation_time = {}
        self._grace_period = grace_period
        self._reward_attr = reward_attr
        self._time_attr = time_attr

        self._hyperparameter_mutations = hyperparameter_mutations
        self._perturbation_interval = perturbation_interval
        self._checkpoint_paths = {}
Beispiel #5
0
    def __init__(
            self, time_attr="time_total_s", reward_attr="episode_reward_mean",
            perturbation_interval=60.0, hyperparam_mutations={},
            resample_probability=0.25, custom_explore_fn=None):
        if not hyperparam_mutations and not custom_explore_fn:
            raise TuneError(
                "You must specify at least one of `hyperparam_mutations` or "
                "`custom_explore_fn` to use PBT.")
        FIFOScheduler.__init__(self)
        self._reward_attr = reward_attr
        self._time_attr = time_attr
        self._perturbation_interval = perturbation_interval
        self._hyperparam_mutations = hyperparam_mutations
        self._resample_probability = resample_probability
        self._trial_state = {}
        self._custom_explore_fn = custom_explore_fn

        # Metrics
        self._num_checkpoints = 0
        self._num_perturbations = 0
Beispiel #6
0
    def __init__(self,
                 time_attr='training_iteration',
                 reward_attr='episode_reward_mean',
                 max_t=81):
        assert max_t > 0, "Max (time_attr) not valid!"
        FIFOScheduler.__init__(self)
        self._eta = 3
        self._s_max_1 = 5
        # bracket max trials
        self._get_n0 = lambda s: int(
            np.ceil(self._s_max_1 / (s + 1) * self._eta**s))
        # bracket initial iterations
        self._get_r0 = lambda s: int((max_t * self._eta**(-s)))
        self._hyperbands = [[]]  # list of hyperband iterations
        self._trial_info = {}  # Stores Trial -> Bracket, Band Iteration

        # Tracks state for new trial add
        self._state = {"bracket": None, "band_idx": 0}
        self._num_stopped = 0
        self._reward_attr = reward_attr
        self._time_attr = time_attr
Beispiel #7
0
    def __init__(
            self, time_attr='training_iteration',
            reward_attr='episode_reward_mean', max_t=100,
            grace_period=10, reduction_factor=3, brackets=3):
        assert max_t > 0, "Max (time_attr) not valid!"
        assert max_t >= grace_period, "grace_period must be <= max_t!"
        assert grace_period > 0, "grace_period must be positive!"
        assert reduction_factor > 1, "Reduction Factor not valid!"
        assert brackets > 0, "brackets must be positive!"
        FIFOScheduler.__init__(self)
        self._reduction_factor = reduction_factor
        self._max_t = max_t

        self._trial_info = {}  # Stores Trial -> Bracket

        # Tracks state for new trial add
        self._brackets = [_Bracket(
            grace_period, max_t, reduction_factor, s) for s in range(brackets)]
        self._counter = 0  # for
        self._num_stopped = 0
        self._reward_attr = reward_attr
        self._time_attr = time_attr
Beispiel #8
0
    def __init__(
            self, time_attr='training_iteration',
            reward_attr='episode_reward_mean', max_t=81):
        assert max_t > 0, "Max (time_attr) not valid!"
        FIFOScheduler.__init__(self)
        self._eta = 3
        self._s_max_1 = 5
        self._max_t_attr = max_t
        # bracket max trials
        self._get_n0 = lambda s: int(
            np.ceil(self._s_max_1/(s+1) * self._eta**s))
        # bracket initial iterations
        self._get_r0 = lambda s: int((max_t*self._eta**(-s)))
        self._hyperbands = [[]]  # list of hyperband iterations
        self._trial_info = {}  # Stores Trial -> Bracket, Band Iteration

        # Tracks state for new trial add
        self._state = {"bracket": None,
                       "band_idx": 0}
        self._num_stopped = 0
        self._reward_attr = reward_attr
        self._time_attr = time_attr
Beispiel #9
0
    def __init__(self,
                 time_attr="time_total_s",
                 reward_attr="episode_reward_mean",
                 perturbation_interval=60.0,
                 hyperparam_mutations={},
                 resample_probability=0.25,
                 custom_explore_fn=None):
        if not hyperparam_mutations and not custom_explore_fn:
            raise TuneError(
                "You must specify at least one of `hyperparam_mutations` or "
                "`custom_explore_fn` to use PBT.")
        FIFOScheduler.__init__(self)
        self._reward_attr = reward_attr
        self._time_attr = time_attr
        self._perturbation_interval = perturbation_interval
        self._hyperparam_mutations = hyperparam_mutations
        self._resample_probability = resample_probability
        self._trial_state = {}
        self._custom_explore_fn = custom_explore_fn

        # Metrics
        self._num_checkpoints = 0
        self._num_perturbations = 0
Beispiel #10
0
    def __init__(self, max_iter=200, eta=3):
        """
        args:
            max_iter (int): maximum iterations per configuration
            eta (int): # defines downsampling rate (default=3)
        """
        assert max_iter > 0, "Max Iterations not valid!"
        assert eta > 1, "Downsampling rate (eta) not valid!"

        FIFOScheduler.__init__(self)
        self._eta = eta
        self._s_max_1 = s_max_1 = calculate_bracket_count(max_iter, eta)
        # total number of iterations per execution of Succesive Halving (n,r)
        B = s_max_1 * max_iter
        # bracket trial count total
        self._get_n0 = lambda s: int(np.ceil(B / max_iter / (s + 1) * eta**s))
        # bracket initial iterations
        self._get_r0 = lambda s: int(max_iter * eta**(-s))
        self._hyperbands = [[]]  # list of hyperband iterations
        self._trial_info = {}  # Stores Trial -> Bracket, Band Iteration

        # Tracks state for new trial add
        self._state = {"bracket": None, "band_idx": 0}
        self._num_stopped = 0