@@ -104,23 +104,23 @@ class BaseRunner(metaclass=abc.ABCMeta):
104
104
105
105
Parameters
106
106
----------
107
- learner : `~adaptive.BaseLearner` instance
108
- goal : callable, optional
107
+ learner
108
+ goal
109
109
The end condition for the calculation. This function must take
110
110
the learner as its sole argument, and return True when we should
111
111
stop requesting more points.
112
- loss_goal : float, optional
112
+ loss_goal
113
113
Convenience argument, use instead of ``goal``. The end condition for the
114
114
calculation. Stop when the loss is smaller than this value.
115
- npoints_goal : int, optional
115
+ npoints_goal
116
116
Convenience argument, use instead of ``goal``. The end condition for the
117
117
calculation. Stop when the number of points is larger or
118
118
equal than this value.
119
- end_time_goal : datetime, optional
119
+ end_time_goal
120
120
Convenience argument, use instead of ``goal``. The end condition for the
121
121
calculation. Stop when the current time is larger or equal than this
122
122
value.
123
- duration_goal : timedelta or number, optional
123
+ duration_goal
124
124
Convenience argument, use instead of ``goal``. The end condition for the
125
125
calculation. Stop when the current time is larger or equal than
126
126
``start_time + duration_goal``. ``duration_goal`` can be a number
@@ -131,22 +131,22 @@ class BaseRunner(metaclass=abc.ABCMeta):
131
131
The executor in which to evaluate the function to be learned.
132
132
If not provided, a new `~concurrent.futures.ProcessPoolExecutor` on
133
133
Linux, and a `loky.get_reusable_executor` on MacOS and Windows.
134
- ntasks : int, optional
134
+ ntasks
135
135
The number of concurrent function evaluations. Defaults to the number
136
136
of cores available in `executor`.
137
- log : bool, default: False
137
+ log
138
138
If True, record the method calls made to the learner by this runner.
139
- shutdown_executor : bool, default: False
139
+ shutdown_executor
140
140
If True, shutdown the executor when the runner has completed. If
141
141
`executor` is not provided then the executor created internally
142
142
by the runner is shut down, regardless of this parameter.
143
- retries : int, default: 0
143
+ retries
144
144
Maximum amount of retries of a certain point ``x`` in
145
145
``learner.function(x)``. After `retries` is reached for ``x``
146
146
the point is present in ``runner.failed``.
147
- raise_if_retries_exceeded : bool, default: True
147
+ raise_if_retries_exceeded
148
148
Raise the error after a point ``x`` failed `retries`.
149
- allow_running_forever : bool, default: False
149
+ allow_running_forever
150
150
Allow the runner to run forever when the goal is None.
151
151
152
152
Attributes
@@ -182,7 +182,7 @@ def __init__(
182
182
npoints_goal : int | None = None ,
183
183
end_time_goal : datetime | None = None ,
184
184
duration_goal : timedelta | int | float | None = None ,
185
- executor : ( ExecutorTypes | None ) = None ,
185
+ executor : ExecutorTypes | None = None ,
186
186
ntasks : int = None ,
187
187
log : bool = False ,
188
188
shutdown_executor : bool = False ,
@@ -391,23 +391,23 @@ class BlockingRunner(BaseRunner):
391
391
392
392
Parameters
393
393
----------
394
- learner : `~adaptive.BaseLearner` instance
395
- goal : callable, optional
394
+ learner
395
+ goal
396
396
The end condition for the calculation. This function must take
397
397
the learner as its sole argument, and return True when we should
398
398
stop requesting more points.
399
- loss_goal : float, optional
399
+ loss_goal
400
400
Convenience argument, use instead of ``goal``. The end condition for the
401
401
calculation. Stop when the loss is smaller than this value.
402
- npoints_goal : int, optional
402
+ npoints_goal
403
403
Convenience argument, use instead of ``goal``. The end condition for the
404
404
calculation. Stop when the number of points is larger or
405
405
equal than this value.
406
- end_time_goal : datetime, optional
406
+ end_time_goal
407
407
Convenience argument, use instead of ``goal``. The end condition for the
408
408
calculation. Stop when the current time is larger or equal than this
409
409
value.
410
- duration_goal : timedelta or number, optional
410
+ duration_goal
411
411
Convenience argument, use instead of ``goal``. The end condition for the
412
412
calculation. Stop when the current time is larger or equal than
413
413
``start_time + duration_goal``. ``duration_goal`` can be a number
@@ -418,20 +418,20 @@ class BlockingRunner(BaseRunner):
418
418
The executor in which to evaluate the function to be learned.
419
419
If not provided, a new `~concurrent.futures.ProcessPoolExecutor` on
420
420
Linux, and a `loky.get_reusable_executor` on MacOS and Windows.
421
- ntasks : int, optional
421
+ ntasks
422
422
The number of concurrent function evaluations. Defaults to the number
423
423
of cores available in `executor`.
424
- log : bool, default: False
424
+ log
425
425
If True, record the method calls made to the learner by this runner.
426
- shutdown_executor : bool, default: False
426
+ shutdown_executor
427
427
If True, shutdown the executor when the runner has completed. If
428
428
`executor` is not provided then the executor created internally
429
429
by the runner is shut down, regardless of this parameter.
430
- retries : int, default: 0
430
+ retries
431
431
Maximum amount of retries of a certain point ``x`` in
432
432
``learner.function(x)``. After `retries` is reached for ``x``
433
433
the point is present in ``runner.failed``.
434
- raise_if_retries_exceeded : bool, default: True
434
+ raise_if_retries_exceeded
435
435
Raise the error after a point ``x`` failed `retries`.
436
436
437
437
Attributes
@@ -471,7 +471,7 @@ def __init__(
471
471
npoints_goal : int | None = None ,
472
472
end_time_goal : datetime | None = None ,
473
473
duration_goal : timedelta | int | float | None = None ,
474
- executor : ( ExecutorTypes | None ) = None ,
474
+ executor : ExecutorTypes | None = None ,
475
475
ntasks : int | None = None ,
476
476
log : bool = False ,
477
477
shutdown_executor : bool = False ,
@@ -536,25 +536,25 @@ class AsyncRunner(BaseRunner):
536
536
537
537
Parameters
538
538
----------
539
- learner : `~adaptive.BaseLearner` instance
540
- goal : callable, optional
539
+ learner
540
+ goal
541
541
The end condition for the calculation. This function must take
542
542
the learner as its sole argument, and return True when we should
543
543
stop requesting more points.
544
544
If not provided, the runner will run forever (or stop when no more
545
545
points can be added), or until ``runner.task.cancel()`` is called.
546
- loss_goal : float, optional
546
+ loss_goal
547
547
Convenience argument, use instead of ``goal``. The end condition for the
548
548
calculation. Stop when the loss is smaller than this value.
549
- npoints_goal : int, optional
549
+ npoints_goal
550
550
Convenience argument, use instead of ``goal``. The end condition for the
551
551
calculation. Stop when the number of points is larger or
552
552
equal than this value.
553
- end_time_goal : datetime, optional
553
+ end_time_goal
554
554
Convenience argument, use instead of ``goal``. The end condition for the
555
555
calculation. Stop when the current time is larger or equal than this
556
556
value.
557
- duration_goal : timedelta or number, optional
557
+ duration_goal
558
558
Convenience argument, use instead of ``goal``. The end condition for the
559
559
calculation. Stop when the current time is larger or equal than
560
560
``start_time + duration_goal``. ``duration_goal`` can be a number
@@ -565,25 +565,25 @@ class AsyncRunner(BaseRunner):
565
565
The executor in which to evaluate the function to be learned.
566
566
If not provided, a new `~concurrent.futures.ProcessPoolExecutor` on
567
567
Linux, and a `loky.get_reusable_executor` on MacOS and Windows.
568
- ntasks : int, optional
568
+ ntasks
569
569
The number of concurrent function evaluations. Defaults to the number
570
570
of cores available in `executor`.
571
- log : bool, default: False
571
+ log
572
572
If True, record the method calls made to the learner by this runner.
573
- shutdown_executor : bool, default: False
573
+ shutdown_executor
574
574
If True, shutdown the executor when the runner has completed. If
575
575
`executor` is not provided then the executor created internally
576
576
by the runner is shut down, regardless of this parameter.
577
577
ioloop : ``asyncio.AbstractEventLoop``, optional
578
578
The ioloop in which to run the learning algorithm. If not provided,
579
579
the default event loop is used.
580
- retries : int, default: 0
580
+ retries
581
581
Maximum amount of retries of a certain point ``x`` in
582
582
``learner.function(x)``. After `retries` is reached for ``x``
583
583
the point is present in ``runner.failed``.
584
- raise_if_retries_exceeded : bool, default: True
584
+ raise_if_retries_exceeded
585
585
Raise the error after a point ``x`` failed `retries`.
586
- allow_running_forever : bool, default: True
586
+ allow_running_forever
587
587
If True, the runner will run forever if the goal is not provided.
588
588
589
589
Attributes
@@ -630,7 +630,7 @@ def __init__(
630
630
npoints_goal : int | None = None ,
631
631
end_time_goal : datetime | None = None ,
632
632
duration_goal : timedelta | int | float | None = None ,
633
- executor : ( ExecutorTypes | None ) = None ,
633
+ executor : ExecutorTypes | None = None ,
634
634
ntasks : int | None = None ,
635
635
log : bool = False ,
636
636
shutdown_executor : bool = False ,
@@ -736,22 +736,21 @@ def live_plot(
736
736
737
737
Parameters
738
738
----------
739
- runner : `~adaptive.Runner`
740
- plotter : function
739
+ plotter
741
740
A function that takes the learner as a argument and returns a
742
741
holoviews object. By default ``learner.plot()`` will be called.
743
- update_interval : int
742
+ update_interval
744
743
Number of second between the updates of the plot.
745
- name : hasable
744
+ name
746
745
Name for the `live_plot` task in `adaptive.active_plotting_tasks`.
747
746
By default the name is None and if another task with the same name
748
747
already exists that other `live_plot` is canceled.
749
- normalize : bool
748
+ normalize
750
749
Normalize (scale to fit) the frame upon each update.
751
750
752
751
Returns
753
752
-------
754
- dm : `holoviews.core.DynamicMap`
753
+ dm
755
754
The plot that automatically updates every `update_interval`.
756
755
"""
757
756
return live_plot (
@@ -811,12 +810,12 @@ def start_periodic_saving(
811
810
812
811
Parameters
813
812
----------
814
- save_kwargs : dict
813
+ save_kwargs
815
814
Key-word arguments for ``learner.save(**save_kwargs)``.
816
815
Only used if ``method=None``.
817
- interval : int
816
+ interval
818
817
Number of seconds between saving the learner.
819
- method : callable
818
+ method
820
819
The method to use for saving the learner. If None, the default
821
820
saves the learner using "pickle" which calls
822
821
``learner.save(**save_kwargs)``. Otherwise provide a callable
@@ -874,23 +873,23 @@ def simple(
874
873
875
874
Parameters
876
875
----------
877
- learner : ~`adaptive.BaseLearner` instance
878
- goal : callable, optional
876
+ learner
877
+ goal
879
878
The end condition for the calculation. This function must take
880
879
the learner as its sole argument, and return True when we should
881
880
stop requesting more points.
882
- loss_goal : float, optional
881
+ loss_goal
883
882
Convenience argument, use instead of ``goal``. The end condition for the
884
883
calculation. Stop when the loss is smaller than this value.
885
- npoints_goal : int, optional
884
+ npoints_goal
886
885
Convenience argument, use instead of ``goal``. The end condition for the
887
886
calculation. Stop when the number of points is larger or
888
887
equal than this value.
889
- end_time_goal : datetime, optional
888
+ end_time_goal
890
889
Convenience argument, use instead of ``goal``. The end condition for the
891
890
calculation. Stop when the current time is larger or equal than this
892
891
value.
893
- duration_goal : timedelta or number, optional
892
+ duration_goal
894
893
Convenience argument, use instead of ``goal``. The end condition for the
895
894
calculation. Stop when the current time is larger or equal than
896
895
``start_time + duration_goal``. ``duration_goal`` can be a number
@@ -922,9 +921,9 @@ def replay_log(
922
921
923
922
Parameters
924
923
----------
925
- learner : `~adaptive.BaseLearner` instance
924
+ learner
926
925
New learner where the log will be applied.
927
- log : list
926
+ log
928
927
contains tuples: ``(method_name, *args)``.
929
928
"""
930
929
for method , * args in log :
@@ -980,7 +979,9 @@ def _get_ncores(
980
979
# --- Useful runner goals
981
980
982
981
# TODO: deprecate
983
- def stop_after (* , seconds = 0 , minutes = 0 , hours = 0 ) -> Callable [[BaseLearner ], bool ]:
982
+ def stop_after (
983
+ * , seconds : float = 0 , minutes : float = 0 , hours : float = 0
984
+ ) -> Callable [[BaseLearner ], bool ]:
984
985
"""Stop a runner after a specified time.
985
986
986
987
For example, to specify a runner that should stop after
@@ -1000,7 +1001,7 @@ def stop_after(*, seconds=0, minutes=0, hours=0) -> Callable[[BaseLearner], bool
1000
1001
1001
1002
Returns
1002
1003
-------
1003
- goal : callable
1004
+ goal
1004
1005
Can be used as the ``goal`` parameter when constructing
1005
1006
a `Runner`.
1006
1007
@@ -1042,13 +1043,13 @@ def auto_goal(
1042
1043
1043
1044
Parameters
1044
1045
----------
1045
- loss : float, optional
1046
+ loss
1046
1047
Stop when the loss is smaller than this value.
1047
- npoints : int, optional
1048
+ npoints
1048
1049
Stop when the number of points is larger or equal than this value.
1049
- end_time : datetime, optional
1050
+ end_time
1050
1051
Stop when the current time is larger or equal than this value.
1051
- duration : timedelta or number, optional
1052
+ duration
1052
1053
Stop when the current time is larger or equal than
1053
1054
``start_time + duration``. ``duration`` can be a number
1054
1055
indicating the number of seconds.
0 commit comments