controller
zeus.controller
Controllers influence the flow or progress of training.
EarlyStopController
Bases: Callback
Controller for early stopping.
Source code in zeus/controller.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
__init__
__init__(monitor=None, eta_knob=0.5, cost_threshold=None, max_epochs=None, target_metric=None, higher_is_better=None)
Check whether training should terminate through the should_training_stop
attribute.
- If you gave max_epochs
, check after on_epoch_end()
.
- If you gave cost_threshold
, check after on_epoch_end()
.
- If you gave target_metric
, check after on_evaluate()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
monitor |
ZeusMonitor | None
|
The monitor instance to use for measuring time and energy.
Required if |
None
|
eta_knob |
float
|
The \(0 \le \eta \le 1\) knob for the Zeus time-energy cost. (Default: 0.5) |
0.5
|
cost_threshold |
float | None
|
When running the next epoch will exceed this cost. Only training cost is considered, not validation or testing cost. |
None
|
max_epochs |
int | None
|
Maximum number of epochs to run. |
None
|
target_metric |
float | None
|
Stop training when the metric reaches this value. |
None
|
higher_is_better |
bool | None
|
If |
None
|
Source code in zeus/controller.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
on_epoch_begin
on_epoch_begin()
Start measuring the cost of the next epoch.
Source code in zeus/controller.py
103 104 105 106 107 |
|
on_epoch_end
on_epoch_end()
Check if the training cost of the next epoch will exceed the threshold.
Source code in zeus/controller.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
on_evaluate
on_evaluate(metric)
Check if the target metric was reached.
Source code in zeus/controller.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
_expected_next_epoch_cost
_expected_next_epoch_cost()
Predict the total cost if the next training epoch is to be run.
Source code in zeus/controller.py
161 162 163 164 165 |
|