Skip to content

The automl.search() keep crashing #4467

@rachelchann

Description

@rachelchann

The automl.search keep crushing after i have with error messages
ValueError: GradientBoostingQuantileRegressor(base_estimator=GradientBoostingRegressor(loss='quantile', n_estimators=30), quantiles=[0.16, 0.5, 0.84], random_state=209652396) has to be a regressor.
I wonder if it is my package installation problems or the code has problems.

My code is as follows:
`y_train = X_train["show"]
X_train = X_train.drop(["show", "index_a", "index_b"], axis=1)

y_test = X_test["show"]
X_test = X_test.drop(["show", "index_a", "index_b"], axis=1)

import evalml
from evalml import AutoMLSearch
from evalml import AutoMLSearch
from evalml.model_family import ModelFamily
from evalml.tuners import RandomSearchTuner
automl = AutoMLSearch(
X_train=X_train,
y_train=y_train,
problem_type="binary", # For binary classification
max_time=3600, # Search for 10 minutes
objective="f1", # Optimize for F1 score (you can choose others)
verbose=True, # Show progress in the console
n_jobs= -1,

)

Start the AutoML search

automl.search()the error message is as follows:Evaluating Baseline Pipeline: Mode Baseline Binary Classification Pipeline
Mode Baseline Binary Classification Pipeline:
Starting cross validation
Finished cross validation - mean F1: 0.000

ValueError Traceback (most recent call last)
Cell In[17], line 2
1 # Start the AutoML search
----> 2 automl.search()

File /opt/anaconda3/envs/leica/lib/python3.12/site-packages/evalml/automl/automl_search.py:1075, in AutoMLSearch.search(self, interactive_plot)
1073 try:
1074 if not loop_interrupted:
-> 1075 current_batch_pipelines = self.automl_algorithm.next_batch()
1076 except StopIteration:
1077 self.logger.info("AutoML Algorithm out of recommendations, ending")

File /opt/anaconda3/envs/leica/lib/python3.12/site-packages/evalml/automl/automl_algorithm/default_algorithm.py:466, in DefaultAlgorithm.next_batch(self)
464 else:
465 if self._batch_number == 0:
--> 466 next_batch = self._create_naive_pipelines()
467 elif self._batch_number == 1:
468 next_batch = self._create_naive_pipelines(use_features=True)

File /opt/anaconda3/envs/leica/lib/python3.12/site-packages/evalml/automl/automl_algorithm/default_algorithm.py:251, in DefaultAlgorithm._create_naive_pipelines(self, use_features)
232 pipelines = [
233 make_pipeline(
234 X=self.X,
(...) 248 for estimator in estimators
249 ]
250 pipelines = self._add_without_pipelines(pipelines, estimators, feature_selector)
--> 251 pipelines = self._init_pipelines_with_starter_params(pipelines)
252 return pipelines

File /opt/anaconda3/envs/leica/lib/python3.12/site-packages/evalml/automl/automl_algorithm/default_algorithm.py:206, in DefaultAlgorithm._init_pipelines_with_starter_params(self, pipelines)
204 next_batch = []
205 for pipeline in pipelines:
--> 206 self._create_tuner(pipeline)
207 starting_parameters = self._tuners[pipeline.name].get_starting_parameters(
208 self._hyperparameters,
209 self.random_seed,
210 )
211 parameters = self._transform_parameters(pipeline, starting_parameters)

File /opt/anaconda3/envs/leica/lib/python3.12/site-packages/evalml/automl/automl_algorithm/automl_algorithm.py:90, in AutoMLAlgorithm._create_tuner(self, pipeline)
86 """Creates a tuner given the input pipeline."""
87 pipeline_hyperparameters = pipeline.get_hyperparameter_ranges(
88 self._hyperparameters,
89 )
---> 90 self._tuners[pipeline.name] = self._tuner_class(
91 pipeline_hyperparameters,
92 random_seed=self.random_seed,
93 )

File /opt/anaconda3/envs/leica/lib/python3.12/site-packages/evalml/tuners/skopt_tuner.py:43, in SKOptTuner.init(self, pipeline_hyperparameter_ranges, random_seed)
41 def init(self, pipeline_hyperparameter_ranges, random_seed=0):
42 super().init(pipeline_hyperparameter_ranges, random_seed=random_seed)
---> 43 self.opt = Optimizer(
44 self._search_space_ranges,
45 "GBRT",
46 acq_optimizer="sampling",
47 random_state=random_seed,
48 )

File /opt/anaconda3/envs/leica/lib/python3.12/site-packages/skopt/optimizer/optimizer.py:257, in Optimizer.init(self, dimensions, base_estimator, n_random_starts, n_initial_points, initial_point_generator, n_jobs, acq_func, acq_optimizer, random_state, model_queue_size, space_constraint, acq_func_kwargs, acq_optimizer_kwargs, avoid_duplicates)
255 # check if regressor
256 if not is_regressor(base_estimator) and base_estimator is not None:
--> 257 raise ValueError("%s has to be a regressor." % base_estimator)
259 # treat per second acqusition function specially
260 is_multi_regressor = isinstance(base_estimator, MultiOutputRegressor)

ValueError: GradientBoostingQuantileRegressor(base_estimator=GradientBoostingRegressor(loss='quantile',
n_estimators=30),
quantiles=[0.16, 0.5, 0.84],
random_state=209652396) has to be a regressor.`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions