GridSearchCV fitting multiple classifers

  • High: It blocks me to complete my task.

Hello, I have another issue with my fitting. So far when it comes to fitting an individual model with its parameters TuneGridSearchCV works fine; however, when trying to fit multiple classifiers, I start getting first the following warnings:

2022-06-03 15:33:41,937	INFO logger.py:715 -- Removed the following hyperparameter values when logging to tensorboard: {'classifier': AdaBoostClassifier()}
2022-06-03 15:33:41,956	INFO trial_runner.py:803 -- starting _Trainable_bdcee633
2022-06-03 15:33:42,363	INFO logger.py:715 -- Removed the following hyperparameter values when logging to tensorboard: {'classifier': AdaBoostClassifier()}
2022-06-03 15:33:42,374	INFO trial_runner.py:803 -- starting _Trainable_c8acc8dc
2022-06-03 15:33:43,040	INFO logger.py:715 -- Removed the following hyperparameter values when logging to tensorboard: {'classifier': AdaBoostClassifier()}
2022-06-03 15:33:43,047	INFO trial_runner.py:803 -- starting _Trainable_c8ed0636
2022-06-03 15:33:44,969	INFO logger.py:715 -- Removed the following hyperparameter values when logging to tensorboard: {'classifier': AdaBoostClassifier()}
2022-06-03 15:33:45,113	INFO trial_runner.py:803 -- starting _Trainable_c94d0078
(pid=) [2022-06-03 15:33:48,911 E 9580 16080] (raylet.exe) agent_manager.cc:107: The raylet exited immediately because the Ray agent failed. The raylet fate shares with the agent. This can happen because the Ray agent was unexpectedly killed or failed. See `dashboard_agent.log` for the root cause.
2022-06-03 15:33:51,516	INFO trial_runner.py:803 -- starting _Trainable_ca8a3b7f
2022-06-03 15:33:52,792	ERROR trial_runner.py:872 -- Trial _Trainable_bdcee633: Error processing event.

afterwards I get the following error traceback:

Traceback (most recent call last):
  File "C:\Users\Hp\Documents\GitHub\ML_project_2\tunetest.py", line 108, in <module>
    tune_search.fit(X_train,y_train)
  File "C:\Users\Hp\Documents\GitHub\ML_project_2\newEnv\lib\site-packages\tune_sklearn\tune_basesearch.py", line 622, in fit
    return self._fit(X, y, groups, tune_params, **fit_params)
  File "C:\Users\Hp\Documents\GitHub\ML_project_2\newEnv\lib\site-packages\tune_sklearn\tune_basesearch.py", line 533, in _fit
    self.analysis_ = self._tune_run(X, y, config, resources_per_trial,
  File "C:\Users\Hp\Documents\GitHub\ML_project_2\newEnv\lib\site-packages\tune_sklearn\tune_gridsearch.py", line 302, in _tune_run
    analysis = tune.run(trainable, **run_args)
  File "C:\Users\Hp\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\tune\tune.py", line 672, in run
    runner.step()
  File "C:\Users\Hp\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\tune\trial_runner.py", line 767, in step
    self._wait_and_handle_event(next_trial)
  File "C:\Users\Hp\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\tune\trial_runner.py", line 745, in _wait_and_handle_event
    raise e
  File "C:\Users\Hp\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\tune\trial_runner.py", line 730, in _wait_and_handle_event
    self._on_executor_error(trial, result)
  File "C:\Users\Hp\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\tune\trial_runner.py", line 874, in _on_executor_error
    raise result[0]
  File "C:\Users\Hp\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\tune\ray_trial_executor.py", line 901, in get_next_executor_event
    future_result = ray.get(ready_future)
  File "C:\Users\Hp\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\_private\client_mode_hook.py", line 105, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\Hp\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\worker.py", line 1803, in get
    values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout)
  File "C:\Users\Hp\AppData\Local\Programs\Python\Python39\lib\site-packages\ray\worker.py", line 362, in get_objects
    data_metadata_pairs = self.core_worker.get_objects(
  File "python\ray\_raylet.pyx", line 1198, in ray._raylet.CoreWorker.get_objects
  File "python\ray\_raylet.pyx", line 173, in ray._raylet.check_status
ray.exceptions.RaySystemError: System error: Unknown error

probably due to the fact that the actual classifier is removed from the pipeline.

I set the classifiers and their respective parameters parameters as follows, just like I would do with scikit-learn’s GridSearchCV:

clf1 = AdaBoostClassifier()
params1 = {"classifier__n_estimators": [50, 100, 150, 200],
           "classifier__learning_rate": [0.1, 0.5, 1, 5, 10],
           "classifier__random_state": [20, 42, 301, 2000],
           "classifier" : [clf1]}

# https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html
clf2= SVC()
params2 = {"classifier__C":[1.0, 2.0, 3.0, 5.0, 7.0, 10.0],
            'classifier__kernel' : ['rbf','sigmoid'],
            'classifier__tol' : [1e-4, 1e-3, 1e-2],
            "classifier":[clf2]}

....

params = [params1, params2]
classifier = Pipeline([('classifier',clf1)])

tune_search = TuneGridSearchCV(classifier, params)

is it because it can’t handle python objects, or is it something else? If it’s the former, is there any way to combine multiple classifiers in the grid sarch that I don’t know about?