Skip to content

Cache the loss of a SequenceLearner #411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion adaptive/learner/sequence_learner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
from sortedcontainers import SortedDict, SortedSet

from adaptive.learner.base_learner import BaseLearner
from adaptive.utils import assign_defaults, partial_function_from_dataframe
from adaptive.utils import (
assign_defaults,
cache_latest,
partial_function_from_dataframe,
)

try:
import pandas
Expand Down Expand Up @@ -113,6 +117,7 @@ def ask(

return points, loss_improvements

@cache_latest
def loss(self, real: bool = True) -> float:
if not (self._to_do_indices or self.pending_points):
return 0.0
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# -- Project information -----------------------------------------------------

project = "adaptive"
copyright = "2018-2022, Adaptive Authors"
copyright = "2018-2023, Adaptive Authors"
author = "Adaptive Authors"

# The short X.Y version
Expand Down