Пример #1
0
 def test_hash_ignore_experiment(self, trial_config):
     """Check property `Trial.compute_trial_hash(ignore_experiment=True)`."""
     trial_config["params"].append({
         "name": "/max_epoch",
         "type": "fidelity",
         "value": "1"
     })
     t1 = Trial(**trial_config)
     trial_config["experiment"] = "test"  # changing the experiment name
     t2 = Trial(**trial_config)
     assert t1.hash_name != t2.hash_name
     assert t1.hash_params != t2.hash_params
     assert Trial.compute_trial_hash(
         t1, ignore_experiment=True) == Trial.compute_trial_hash(
             t2, ignore_experiment=True)
Пример #2
0
 def _update_params_hashes(self, trials):
     """Register locally all param hashes of trials"""
     for trial in trials:
         self.params_hashes.add(
             Trial.compute_trial_hash(trial,
                                      ignore_experiment=True,
                                      ignore_lie=True))
Пример #3
0
def _get_id(trial: Trial) -> str:
    """Returns the unique identifier to be used to store the trial.

    Only to be used internally in this module. This ignores the `experiment`
    attribute of the trial.
    """
    return Trial.compute_trial_hash(trial, ignore_experiment=True)
Пример #4
0
 def test_hash_ignore_lie(self, trial_config):
     """Check property `Trial.compute_trial_hash(ignore_lie=True)`."""
     trial_config["params"].append({
         "name": "/max_epoch",
         "type": "fidelity",
         "value": "1"
     })
     t1 = Trial(**trial_config)
     # Add a lie
     trial_config["results"].append({
         "name": "lie",
         "type": "lie",
         "value": 1
     })
     t2 = Trial(**trial_config)
     assert t1.hash_name != t2.hash_name
     assert t1.hash_params == t2.hash_params
     assert Trial.compute_trial_hash(
         t1, ignore_lie=True) == Trial.compute_trial_hash(t2,
                                                          ignore_lie=True)
Пример #5
0
 def _prevalidate_trial(self, new_trial):
     """Verify if trial is not in parent history"""
     if Trial.compute_trial_hash(
             new_trial, ignore_experiment=True) in self.params_hashes:
         raise DuplicateKeyError
Пример #6
0
 def hash_params(self):
     """See `~orion.core.worker.trial.Trial`"""
     return OrionTrial.compute_trial_hash(self, ignore_fidelity=True)