@@ -83,10 +83,18 @@ class BaseRunner(metaclass=abc.ABCMeta):
83
83
Parameters
84
84
----------
85
85
learner : `~adaptive.BaseLearner` instance
86
- goal : callable
86
+ goal : callable, optional
87
87
The end condition for the calculation. This function must take
88
88
the learner as its sole argument, and return True when we should
89
- stop requesting more points.
89
+ stop requesting more points. (Advanced use) Instead of providing a
90
+ function, see `auto_goal` for other types that are accepted here.
91
+ loss_goal : float, optional
92
+ Convenience argument, use instead of ``goal``. The end condition for the
93
+ calculation. Stop when the loss is smaller than this value.
94
+ npoints_goal : int, optional
95
+ Convenience argument, use instead of ``goal``. The end condition for the
96
+ calculation. Stop when the number of points is larger or
97
+ equal than this value.
90
98
executor : `concurrent.futures.Executor`, `distributed.Client`,\
91
99
`mpi4py.futures.MPIPoolExecutor`, `ipyparallel.Client` or\
92
100
`loky.get_reusable_executor`, optional
@@ -340,7 +348,15 @@ class BlockingRunner(BaseRunner):
340
348
goal : callable
341
349
The end condition for the calculation. This function must take
342
350
the learner as its sole argument, and return True when we should
343
- stop requesting more points.
351
+ stop requesting more points. (Advanced use) Instead of providing a
352
+ function, see `auto_goal` for other types that are accepted here.
353
+ loss_goal : float
354
+ Convenience argument, use instead of ``goal``. The end condition for the
355
+ calculation. Stop when the loss is smaller than this value.
356
+ npoints_goal : int
357
+ Convenience argument, use instead of ``goal``. The end condition for the
358
+ calculation. Stop when the number of points is larger or
359
+ equal than this value.
344
360
executor : `concurrent.futures.Executor`, `distributed.Client`,\
345
361
`mpi4py.futures.MPIPoolExecutor`, `ipyparallel.Client` or\
346
362
`loky.get_reusable_executor`, optional
@@ -465,8 +481,17 @@ class AsyncRunner(BaseRunner):
465
481
goal : callable, optional
466
482
The end condition for the calculation. This function must take
467
483
the learner as its sole argument, and return True when we should
468
- stop requesting more points. If not provided, the runner will run
469
- forever, or until ``self.task.cancel()`` is called.
484
+ stop requesting more points. (Advanced use) Instead of providing a
485
+ function, see `auto_goal` for other types that are accepted here.
486
+ If not provided, the runner will run forever (or stop when no more
487
+ points can be added), or until ``self.task.cancel()`` is called.
488
+ loss_goal : float, optional
489
+ Convenience argument, use instead of ``goal``. The end condition for the
490
+ calculation. Stop when the loss is smaller than this value.
491
+ npoints_goal : int, optional
492
+ Convenience argument, use instead of ``goal``. The end condition for the
493
+ calculation. Stop when the number of points is larger or
494
+ equal than this value.
470
495
executor : `concurrent.futures.Executor`, `distributed.Client`,\
471
496
`mpi4py.futures.MPIPoolExecutor`, `ipyparallel.Client` or\
472
497
`loky.get_reusable_executor`, optional
@@ -765,8 +790,16 @@ def simple(
765
790
----------
766
791
learner : ~`adaptive.BaseLearner` instance
767
792
goal : callable
768
- The end condition for the calculation. This function must take the
769
- learner as its sole argument, and return True if we should stop.
793
+ The end condition for the calculation. This function must take
794
+ the learner as its sole argument, and return True when we should
795
+ stop requesting more points.
796
+ loss_goal : float, optional
797
+ Convenience argument, use instead of ``goal``. The end condition for the
798
+ calculation. Stop when the loss is smaller than this value.
799
+ npoints_goal : int, optional
800
+ Convenience argument, use instead of ``goal``. The end condition for the
801
+ calculation. Stop when the number of points is larger or
802
+ equal than this value.
770
803
"""
771
804
goal = _goal (learner , goal , loss_goal , npoints_goal , allow_running_forever = False )
772
805
while not goal (learner ):
@@ -912,7 +945,7 @@ def auto_goal(
912
945
goal : GoalTypes ,
913
946
learner : BaseLearner ,
914
947
allow_running_forever : bool = True ,
915
- ):
948
+ ) -> Callable [[ BaseLearner ], bool ] :
916
949
"""Extract a goal from the learners.
917
950
918
951
Parameters
0 commit comments