tune.concepts.flow
tune.concepts.flow.judge
- class Monitor[source]
Bases:
object
- on_get_budget(trial, rung, budget)[source]
- Parameters
trial (tune.concepts.flow.trial.Trial) –
rung (int) –
budget (float) –
- Return type
None
- on_judge(decision)[source]
- Parameters
decision (tune.concepts.flow.judge.TrialDecision) –
- Return type
None
- on_report(report)[source]
- Parameters
report (tune.concepts.flow.report.TrialReport) –
- Return type
None
- class NoOpTrailJudge(monitor=None)[source]
Bases:
tune.concepts.flow.judge.TrialJudge
- Parameters
monitor (Optional[Monitor]) –
- can_accept(trial)[source]
- Parameters
trial (tune.concepts.flow.trial.Trial) –
- Return type
bool
- get_budget(trial, rung)[source]
- Parameters
trial (tune.concepts.flow.trial.Trial) –
rung (int) –
- Return type
float
- judge(report)[source]
- Parameters
report (tune.concepts.flow.report.TrialReport) –
- Return type
- class RemoteTrialJudge(entrypoint)[source]
Bases:
tune.concepts.flow.judge.TrialJudge
- Parameters
entrypoint (Callable[[str, Dict[str, Any]], Any]) –
- can_accept(trial)[source]
- Parameters
trial (tune.concepts.flow.trial.Trial) –
- Return type
bool
- get_budget(trial, rung)[source]
- Parameters
trial (tune.concepts.flow.trial.Trial) –
rung (int) –
- Return type
float
- judge(report)[source]
- Parameters
report (tune.concepts.flow.report.TrialReport) –
- Return type
- property report: Optional[tune.concepts.flow.report.TrialReport]
- class TrialCallback(judge)[source]
Bases:
object
- Parameters
judge (tune.concepts.flow.judge.TrialJudge) –
- class TrialDecision(report, budget, should_checkpoint, reason='', metadata=None)[source]
Bases:
object
- Parameters
report (tune.concepts.flow.report.TrialReport) –
budget (float) –
should_checkpoint (bool) –
reason (str) –
metadata (Optional[Dict[str, Any]]) –
- property budget: float
- property metadata: Dict[str, Any]
- property reason: str
- property report: tune.concepts.flow.report.TrialReport
- property should_checkpoint: bool
- property should_stop: bool
- property trial: tune.concepts.flow.trial.Trial
- property trial_id: str
- class TrialJudge(monitor=None)[source]
Bases:
object
- Parameters
monitor (Optional[Monitor]) –
- can_accept(trial)[source]
- Parameters
trial (tune.concepts.flow.trial.Trial) –
- Return type
bool
- get_budget(trial, rung)[source]
- Parameters
trial (tune.concepts.flow.trial.Trial) –
rung (int) –
- Return type
float
- judge(report)[source]
- Parameters
report (tune.concepts.flow.report.TrialReport) –
- Return type
- property monitor: tune.concepts.flow.judge.Monitor
- reset_monitor(monitor=None)[source]
- Parameters
monitor (Optional[tune.concepts.flow.judge.Monitor]) –
- Return type
None
tune.concepts.flow.report
- class TrialReport(trial, metric, params=None, metadata=None, cost=1.0, rung=0, sort_metric=None, log_time=None)[source]
Bases:
object
The result from running the objective. It is immutable.
- Parameters
trial (tune.concepts.flow.trial.Trial) – the original trial sent to the objective
metric (Any) – the raw metric from the objective output
params (Any) – updated parameters based on the trial input, defaults to None. If none, it means the params from the trial was not updated, otherwise it is an object convertible to
TuningParametersTemplate
byto_template()
metadata (Optional[Dict[str, Any]]) – metadata from the objective output, defaults to None
cost (float) – cost to run the objective, defaults to 1.0
rung (int) – number of rungs in the current objective, defaults to 0. This is for iterative problems
sort_metric (Any) – the metric for comparison, defaults to None. It must be smaller better. If not set, it implies the
metric
issort_metric
and it is smaller betterlog_time (Any) – the time generating this report, defaults to None. If None, current time will be used
Attention
This class is not for users to construct directly.
- copy()[source]
Copy the current object.
- Returns
the copied object
- Return type
Note
This is shallow copy, but it is also used by __deepcopy__ of this object. This is because we disable deepcopy of TrialReport.
- property cost: float
The cost to run the objective
- fill_dict(data)[source]
Fill a row of
StudyResult
with the report information- Parameters
data (Dict[str, Any]) – a row (as dict) from
StudyResult
- Returns
the updated
data
- Return type
Dict[str, Any]
- generate_sort_metric(min_better, digits)[source]
Construct a new report object with the new derived``sort_metric``
- Parameters
min_better (bool) – whether the current
metric()
is smaller betterdigits (int) – number of digits to keep in
sort_metric
- Returns
a new object with the updated value
- Return type
- property log_time: datetime.datetime
The time generating this report
- property metadata: Dict[str, Any]
The metadata from the objective output
- property metric: float
The raw metric from the objective output
- property params: tune.concepts.space.parameters.TuningParametersTemplate
The parameters used by the objective to generate the
metric()
- reset_log_time()[source]
Reset
log_time()
to now- Return type
- property rung: int
The number of rungs in the current objective, defaults to 0. This is for iterative problems
- property sort_metric: float
The metric for comparison
- property trial: tune.concepts.flow.trial.Trial
The original trial sent to the objective
- property trial_id: str
- with_cost(cost)[source]
Construct a new report object with the new
cost
- Parameters
cost (float) – new cost
- Returns
a new object with the updated value
- Return type
- with_rung(rung)[source]
Construct a new report object with the new
rung
- Parameters
rung (int) – new rung
- Returns
a new object with the updated value
- Return type
- class TrialReportHeap(min_heap)[source]
Bases:
object
- Parameters
min_heap (bool) –
- push(report)[source]
- Parameters
report (tune.concepts.flow.report.TrialReport) –
- Return type
None
- values()[source]
- Return type
Iterable[tune.concepts.flow.report.TrialReport]
- class TrialReportLogger(new_best_only=False)[source]
Bases:
object
- Parameters
new_best_only (bool) –
- property best: Optional[tune.concepts.flow.report.TrialReport]
- log(report)[source]
- Parameters
report (tune.concepts.flow.report.TrialReport) –
- Return type
None
- on_report(report)[source]
- Parameters
report (tune.concepts.flow.report.TrialReport) –
- Return type
bool
tune.concepts.flow.trial
- class Trial(trial_id, params, metadata=None, keys=None, dfs=None)[source]
Bases:
object
The input data collection for running an objective. It is immutable.
- Parameters
trial_id (str) – the unique id for a trial
params (Any) – parameters for tuning, an object convertible to
TuningParametersTemplate
byto_template()
metadata (Optional[Dict[str, Any]]) – metadata for tuning, defaults to None. It is set during the construction of
TuneDataset
keys (Optional[List[str]]) – partitions keys of the
TuneDataset
, defaults to Nonedfs (Optional[Dict[str, Any]]) – dataframes extracted from
TuneDataset
, defaults to None
Attention
This class is not for users to construct directly. Use
Space
instead.- copy()[source]
Copy the current object.
- Returns
the copied object
- Return type
Note
This is shallow copy, but it is also used by __deepcopy__ of this object. This is because we disable deepcopy of Trial.
- property dfs: Dict[str, Any]
Dataframes extracted from
TuneDataset
- property keys: List[str]
Partitions keys of the
TuneDataset
- property metadata: Dict[str, Any]
Metadata of the trial
- property params: tune.concepts.space.parameters.TuningParametersTemplate
Parameters for tuning
- property trial_id: str
The unique id of this trial
- with_dfs(dfs)[source]
Set dataframes for the trial, a new Trial object will be constructed and with the new
dfs
- Parameters
dfs (Dict[str, Any]) – dataframes to attach to the trial
- Return type