@@ -84,7 +84,7 @@ class BaseRunner(metaclass=abc.ABCMeta):
84
84
Convenience argument, use instead of ``goal``. The end condition for the
85
85
calculation. Stop when the number of points is larger or
86
86
equal than this value.
87
- datetime_goal : datetime, optional
87
+ end_time_goal : datetime, optional
88
88
Convenience argument, use instead of ``goal``. The end condition for the
89
89
calculation. Stop when the current time is larger or equal than this
90
90
value.
@@ -147,7 +147,7 @@ def __init__(
147
147
* ,
148
148
loss_goal : float | None = None ,
149
149
npoints_goal : int | None = None ,
150
- datetime_goal : datetime | None = None ,
150
+ end_time_goal : datetime | None = None ,
151
151
duration_goal : timedelta | None = None ,
152
152
executor = None ,
153
153
ntasks = None ,
@@ -164,7 +164,7 @@ def __init__(
164
164
goal ,
165
165
loss_goal ,
166
166
npoints_goal ,
167
- datetime_goal ,
167
+ end_time_goal ,
168
168
duration_goal ,
169
169
allow_running_forever ,
170
170
)
@@ -422,7 +422,7 @@ def __init__(
422
422
* ,
423
423
loss_goal : float | None = None ,
424
424
npoints_goal : int | None = None ,
425
- datetime_goal : datetime | None = None ,
425
+ end_time_goal : datetime | None = None ,
426
426
duration_goal : timedelta | None = None ,
427
427
executor = None ,
428
428
ntasks = None ,
@@ -438,7 +438,7 @@ def __init__(
438
438
goal = goal ,
439
439
loss_goal = loss_goal ,
440
440
npoints_goal = npoints_goal ,
441
- datetime_goal = datetime_goal ,
441
+ end_time_goal = end_time_goal ,
442
442
duration_goal = duration_goal ,
443
443
executor = executor ,
444
444
ntasks = ntasks ,
@@ -503,7 +503,7 @@ class AsyncRunner(BaseRunner):
503
503
Convenience argument, use instead of ``goal``. The end condition for the
504
504
calculation. Stop when the number of points is larger or
505
505
equal than this value.
506
- datetime_goal : datetime, optional
506
+ end_time_goal : datetime, optional
507
507
Convenience argument, use instead of ``goal``. The end condition for the
508
508
calculation. Stop when the current time is larger or equal than this
509
509
value.
@@ -580,7 +580,7 @@ def __init__(
580
580
* ,
581
581
loss_goal : float | None = None ,
582
582
npoints_goal : int | None = None ,
583
- datetime_goal : datetime | None = None ,
583
+ end_time_goal : datetime | None = None ,
584
584
duration_goal : timedelta | None = None ,
585
585
executor = None ,
586
586
ntasks = None ,
@@ -612,7 +612,7 @@ def __init__(
612
612
goal = goal ,
613
613
loss_goal = loss_goal ,
614
614
npoints_goal = npoints_goal ,
615
- datetime_goal = datetime_goal ,
615
+ end_time_goal = end_time_goal ,
616
616
duration_goal = duration_goal ,
617
617
executor = executor ,
618
618
ntasks = ntasks ,
@@ -799,7 +799,7 @@ def simple(
799
799
* ,
800
800
loss_goal : float | None = None ,
801
801
npoints_goal : int | None = None ,
802
- datetime_goal : datetime | None = None ,
802
+ end_time_goal : datetime | None = None ,
803
803
duration_goal : timedelta | None = None ,
804
804
):
805
805
"""Run the learner until the goal is reached.
@@ -827,7 +827,7 @@ def simple(
827
827
Convenience argument, use instead of ``goal``. The end condition for the
828
828
calculation. Stop when the number of points is larger or
829
829
equal than this value.
830
- datetime_goal : datetime, optional
830
+ end_time_goal : datetime, optional
831
831
Convenience argument, use instead of ``goal``. The end condition for the
832
832
calculation. Stop when the current time is larger or equal than this
833
833
value.
@@ -841,7 +841,7 @@ def simple(
841
841
goal ,
842
842
loss_goal ,
843
843
npoints_goal ,
844
- datetime_goal ,
844
+ end_time_goal ,
845
845
duration_goal ,
846
846
allow_running_forever = False ,
847
847
)
@@ -973,7 +973,8 @@ class _TimeGoal:
973
973
def __init__ (self , dt : timedelta | datetime | int | float ):
974
974
if not isinstance (dt , (timedelta , datetime )):
975
975
self .dt = timedelta (seconds = dt )
976
- self .dt = dt
976
+ else :
977
+ self .dt = dt
977
978
self .start_time = None
978
979
979
980
def __call__ (self , _ ):
@@ -990,7 +991,7 @@ def auto_goal(
990
991
* ,
991
992
loss : float | None = None ,
992
993
npoints : int | None = None ,
993
- datetime : datetime | None = None ,
994
+ end_time : datetime | None = None ,
994
995
duration : timedelta | int | None = None ,
995
996
learner : BaseLearner | None = None ,
996
997
allow_running_forever : bool = True ,
@@ -1003,7 +1004,7 @@ def auto_goal(
1003
1004
TODO
1004
1005
npoints
1005
1006
TODO
1006
- datetime
1007
+ end_time
1007
1008
TODO
1008
1009
duration
1009
1010
TODO
@@ -1020,14 +1021,14 @@ def auto_goal(
1020
1021
kw = dict (
1021
1022
loss = loss ,
1022
1023
npoints = npoints ,
1023
- datetime = datetime ,
1024
+ end_time = end_time ,
1024
1025
duration = duration ,
1025
1026
allow_running_forever = allow_running_forever ,
1026
1027
)
1027
- opts = (loss , npoints , datetime , duration ) # all are mutually exclusive
1028
+ opts = (loss , npoints , end_time , duration ) # all are mutually exclusive
1028
1029
if sum (v is not None for v in opts ) > 1 :
1029
1030
raise ValueError (
1030
- "Only one of loss, npoints, datetime , duration can be specified."
1031
+ "Only one of loss, npoints, end_time , duration can be specified."
1031
1032
)
1032
1033
1033
1034
if loss is not None :
@@ -1040,8 +1041,8 @@ def auto_goal(
1040
1041
return lambda learner : all (goal (l ) for l , goal in zip (learner .learners , goals ))
1041
1042
if npoints is not None :
1042
1043
return lambda learner : learner .npoints >= npoints
1043
- if datetime is not None :
1044
- return _TimeGoal (datetime )
1044
+ if end_time is not None :
1045
+ return _TimeGoal (end_time )
1045
1046
if duration is not None :
1046
1047
return _TimeGoal (duration )
1047
1048
if isinstance (learner , DataSaver ):
@@ -1066,7 +1067,7 @@ def _goal(
1066
1067
goal : Callable [[BaseLearner ], bool ] | None ,
1067
1068
loss_goal : float | None ,
1068
1069
npoints_goal : int | None ,
1069
- datetime_goal : datetime | None ,
1070
+ end_time_goal : datetime | None ,
1070
1071
duration_goal : timedelta | None ,
1071
1072
allow_running_forever : bool ,
1072
1073
):
@@ -1076,18 +1077,18 @@ def _goal(
1076
1077
if goal is not None and (
1077
1078
loss_goal is not None
1078
1079
or npoints_goal is not None
1079
- or datetime_goal is not None
1080
+ or end_time_goal is not None
1080
1081
or duration_goal is not None
1081
1082
):
1082
1083
raise ValueError (
1083
- "Either goal, loss_goal, npoints_goal, datetime_goal or"
1084
+ "Either goal, loss_goal, npoints_goal, end_time_goal or"
1084
1085
" duration_goal can be specified, not multiple."
1085
1086
)
1086
1087
return auto_goal (
1087
1088
learner = learner ,
1088
1089
loss = loss_goal ,
1089
1090
npoints = npoints_goal ,
1090
- datetime = datetime_goal ,
1091
+ end_time = end_time_goal ,
1091
1092
duration = duration_goal ,
1092
1093
allow_running_forever = allow_running_forever ,
1093
1094
)
0 commit comments