@@ -21,7 +21,7 @@ class AutoSklearnEstimator(BaseEstimator):
2121 def __init__ (
2222 self ,
2323 time_left_for_this_task = 3600 ,
24- per_run_time_limit = 360 ,
24+ per_run_time_limit = None ,
2525 initial_configurations_via_metalearning = 25 ,
2626 ensemble_size : int = 50 ,
2727 ensemble_nbest = 50 ,
@@ -56,7 +56,7 @@ def __init__(
5656 models. By increasing this value, *auto-sklearn* has a higher
5757 chance of finding better models.
5858
59- per_run_time_limit : int, optional (default=360 )
59+ per_run_time_limit : int, optional (default=1/10 of time_left_for_this_task )
6060 Time limit for a single call to the machine learning model.
6161 Model fitting will be terminated if the machine learning
6262 algorithm runs over the time limit. Set this value high enough so
@@ -344,8 +344,19 @@ def fit(self, **kwargs):
344344 'only one of them.'
345345 )
346346
347+ # Handle the number of jobs and the time for them
347348 if self .n_jobs is None or self .n_jobs == 1 :
348349 self ._n_jobs = 1
350+ elif self .n_jobs == - 1 :
351+ self ._n_jobs = joblib .cpu_count ()
352+ else :
353+ self ._n_jobs = self .n_jobs
354+
355+ # Automatically set the cutoff time per task
356+ if self .per_run_time_limit is None :
357+ self .per_run_time_limit = self ._n_jobs * self .time_left_for_this_task // 10
358+
359+ if self .n_jobs is None or self .n_jobs == 1 :
349360 shared_mode = self .shared_mode
350361 seed = self .seed
351362 automl = self .build_automl (
@@ -366,11 +377,6 @@ def fit(self, **kwargs):
366377 output_directory = self .output_folder ,
367378 )
368379
369- if self .n_jobs == - 1 :
370- self ._n_jobs = joblib .cpu_count ()
371- else :
372- self ._n_jobs = self .n_jobs
373-
374380 shared_mode = True
375381 seeds = set ()
376382 for i in range (self ._n_jobs ):
0 commit comments