... | ... |
@@ -4,7 +4,7 @@ import abc |
4 | 4 |
from contextlib import suppress |
5 | 5 |
from copy import deepcopy |
6 | 6 |
|
7 |
-from adaptive.utils import load, save |
|
7 |
+from adaptive.utils import load, save, _RequireAttrsABCMeta |
|
8 | 8 |
|
9 | 9 |
|
10 | 10 |
def uses_nth_neighbors(n): |
... | ... |
@@ -61,7 +61,7 @@ def uses_nth_neighbors(n): |
61 | 61 |
return _wrapped |
62 | 62 |
|
63 | 63 |
|
64 |
-class BaseLearner(metaclass=abc.ABCMeta): |
|
64 |
+class BaseLearner(metaclass=_RequireAttrsABCMeta): |
|
65 | 65 |
"""Base class for algorithms for learning a function 'f: X → Y'. |
66 | 66 |
|
67 | 67 |
Attributes |
... | ... |
@@ -85,6 +85,8 @@ class BaseLearner(metaclass=abc.ABCMeta): |
85 | 85 |
and returns a holoviews plot. |
86 | 86 |
""" |
87 | 87 |
|
88 |
+ required_attributes = ["data", "npoints", "pending_points"] |
|
89 |
+ |
|
88 | 90 |
def tell(self, x, y): |
89 | 91 |
"""Tell the learner about a single value. |
90 | 92 |
|