Skip to content

Commit

Permalink
processes as a parameter for easier debuggign
Browse files Browse the repository at this point in the history
  • Loading branch information
perib committed Apr 19, 2023
1 parent b8aa09f commit 00819dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tpot2/tpot_estimator/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def __init__(self, scorers,
verbose = 0,
periodic_checkpoint_folder = None,
callback: tpot2.CallBackInterface = None,
processes = True,
):

'''
Expand Down Expand Up @@ -376,6 +377,10 @@ def __init__(self, scorers,
callback : tpot2.CallBackInterface, default=None
Callback object. Not implemented
processes : bool, default=True
If True, will use multiprocessing to parallelize the optimization process. If False, will use threading.
True seems to perform better. However, False is required for interactive debugging.
'''

# sklearn BaseEstimator must have a corresponding attribute for each parameter.
Expand Down Expand Up @@ -443,6 +448,8 @@ def __init__(self, scorers,

self.objective_function_names = objective_function_names

self.processes = processes

#Initialize other used params


Expand Down Expand Up @@ -508,7 +515,7 @@ def fit(self, X, y):
silence_logs = 50
cluster = LocalCluster(n_workers=self.n_jobs, #if no client is passed in and no global client exists, create our own
threads_per_worker=1,
processes=True,
processes=self.processes,
silence_logs=silence_logs,
memory_limit=self.memory_limit)
_client = Client(cluster)
Expand Down
4 changes: 4 additions & 0 deletions tpot2/tpot_estimator/templates/tpottemplates.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def __init__( self,
verbose=0,
periodic_checkpoint_folder=None,
callback: tpot2.CallBackInterface=None,
processes = True,
):
super(TPOTRegressor,self).__init__(
scorers=scorers,
Expand Down Expand Up @@ -127,6 +128,7 @@ def __init__( self,
verbose=verbose,
periodic_checkpoint_folder=periodic_checkpoint_folder,
callback=callback,
processes=processes,
)


Expand Down Expand Up @@ -191,6 +193,7 @@ def __init__( self,
verbose=0,
periodic_checkpoint_folder=None,
callback: tpot2.CallBackInterface=None,
processes = True,
):
super(TPOTClassifier,self).__init__(
scorers=scorers,
Expand Down Expand Up @@ -252,6 +255,7 @@ def __init__( self,
verbose=verbose,
periodic_checkpoint_folder=periodic_checkpoint_folder,
callback=callback,
processes = processes,
)


Expand Down

0 comments on commit 00819dd

Please sign in to comment.