Skip to content
Advertisement

Trying to use GridSearchCV returning error: Check the list of available parameters with `estimator.get_params().keys()`

I’m trying to build a Voting Ensemble model, with a data transformation pipeline. I still need to put the transformation of the response variable into the pipeline. I’m trying to use GridSearchCV to evaluate the best parameters for each algorithm, but when I try to run the last code block, I get an error.

JavaScript

But when I run this last cell, i get this error:

JavaScript

Someone can help me?

Advertisement

Answer

Always, please post the stack trace of the error for people to understand

There are multiple mistakes in your code,

  1. You are creating Pipeline Object using varible_transformer, where are you fitting it?
  2. What is X and y?

Solution:

  1. Separate X-> input features needed for training and y-> the output variable values which the model has to learn.
  2. Create pipeline object, it is a wrapper that does the preprocessing for you, so fit it first before giving the input features to model.
  3. After fitting the pipeline object, you give the resultant numpy array to the classifier as the X and corresponding y to fit the model/classifier.

I am showing an example of regressors with the data that I had handy.

JavaScript

Note: Delete the classifier tag prepended to the parameter names for RandomForestclassifier in your case.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement