Skip to content
Snippets Groups Projects
Commit 4457fd69 authored by Joseph Weston's avatar Joseph Weston
Browse files

improve docstrings

parent 18212a81
No related branches found
No related tags found
No related merge requests found
...@@ -54,10 +54,30 @@ class BaseLearner(metaclass=abc.ABCMeta): ...@@ -54,10 +54,30 @@ class BaseLearner(metaclass=abc.ABCMeta):
self.data = {k: v for k, v in self.data.items() if v is not None} self.data = {k: v for k, v in self.data.items() if v is not None}
@abc.abstractmethod @abc.abstractmethod
def loss(self): def loss(self, expected=False):
pass """Return the loss for the current state of the learner.
Parameters
----------
expected : bool, default: False
If True, return the "expected" loss, i.e. the
loss including the as-yet unevaluated points
(possibly by interpolation).
"""
def choose_points(self, n, add_data=True): def choose_points(self, n, add_data=True):
"""Choose the next 'n' points to evaluate.
Parameters
----------
n : int
The number of points to choose.
add_data : bool, default: True
If True, add the chosen points to this
learner's 'data' with 'None' for the 'y'
values. Set this to False if you do not
want to modify the state of the learner.
"""
points = self._choose_points(n) points = self._choose_points(n)
if add_data: if add_data:
self.add_data(points, itertools.repeat(None)) self.add_data(points, itertools.repeat(None))
...@@ -65,11 +85,15 @@ class BaseLearner(metaclass=abc.ABCMeta): ...@@ -65,11 +85,15 @@ class BaseLearner(metaclass=abc.ABCMeta):
@abc.abstractmethod @abc.abstractmethod
def _choose_points(self, n): def _choose_points(self, n):
pass """Choose the next 'n' points to evaluate.
@abc.abstractmethod Should be overridden by subclasses.
def interpolate(self):
pass Parameters
----------
n : int
The number of points to choose.
"""
class Learner1D(BaseLearner): class Learner1D(BaseLearner):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment