Skip to content

Commit

Permalink
Document the Optimizer.last_score property (#934)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
danieldk and svlandeg authored Apr 23, 2024
1 parent 0d2918f commit 0323d3a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions website/docs/api-optimizers.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,25 @@ and parameter name.
| _keyword-only_ | | |
| `lr_scale` | <tt>float</tt> | Rescale the learning rate. Defaults to `1.0`. |

### Optimizer.last_score {#last_score tag="property", new="9"}

Get or set the last evaluation score. The optimizer passes this score to the
learning rate schedule, so that the schedule can take training dynamics into
account (see e.g. the [`plateau`](/docs/api-schedules#plateau) schedule).

```python
### Example
from thinc.api import Optimizer, constant, plateau

schedule = plateau(2, 0.5, constant(1.0))
optimizer = Optimizer(learn_rate=schedule)
optimizer.last_score = (1000, 88.34)
```

| Argument | Type | Description |
| ----------- | ------------------------------------ | ------------------------------------------ |
| **RETURNS** | <tt>Optional[Tuple[int, float]]</tt> | The step and score of the last evaluation. |

### Optimizer.step_schedules {#step_schedules tag="method"}

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

0 comments on commit 0323d3a

Please sign in to comment.