Skip to content

Commit 0116e17

Browse files
committed
require 'npoints', 'pending_points', and 'data' in the BaseLearner
1 parent 3b2ae11 commit 0116e17

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

adaptive/learner/base_learner.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from contextlib import suppress
55
from copy import deepcopy
66

7-
from adaptive.utils import load, save
7+
from adaptive.utils import load, save, _RequireAttrsABCMeta
88

99

1010
def uses_nth_neighbors(n):
@@ -61,7 +61,7 @@ def _wrapped(loss_per_interval):
6161
return _wrapped
6262

6363

64-
class BaseLearner(metaclass=abc.ABCMeta):
64+
class BaseLearner(metaclass=_RequireAttrsABCMeta):
6565
"""Base class for algorithms for learning a function 'f: X → Y'.
6666
6767
Attributes
@@ -85,6 +85,8 @@ class BaseLearner(metaclass=abc.ABCMeta):
8585
and returns a holoviews plot.
8686
"""
8787

88+
required_attributes = ["data", "npoints", "pending_points"]
89+
8890
def tell(self, x, y):
8991
"""Tell the learner about a single value.
9092

0 commit comments

Comments
 (0)