コード例 #1
0
    def test_update_rungs_return_no_candidate(self, hyperband: Hyperband,
                                              bracket: HyperbandBracket,
                                              rung_1: RungDict):
        """Check if no candidate is returned by update_rungs."""
        assert bracket.owner is hyperband

        candidates = bracket.promote(1)

        assert candidates == []
コード例 #2
0
    def test_update_rungs_return_candidate(self, hyperband: Hyperband,
                                           bracket: HyperbandBracket,
                                           rung_1: RungDict):
        """Check if a valid modified candidate is returned by update_rungs."""
        assert bracket.owner is hyperband
        bracket.rungs[1] = rung_1
        trial = create_trial_for_hb((3, 0.0), 0.0)

        candidates = bracket.promote(1)

        trial_id = hyperband.get_id(trial, ignore_fidelity=True)
        assert trial_id in bracket.rungs[1]["results"]
        assert bracket.rungs[1]["results"][trial_id][1].params == trial.params
        assert candidates[0].params["epoch"] == 9