Trial¶
orion.core.worker.trial
– Container class for Trial
entity¶
-
class
orion.core.worker.trial.
Trial
(**kwargs)[source]¶ Represents an entry in database/trials collection.
Attributes: - experiment : str
Unique identifier for the experiment that produced this trial. Same as an Experiment._id.
- heartbeat : datetime.datetime
Last time trial was identified as being alive.
status
: strFor meaning of property type, see
Trial.status
.- worker : str
Corresponds to worker’s unique id that handled this trial.
- submit_time :
datetime.datetime
When was this trial suggested?
- start_time :
datetime.datetime
When was this trial first reserved?
- end_time :
datetime.datetime
When was this trial evaluated successfully?
results
: list ofTrial.Result
List of results of the trial
- params : list of
Trial.Param
List of suggested values for the Experiment parameter space. Consists a sample to be evaluated.
Methods
Param
(**kwargs)Types for a Param
can be either an integer (discrete value), floating precision numerical or a categorical expression (e.g.Result
(**kwargs)Types for a Result
can be either an evaluation of an ‘objective’ function or of an ‘constraint’ expression.Value
(**kwargs)Container for a value object. build
(trial_entries)Builder method for a list of trials. params_repr
(self[, sep])Represent with a string the parameters contained in this Trial
object.to_dict
(self)Needed to be able to convert Trial
to dict form.-
class
Param
(**kwargs)[source]¶ Types for a Param can be either an integer (discrete value), floating precision numerical or a categorical expression (e.g. a string).
Attributes: - name
type
For meaning of property type, see Value.type.
- value
Methods
to_dict
(self)Needed to be able to convert Value to dict form.
-
class
Result
(**kwargs)[source]¶ Types for a Result can be either an evaluation of an ‘objective’ function or of an ‘constraint’ expression.
Attributes: - name
type
For meaning of property type, see Value.type.
- value
Methods
to_dict
(self)Needed to be able to convert Value to dict form.
-
class
Value
(**kwargs)[source]¶ Container for a value object.
Attributes: - name : str
A possible named for the quality that this is quantifying.
type
: strFor meaning of property type, see Value.type.
- value : str or numerical
value suggested for this dimension of the parameter space.
Methods
to_dict
(self)Needed to be able to convert Value to dict form. -
__repr__
(self)¶ Represent partially with a string.
-
type
¶ For meaning of property type, see Value.type.
-
__init__
(self, **kwargs)[source]¶ See attributes of
Trial
for meaning and possible arguments for kwargs.
-
__repr__
(self)¶ Represent partially with a string.
-
classmethod
build
(trial_entries)[source]¶ Builder method for a list of trials.
Parameters: trial_entries – List of trial representation in dictionary form, as expected to be saved in a database. Returns: a list of corresponding Trial
objects.
-
full_name
¶ Generate a unique name using the full definition of parameters.
-
gradient
¶ Return this trial’s gradient value if it is evaluated, else None.
Return type: Trial.Result
-
hash_name
¶ Generate a unique name with an md5sum hash for this
Trial
.Note
Two trials that have the same
params
must have the samehash_name
.
-
id
¶ Return hash_name which is also the database key
_id
.
-
lie
¶ Return this trial’s fake objective value if it was set, else None.
Return type: Trial.Result
-
objective
¶ Return this trial’s objective value if it is evaluated, else None.
Return type: Trial.Result
-
params_repr
(self, sep=', ')[source]¶ Represent with a string the parameters contained in this
Trial
object.
-
results
¶ List of results of the trial
-
status
¶ For meaning of property type, see
Trial.status
.
-
working_dir
¶ Return the current working directory of the trial.