Skip to content

Commit 0323d3a

Browse files
danieldksvlandeg
andauthored
Document the Optimizer.last_score property (#934)
* Document the `Optimizer.last_score` property * Grammar fix Co-authored-by: Sofie Van Landeghem <[email protected]> * Prettier --------- Co-authored-by: Sofie Van Landeghem <[email protected]>
1 parent 0d2918f commit 0323d3a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

website/docs/api-optimizers.md

+19
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,25 @@ and parameter name.
207207
| _keyword-only_ | | |
208208
| `lr_scale` | <tt>float</tt> | Rescale the learning rate. Defaults to `1.0`. |
209209

210+
### Optimizer.last_score {#last_score tag="property", new="9"}
211+
212+
Get or set the last evaluation score. The optimizer passes this score to the
213+
learning rate schedule, so that the schedule can take training dynamics into
214+
account (see e.g. the [`plateau`](/docs/api-schedules#plateau) schedule).
215+
216+
```python
217+
### Example
218+
from thinc.api import Optimizer, constant, plateau
219+
220+
schedule = plateau(2, 0.5, constant(1.0))
221+
optimizer = Optimizer(learn_rate=schedule)
222+
optimizer.last_score = (1000, 88.34)
223+
```
224+
225+
| Argument | Type | Description |
226+
| ----------- | ------------------------------------ | ------------------------------------------ |
227+
| **RETURNS** | <tt>Optional[Tuple[int, float]]</tt> | The step and score of the last evaluation. |
228+
210229
### Optimizer.step_schedules {#step_schedules tag="method"}
211230

212231
Increase the current step of the optimizer. This step will be used by schedules

0 commit comments

Comments
 (0)